Re: [Stox] core: response code mappings

Daniel-Constantin Mierla <miconda@gmail.com> Tue, 20 August 2013 09:14 UTC

Return-Path: <miconda@gmail.com>
X-Original-To: stox@ietfa.amsl.com
Delivered-To: stox@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9EB4011E81ED for <stox@ietfa.amsl.com>; Tue, 20 Aug 2013 02:14:38 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.728
X-Spam-Level:
X-Spam-Status: No, score=-1.728 tagged_above=-999 required=5 tests=[AWL=-0.000, BAYES_00=-2.599, HTML_MESSAGE=0.001, SARE_MLH_Stock1=0.87]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3SjEygH7cl+g for <stox@ietfa.amsl.com>; Tue, 20 Aug 2013 02:14:37 -0700 (PDT)
Received: from mail-ee0-x22d.google.com (mail-ee0-x22d.google.com [IPv6:2a00:1450:4013:c00::22d]) by ietfa.amsl.com (Postfix) with ESMTP id 9275511E81C4 for <stox@ietf.org>; Tue, 20 Aug 2013 02:14:36 -0700 (PDT)
Received: by mail-ee0-f45.google.com with SMTP id c50so84006eek.4 for <stox@ietf.org>; Tue, 20 Aug 2013 02:14:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:reply-to:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=oL/pjNTxodCc34UMdjHyLNT0N5fQc3BRYCd4JY6E6hA=; b=V1+6iQ0oRthg/SznnuVbgSLh6Fuqrgvql6anzI0++lRxMyb2bSNul6Gw9jnh4Hk7mF w9oZ8gVtX8/OZsodMXwHwQmQs47+hcdyCiTPuoxuPgNOOVvG8Bt5/1/tnQRY4ymm5MK+ US02tblGM0alkkA8SNhu0UFvIjRGfvS7b+ze02yyOxvpFsuYx8n7CwZfFptH9V/ADCvO UxTXm4mVDVxZTc8WRhUgItYvqwzULRXpnMFHN7IyY67mE7qvFHbdrvzyXgP3/BMkq9k9 GQOv1DZ8OJdKeTgyjRfhqL/RS7QTwV0YpEuMCpvBuJFnUdzqCZtRPsgiVc22wqltY+kR 9gtw==
X-Received: by 10.15.52.2 with SMTP id o2mr181119eew.83.1376990073418; Tue, 20 Aug 2013 02:14:33 -0700 (PDT)
Received: from [127.0.0.1] (ns.asipto.com. [213.133.111.169]) by mx.google.com with ESMTPSA id f49sm932916eec.7.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Aug 2013 02:14:32 -0700 (PDT)
Message-ID: <52133376.5060901@gmail.com>
Date: Tue, 20 Aug 2013 11:14:30 +0200
From: Daniel-Constantin Mierla <miconda@gmail.com>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.0
MIME-Version: 1.0
To: "Olle E. Johansson" <oej@edvina.net>
References: <520EDFBB.90503@stpeter.im> <521279E3.7030309@alum.mit.edu> <52127EC5.7060907@stpeter.im> <521291A9.1030503@gmail.com> <5212970D.6070608@stpeter.im> <52132C43.3040102@gmail.com> <A35C463B-B8E7-4ECC-B300-BCDAEDC274C7@edvina.net>
In-Reply-To: <A35C463B-B8E7-4ECC-B300-BCDAEDC274C7@edvina.net>
Content-Type: multipart/alternative; boundary="------------040408030608020305000700"
Cc: stox@ietf.org, Paul Kyzivat <pkyzivat@alum.mit.edu>, Peter Saint-Andre <stpeter@stpeter.im>
Subject: Re: [Stox] core: response code mappings
X-BeenThere: stox@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: miconda@gmail.com
List-Id: SIP-TO-XMPP Working Group discussion list <stox.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/stox>, <mailto:stox-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/stox>
List-Post: <mailto:stox@ietf.org>
List-Help: <mailto:stox-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/stox>, <mailto:stox-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 20 Aug 2013 09:14:38 -0000

On 8/20/13 10:55 AM, Olle E. Johansson wrote:
>
> 20 aug 2013 kl. 10:43 skrev Daniel-Constantin Mierla 
> <miconda@gmail.com <mailto:miconda@gmail.com>>:
>
>>
>> On 8/20/13 12:07 AM, Peter Saint-Andre wrote:
>>> On 8/19/13 3:44 PM, Daniel-Constantin Mierla wrote:
>>>> On 8/19/13 10:23 PM, Peter Saint-Andre wrote:
>>>>> On 8/19/13 2:02 PM, Paul Kyzivat wrote:
>>>>>> On 8/16/13 10:28 PM, Peter Saint-Andre wrote:
>>>>>>> The SIP Parameters Registry has a list of SIP response codes:
>>>>>>>
>>>>>>> http://www.iana.org/assignments/sip-parameters/sip-parameters.xml#sip-parameters-7
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> A number of those are not specified in RFC 3261. Thus the question
>>>>>>> arises: for which codes do we need to define mappings? We could define
>>>>>>> mappings for all of them, but I wonder if that's advisable. Some of the
>>>>>>> additional codes are specified in RFCs that update RFC 3261 (e.g., code
>>>>>>> 440 from RFC 5393), whereas other codes are specified in "non-core"
>>>>>>> RFCs
>>>>>>> that don't update RFC 3261 (e.g., code 470 from RFC 5360). Would it
>>>>>>> perhaps make sense to map the "core" codes and not the "non-core"
>>>>>>> codes?
>>>>>> I know this is almost a non-answer, but...
>>>>>>
>>>>>> The codes that are defined in other RFCs are there to support features
>>>>>> that are introduced in those RFCs. If there is a mapping of that feature
>>>>>> to XMPP, then there should be a mapping of the code.
>>>>> That makes sense.
>>>>>
>>>>>> If there is no mapping of the feature, then mapping the code is less
>>>>>> important, but still perhaps useful in some cases. E.g., it could
>>>>>> conceivably show up in a Reason code based on signaling that was never
>>>>>> gatewayed to xmpp. But maybe a default mapping would be sufficient in
>>>>>> those cases.
>>>>> I suspect that the default mapping would be fine.
>>>>>
>>>>> And in general, there might be more art than science here.
>>>>>
>>>>> I have written some proposed text for this section, but it's fairly long
>>>>> so my inclination is to submit a revised I-D and then folks can review
>>>>> what I've written and post to the list with feedback.
>>>> Looking at the latest draft, it seems to bring confusion on mapping from
>>>> xmpp-to-sip on 400 code. I read this thread and kind of understood that
>>>> any not-obvious-mapping similar-to-a-4xx case would be handled same as
>>>> 400 in SIP, but typically the 400 response is given for a malformed sip
>>>> requests (like broken grammar).
>>> So your suggestion is that we avoid mapping XMPP error conditions to SIP
>>> 400 unless the XMPP condition is caused by a malformed request?
>> Yes, <bad-request/> qualifies for that. Otherwise, could create 
>> confusion for implementers of sip endpoints - from sip rfc:
>> 21.4.1 400 Bad Request
>>
>>
>>    The request could not be understood due to malformed syntax.  The
>>    Reason-Phrase SHOULD identify the syntax problem in more detail, for
>>    example, "Missing Call-ID header field".
>>
>>
>>
>>>> After quick read, <conflict/> would map more suggestively to 403
>>>> Forbidden.
>>> As I said, it's perhaps more art than science. But mapping <conflict/>
>>> to 403 seems reasonable if we accept your suggestion about not mapping
>>> to 400 unless we have a good reason to do so.
>>>
>>>> Maybe <policy-violation> and <undefined-condition/> could get
>>>> other mappings as well.
>>> Well, depending on the policy being violated, <policy-violation/> might
>>> map to 413, 414, 513, or even 406/606.
>>
>> I would find more appropriate 500 than 400 for mapping, also because 
>> these situations are more server related. 500 is the most generic 
>> error code in sip from my point of view -- is used even for SIP 
>> message related situations, such as CSeq value in a request within a 
>> dialog is lower than previous received one.
>>
>> The section in the draft seems to be a global mapping, it is no 
>> difference between types of errors in xmpp -- there can be same error 
>> tag for streams and stanzas. For example <conflict/> for streams says:
>>
>> 4.9.3.3. conflict
>>
>>
>>    The server either (1) is closing the existing stream for this entity
>>    because a new stream has been initiated that conflicts with the
>>    existing stream, or (2) is refusing a new stream for this entity
>>    because allowing the new stream would conflict with an existing
>>    stream (e.g., because the server allows only a certain number of
>>    connections from the same IP address or allows only one server-to-
>>    server stream for a given domain pair as a way of helping to ensure
>>    in-order processing as described under Section 10.1).
>>
>> The second example above can be associated with 'No more channels' in 
>> a SIP media server/gateway -- 500 is used in this case (at least 
>> Asterisk did it :-) ).
>>> Given that <undefined-condition/> is something of a catch-all, it's not
>>> clear to me what we'd map it to in a consistent way. That would probably
>>> depend on the application-specific element contained in the error stanza.
>>>
>> Indeed, could be application/case-to-case specific mapping, but 
>> otherwise I think 500 should be the catch-all case in sip side.
>
> Not really.
>
> 5xx codes indicates mostly server errors, meaning that the request may 
> succeed in another server.
> 6xx and 4xx errors indicate something wrong related to the request, no 
> point in trying elsewhere. RFC 3261:
6xx are indeed global, but many of 4xx can succeed on retry or other 
place (e.g., calling to germany can get 404 on a pstn gateway with no 
route to this country but can succeed on other gateway with such route).

Anyhow, it is what I understand from the xmpp error tags I listed above 
(being currently mapped to 400). For example, number of streams 
(4.9.3.3. conflict) is a server related option, has nothing to do with 
the format of the request or processing the request per se -- it is not 
accepted because local server policy/available resources.


> 21.4 Request Failure 4xx
>
>     4xx responses are definite failure responses from a particular
>     server.  The client SHOULD NOT retry the same request without
>     modification (for example, adding appropriate authorization).
>     However, the same request to a different server might be successful.
>
> 21.5 Server Failure 5xx
>
>     5xx responses are failure responses given when a server itself has
>     erred.
>
>
> I agree that when we have a specific error condition in XMPP we should 
> map it properly to an error code in SIP, but we also need some generic 
> mapping. Like for the Kamailio-specific 4xx  error codes that only 
> Kamailio understands :-)
>
> Section 8.1.3.2 of RFC 3261 clarifies:
>
> 8.1.3.2 Unrecognized Responses
>
>     A UAC MUST treat any final response it does not recognize as being
>     equivalent to the x00 response code of that class, and MUST be able
>     to process the x00 response code for all classes.  For example, if a
>     UAC receives an unrecognized response code of 431, it can safely
>     assume that there was something wrong with its request and treat the
>     response as if it had received a 400 (Bad Request) response code.  A
>     UAC MUST treat any provisional response different than 100 that it
>     does not recognize as 183 (Session Progress).  A UAC MUST be able to
>     process 100 and 183 responses.
>
> It doesn't mean we should use 400,500,600 as generic codes, but treat unknown
> the same way as we treat the even ones. If we receive 679, we should act as if
> we received 600.

I would interpret that in more like generic way:
- unknown >=300 is negative response, closing transaction/dialog
- unknown 4xx or 5xx means a retry could work (at same place or 
different one)
- unknown 6xx means giving up completely

So it might be better to define new 'generic' reply codes for each class 
and let the sip endpoint handle them as stated in rfc (and pasted above).

Daniel

> Does jabber separate "server errors" and "request errors"?
> /O
>
>

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda