Re: [Stox] core: response code mappings

"Olle E. Johansson" <oej@edvina.net> Tue, 20 August 2013 08:55 UTC

Return-Path: <oej@edvina.net>
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 39ED611E80ED for <stox@ietfa.amsl.com>; Tue, 20 Aug 2013 01:55:04 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.989
X-Spam-Level:
X-Spam-Status: No, score=-1.989 tagged_above=-999 required=5 tests=[AWL=-0.261, 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 ZikI6WPYMgWx for <stox@ietfa.amsl.com>; Tue, 20 Aug 2013 01:55:03 -0700 (PDT)
Received: from smtp7.webway.se (smtp7.webway.se [IPv6:2a02:920:212e::205]) by ietfa.amsl.com (Postfix) with ESMTP id 1CB5221F9D4A for <stox@ietf.org>; Tue, 20 Aug 2013 01:55:01 -0700 (PDT)
Received: from [192.168.40.29] (h87-96-134-129.dynamic.se.alltele.net [87.96.134.129]) by smtp7.webway.se (Postfix) with ESMTPA id 35D9793C1AF; Tue, 20 Aug 2013 08:55:01 +0000 (UTC)
Content-Type: multipart/alternative; boundary="Apple-Mail=_BF76114B-5282-417D-AB2E-5573546C0C41"
Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\))
From: "Olle E. Johansson" <oej@edvina.net>
In-Reply-To: <52132C43.3040102@gmail.com>
Date: Tue, 20 Aug 2013 10:55:02 +0200
Message-Id: <A35C463B-B8E7-4ECC-B300-BCDAEDC274C7@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>
To: miconda@gmail.com
X-Mailer: Apple Mail (2.1508)
Cc: stox@ietf.org, "Olle E. Johansson" <oej@edvina.net>, 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
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 08:55:04 -0000

20 aug 2013 kl. 10:43 skrev Daniel-Constantin Mierla <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:
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. 

Does jabber separate "server errors" and "request errors"?

/O