idnits 2.17.1 draft-ietf-stox-core-09.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (December 19, 2013) is 3780 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 6122 (Obsoleted by RFC 7622) -- Possible downref: Non-RFC (?) normative reference: ref. 'UNICODE' == Outdated reference: A later version (-04) exists of draft-ietf-straw-b2bua-loop-detection-03 -- Obsolete informational reference (is this intentional?): RFC 3454 (Obsoleted by RFC 7564) == Outdated reference: A later version (-24) exists of draft-ietf-xmpp-6122bis-09 Summary: 2 errors (**), 0 flaws (~~), 3 warnings (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group P. Saint-Andre 3 Internet-Draft Cisco Systems, Inc. 4 Intended status: Standards Track A. Houri 5 Expires: June 22, 2014 IBM 6 J. Hildebrand 7 Cisco Systems, Inc. 8 December 19, 2013 10 Interworking between the Session Initiation Protocol (SIP) and the 11 Extensible Messaging and Presence Protocol (XMPP): Architecture, 12 Addresses, and Error Handling 13 draft-ietf-stox-core-09 15 Abstract 17 As a foundation for the definition of bidirectional protocol mappings 18 between the Session Initiation Protocol (SIP) and the Extensible 19 Messaging and Presence Protocol (XMPP), this document specifies the 20 architectural assumptions underlying such mappings as well as the 21 mapping of addresses and error conditions. 23 Status of this Memo 25 This Internet-Draft is submitted in full conformance with the 26 provisions of BCP 78 and BCP 79. 28 Internet-Drafts are working documents of the Internet Engineering 29 Task Force (IETF). Note that other groups may also distribute 30 working documents as Internet-Drafts. The list of current Internet- 31 Drafts is at http://datatracker.ietf.org/drafts/current/. 33 Internet-Drafts are draft documents valid for a maximum of six months 34 and may be updated, replaced, or obsoleted by other documents at any 35 time. It is inappropriate to use Internet-Drafts as reference 36 material or to cite them other than as "work in progress." 38 This Internet-Draft will expire on June 22, 2014. 40 Copyright Notice 42 Copyright (c) 2013 IETF Trust and the persons identified as the 43 document authors. All rights reserved. 45 This document is subject to BCP 78 and the IETF Trust's Legal 46 Provisions Relating to IETF Documents 47 (http://trustee.ietf.org/license-info) in effect on the date of 48 publication of this document. Please review these documents 49 carefully, as they describe your rights and restrictions with respect 50 to this document. Code Components extracted from this document must 51 include Simplified BSD License text as described in Section 4.e of 52 the Trust Legal Provisions and are provided without warranty as 53 described in the Simplified BSD License. 55 Table of Contents 57 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 58 2. Intended Audience . . . . . . . . . . . . . . . . . . . . . . 3 59 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 60 4. Architectural Assumptions . . . . . . . . . . . . . . . . . . 4 61 5. Interdomain Federation . . . . . . . . . . . . . . . . . . . . 5 62 6. Address Mapping . . . . . . . . . . . . . . . . . . . . . . . 6 63 6.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . 6 64 6.2. Local Part Mapping . . . . . . . . . . . . . . . . . . . . 7 65 6.3. Instance-Specific Mapping . . . . . . . . . . . . . . . . 9 66 6.4. SIP to XMPP . . . . . . . . . . . . . . . . . . . . . . . 9 67 6.5. XMPP to SIP . . . . . . . . . . . . . . . . . . . . . . . 10 68 7. Error Mapping . . . . . . . . . . . . . . . . . . . . . . . . 11 69 7.1. XMPP to SIP . . . . . . . . . . . . . . . . . . . . . . . 13 70 7.2. SIP to XMPP . . . . . . . . . . . . . . . . . . . . . . . 14 71 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 72 9. Security Considerations . . . . . . . . . . . . . . . . . . . 16 73 10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 17 74 10.1. Normative References . . . . . . . . . . . . . . . . . . . 17 75 10.2. Informative References . . . . . . . . . . . . . . . . . . 18 76 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 19 77 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 19 79 1. Introduction 81 The IETF has worked on two signalling technologies that can be used 82 for multimedia session negotiation, messaging, presence, capabilities 83 discovery, notifications, and other application-level functionality: 85 o The Session Initiation Protocol [RFC3261], along with various SIP 86 extensions developed within the SIP for Instant Messaging and 87 Presence Leveraging Extensions (SIMPLE) Working Group. 88 o The Extensible Messaging and Presence Protocol [RFC6120], along 89 with various XMPP extensions developed by the IETF as well as by 90 the XMPP Standards Foundation (XSF). 92 Because these technologies are widely deployed, it is important to 93 clearly define mappings between them for the sake of interworking. 94 This document provides the basis for a series of SIP-XMPP 95 interworking specifications by defining architectural assumptions, 96 address translation methods, and error condition mappings. Other 97 documents in this series define mappings for presence, messaging, and 98 media sessions. 100 The guidelines in this series are based on implementation and 101 deployment experience, and describe techniques that have worked well 102 in the field with existing systems. In practice, interworking has 103 been achieved through direct protocol mappings, not through mapping 104 to an abstract model as described in, for example, [RFC3859] and 105 [RFC3860]. Therefore this series describes the direct mapping 106 approach in enough detail for developers of new implementations to 107 achieve practical interworking between SIP systems and XMPP systems. 109 2. Intended Audience 111 The documents in this series are intended for use by software 112 developers who have an existing system based on one of these 113 technologies (e.g., SIP), and would like to enable communication from 114 that existing system to systems based on the other technology (e.g., 115 XMPP). With regard to this document we assume that readers are 116 familiar with the core specifications for both SIP and XMPP, and with 117 regard to the other documents in this series we assume that readers 118 are familiar with the relevant SIP and XMPP extensions. 120 3. Terminology 122 A number of terms used here are explained in [RFC3261] and [RFC6120]. 124 Several examples use the "XML Notation" from the IRI specification 126 [RFC3987] to represent Unicode characters outside the ASCII range 127 (e.g., the string "ue" stands for the Unicode character LATIN SMALL 128 LETTER U WITH DIAERESIS, U+00FC). 130 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 131 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 132 "OPTIONAL" in this document are to be interpreted as described in 133 [RFC2119]. 135 4. Architectural Assumptions 137 Protocol translation between SIP and XMPP could occur in a number of 138 different entities, depending on the architecture of real-time 139 communication deployments. For example, protocol translation could 140 occur within a multi-protocol server (which uses protocol-specific 141 connection managers to initiate traffic to and accept traffic from 142 clients or other servers natively using SIP/SIMPLE, XMPP, etc.), 143 within a multi-protocol client (which enables a user to establish 144 connections natively with various servers using SIP/SIMPLE, XMPP, 145 etc.), or within a gateway that acts as a dedicated protocol 146 translator (which takes one protocol as input and provides another 147 protocol as output). 149 This document assumes that the protocol translation will occur within 150 a gateway, specifically: 152 o When information needs to flow from an XMPP-based system to a SIP- 153 based system, protocol translation will occur within an "XMPP-to- 154 SIP gateway" that translates XMPP syntax and semantics on behalf 155 of an "XMPP server" (together, these two logical functions 156 comprise an "XMPP service"). 157 o When information needs to flow from a SIP-based system to an XMP- 158 based system, protocol translation will occur within a "SIP-to- 159 XMPP gateway" that translates SIP syntax and semantics on behalf 160 of a "SIP server" (together, these two logical functions comprise 161 a "SIP service"). 163 Naturally, these logical functions could occur in one and the same 164 actual entity; we differentiate between them mainly for explanatory 165 purposes (although, in practice, such gateways are indeed fairly 166 common). 168 Note: This assumption is not meant to discourage protocol 169 translation within multi-protocol clients or servers; instead, 170 this assumption is followed mainly to clarify the discussion and 171 examples so that the protocol translation principles can be more 172 easily understood and can be applied by client and server 173 implementors with appropriate modifications to the examples and 174 terminology. 176 This document assumes that a gateway will translate directly from one 177 protocol to the other. For the sake of the examples, we further 178 assume that protocol translation will occur within a gateway in the 179 source domain, so that information generated by the user of an XMPP 180 system will be translated by a gateway within the trust domain of 181 that XMPP system, and information generated by the user of a SIP 182 system will be translated by a gateway within the trust domain of 183 that SIP system. However, nothing in this document ought to be taken 184 as recommending against protocol translation at the destination 185 domain. 187 An architectural diagram for a possible gateway deployment is shown 188 below, where the entities have the following significance and the "#" 189 character is used to show the boundary of a trust domain: 191 o romeo@example.net -- a SIP user. 192 o example.net -- a SIP server with an associated gateway ("S2X GW") 193 to XMPP. 194 o juliet@example.com -- an XMPP user. 195 o example.com -- an XMPP server with an associated gateway ("X2S 196 GW") to SIP. 198 ##@###################################################### 199 # : # 200 # +-----+ : # 201 # | S2X | : # 202 # +-------------+ GW |---:-------->+-------------+ # 203 # | SIP Server +-----+ : | XMPP Server | # 204 # | example.net | : +-----+ example.com | # 205 # +-------------+<--------:---| X2S +-------------+ # 206 # | : | GW | | # 207 # | : +-----+ | # 208 # | : | # 209 # romeo@example.net : juliet@example.com # 210 # : # 211 ######################################################### 213 5. Interdomain Federation 215 The architecture assumptions underlying this document imply that 216 communication between a SIP system and an XMPP system will take place 217 using interdomain federation: the SIP server invokes its associated 218 SIP-to-XMPP gateway, which communicates with the XMPP server using 219 native XMPP server-to-server methods; similarly, the XMPP server 220 invokes its associated XMPP-to-SIP gateway, which communicates with 221 the SIP server using native SIP server-to-server methods. 223 When an XMPP server receives an XMPP stanza whose 'to' address 224 specifies or includes a domain other than the domain of the XMPP 225 server, it needs to determine whether the destination domain 226 communicates via XMPP or SIP. To do so, it performs one or more DNS 227 SRV lookups [RFC2782] for "_xmpp-server" records as specified in 228 [RFC6120]. If the response returns a hostname, the XMPP server can 229 attempt XMPP communication. If not, it can determine the appropriate 230 location for SIP communication at the target domain using the 231 procedures specified in [RFC3263]. 233 Similarly, when a SIP server receives a SIP message whose Request-URI 234 specifies or includes a domain other than the domain of the SIP 235 server, it needs to determine whether the destination domain 236 communicates via SIP or XMPP. To do so, it uses the procedures 237 specified in [RFC3263]. If that response returns a hostname, the SIP 238 server can attempt SIP communication. If not, it can perform one or 239 more DNS SRV lookups [RFC2782] for "_xmpp-server" records as 240 specified in [RFC6120]. 242 In both cases, the server in question might have previously 243 determined that the foreign domain communicates via SIP or XMPP, in 244 which case it would not need to perform the relevant DNS lookups. 245 The caching of such information is a matter of implementation and 246 local service policy, and is therefore out of scope for this 247 document. 249 Because [RFC6120] specifies a binding of XMPP to TCP, a gateway from 250 SIP to XMPP will need to support TCP as the underlying transport 251 protocol. By contrast, as specified in [RFC3261], either TCP or UDP 252 can be used as the underlying transport for SIP messages, and a given 253 SIP deployment might support only UDP; therefore, a gateway from XMPP 254 to SIP might need to communicate with a SIP server using either TCP 255 or UDP. 257 6. Address Mapping 259 6.1. Overview 261 The basic SIP address format is a 'sip' or 'sips' URI as specified in 262 [RFC3261]. When a SIP entity supports extensions for instant 263 messaging it might be identified by an 'im' URI as specified in the 264 Common Profile for Instant Messaging [RFC3860] (see [RFC3428]) and 265 when a SIP entity supports extensions for presence it might be 266 identified by a 'pres' URI as specified in the Common Profile for 267 Presence [RFC3859] (see [RFC3856]). SIP entities typically also 268 support the 'tel' URI scheme [RFC3966] and might support other URI 269 schemes as well. 271 The XMPP address format is specified in [RFC6122] (although note that 272 XMPP URIs [RFC5122] are not used natively on the XMPP network); in 273 addition, [RFC6121] encourages instant messaging and presence 274 applications of XMPP to also support 'im' and 'pres' URIs as 275 specified in [RFC3860] and [RFC3859] respectively, although such 276 support might simply involve leaving resolution of such addresses up 277 to an XMPP server. 279 In this document we primarily describe mappings for addresses of the 280 form ; however, we also provide guidelines for mapping 281 the addresses of specific user agent instances, which take the form 282 of Globally Routable User Agent URIs (GRUUs) in SIP and 283 "resourceparts" in XMPP. Mapping of protocol-specific identifiers 284 (such as telephone numbers) is out of scope for this specification. 285 In addition, we have ruled the mapping of domain names as out of 286 scope for now since that is a matter for the Domain Name System; 287 specifically, the issue for interworking between SIP and XMPP relates 288 to the translation of fully internationalized domain names (IDNs) 289 into non-internationalized domain names (IDNs are not allowed in the 290 SIP address format, but are allowed in the XMPP address via 291 Internationalized Domain Names in Applications, see [RFC6122] and 292 [I-D.ietf-xmpp-6122bis]). Therefore, in the following sections we 293 focus primarily on the local part of an address (these are called 294 variously "usernames", "instant inboxes", "presentities", and 295 "localparts" in the protocols at issue), secondarily on the instance- 296 specific part of an address, and not at all on the domain-name part 297 of an address. 299 The sip:/sips:, im:/pres:, and XMPP address schemes allow different 300 sets of characters (although all three allow alphanumeric characters 301 and disallow both spaces and control characters). In some cases, 302 characters allowed in one scheme are disallowed in others; these 303 characters need to be mapped appropriately in order to ensure 304 interworking across systems. 306 6.2. Local Part Mapping 308 The local part of a sip:/sips: URI inherits from the "userinfo" rule 309 in [RFC3986] with several changes; here we discuss the SIP "user" 310 rule only: 312 user = 1*( unreserved / escaped / user-unreserved ) 313 user-unreserved = "&" / "=" / "+" / "$" / "," / ";" / "?" / "/" 314 unreserved = alphanum / mark 315 mark = "-" / "_" / "." / "!" / "~" / "*" / "'" 316 / "(" / ")" 318 Here we make the simplifying assumption that the local part of an 319 im:/pres: URI inherits from the "dot-atom-text" rule in [RFC5322] 320 rather than the more complicated "local-part" rule: 322 dot-atom-text = 1*atext *("." 1*atext) 323 atext = ALPHA / DIGIT / ; Any character except 324 "!" / "#" / "$" / ; controls, SP, and 325 "%" / "&" / "'" / ; specials. Used for 326 "*" / "+" / "-" / ; atoms. 327 "/" / "=" / "?" / 328 "^" / "_" / "`" / 329 "{" / "|" / "}" / 330 "~" 332 The local part of an XMPP address allows any ASCII character except 333 space, controls, and the " & ' / : < > @ characters. 335 To summarize the foregoing information, the following table lists the 336 allowed and disallowed characters in the local part of identifiers 337 for each protocol (aside from the alphanumeric, space, and control 338 characters), in order by hexadecimal character number (where each "A" 339 row shows the allowed characters and each "D" row shows the 340 disallowed characters). 342 Table 1: Allowed and disallowed characters 344 +---+----------------------------------+ 345 | SIP/SIPS CHARACTERS | 346 +---+----------------------------------+ 347 | A | ! $ &'()*+,-./ ; = ? _ ~ | 348 | D | "# % : < > @[\]^ `{|} | 349 +---+----------------------------------+ 350 | IM/PRES CHARACTERS | 351 +---+----------------------------------+ 352 | A | ! #$%&' *+ - / = ? ^_`{|}~ | 353 | D | " () , . :;< > @[\] | 354 +---+----------------------------------+ 355 | XMPP CHARACTERS | 356 +---+----------------------------------+ 357 | A | ! #$% ()*+,-. ; = ? [\]^_`{|}~ | 358 | D | " &' /: < > @ | 359 +---+----------------------------------+ 360 When transforming the local part of an address from one scheme to 361 another, an application SHOULD proceed as follows: 363 1. Unescape any escaped characters in the source address (e.g., from 364 SIP to XMPP unescape "%23" to "#" per [RFC3986] and from XMPP to 365 SIP unescape "\27" to "'" per [XEP-0106]). 366 2. Leave unmodified any characters that are allowed in the 367 destination scheme. 368 3. Escape any characters that are allowed in the source scheme but 369 reserved in the destination scheme, as escaping is defined for 370 the destination scheme. In particular: 371 * Where the destination scheme is a URI (i.e., an im:, pres:, 372 sip:, or sips: URI), each reserved character MUST be percent- 373 encoded to "%hexhex" as specified in Section 2.5 of [RFC3986] 374 (e.g., when transforming from XMPP to SIP, encode "#" as 375 "%23"). 376 * Where the destination scheme is a native XMPP address, each 377 reserved character MUST be encoded to "\hexhex" as specified 378 in [XEP-0106] (e.g., when transforming from SIP to XMPP, 379 encode "'" as "\27"). 381 6.3. Instance-Specific Mapping 383 The meaning of a resourcepart in XMPP (i.e., the portion of a JID 384 after the slash character, such as "foo" in "user@example.com/foo") 385 matches that of a Globally Routable User Agent URI (GRUU) in SIP 386 [RFC5627]. In both cases, these constructs identify a particular 387 device associated with the bare JID ("localpart@domainpart") of an 388 XMPP entity or with the Address of Record (AOR) of a SIP entity. 389 Therefore, it is reasonable to map the value of a "gr" URI parameter 390 to an XMPP resourcepart, and vice-versa. 392 The mapping described here does not apply to temporary GRUUs, only to 393 GRUUs associated with an Address of Record. 395 The "gr" URI parameter in SIP can contain only characters from the 396 ASCII range (although characters outside the ASCII range can be 397 percent-encoded in accordance with [RFC3986]), whereas an XMPP 398 resourcepart can contain nearly any Unicode character [UNICODE]. 399 Therefore Unicode characters outside the ASCII range need to be 400 mapped to characters in the ASCII range, as described below. 402 6.4. SIP to XMPP 404 The following is a high-level algorithm for mapping a sip:, sips:, 405 im:, or pres: URI to an XMPP address: 407 1. Remove URI scheme. 408 2. Split at the first '@' character into local part and hostname 409 (mapping the latter is out of scope). 410 3. Translate any percent-encoded strings ("%hexhex") to percent- 411 decoded octets. 412 4. Treat result as a UTF-8 string. 413 5. Translate "&" to "\26", "'" to "\27", and "/" to "\2f" 414 respectively in order to properly handle the characters 415 disallowed in XMPP addresses but allowed in sip:/sips: URIs and 416 im:/pres: URIs as shown in Table 1 above (this is consistent with 417 [XEP-0106]). 418 6. Apply Nodeprep profile of Stringprep [RFC3454] or its replacement 419 (see [RFC6122] and [I-D.ietf-xmpp-6122bis]) for canonicalization 420 (OPTIONAL). 421 7. Recombine local part with mapped hostname to form a bare JID 422 ("localpart@domainpart"). 423 8. If the (SIP) address contained a "gr" URI parameter, append a 424 slash character "/" and the "gr" value to the bare JID to form a 425 full JID ("localpart@domainpart/resourcepart"). 427 Several examples follow, illustrating steps 3, 5, and 8 described 428 above. 430 +----------------------------+--------------------------+ 431 | SIP URI | XMPP Address | 432 +----------------------------+--------------------------+ 433 | sip:f%C3%BC@sip.example | fü@sip.example | 434 | sip:o'malley@sip.example | o\27malley@sip.example | 435 | sip:foo@sip.example;gr=bar | foo@sip.example/bar | 436 +----------------------------+--------------------------+ 438 In the first example the string "%C3%BC" is a percent-encoded 439 representation of the UTF-8-encoded Unicode character LATIN SMALL 440 LETTER U WITH DIAERESIS (U+00FC), whereas the string "ü" is the 441 same character shown for documentation purposes using the XML 442 Notation defined in [RFC3987] (in XMPP it would be sent directly as a 443 UTF-8-encoded Unicode character and not percent-encoded as in a SIP 444 URI to comply with the URI syntax defined in [RFC3986]). 446 6.5. XMPP to SIP 448 The following is a high-level algorithm for mapping an XMPP address 449 to a sip:, sips:, im:, or pres: URI: 451 1. Split XMPP address into localpart (mapping described in remaining 452 steps), domainpart (hostname; mapping is out of scope), and 453 resourcepart (specifier for particular device or connection, for 454 which an OPTIONAL mapping is described below). 456 2. Apply Nodeprep profile of [RFC3454] or its replacement (see 457 [RFC6122] and [I-D.ietf-xmpp-6122bis]) for canonicalization of 458 the XMPP localpart (OPTIONAL). 459 3. Translate "\26" to "&", "\27" to "'", and "\2f" to "/" 460 respectively (this is consistent with [XEP-0106]). 461 4. Determine if the foreign domain supports im: and pres: URIs 462 (discovered via [RFC2782] lookup as specified in [RFC6121]), else 463 assume that the foreign domain supports sip:/sips: URIs. 464 5. If converting into im: or pres: URI, for each byte, if the byte 465 is in the set (),.;[\] or is a UTF-8 character outside the ASCII 466 range then percent-encode that byte to "%hexhex" format. If 467 converting into sip: or sips: URI, for each byte, if the byte is 468 in the set #%[\]^`{|} or is a UTF-8 character outside the ASCII 469 range then percent-encode that byte to "%hexhex" format. 470 6. Combine resulting local part with mapped hostname to form 471 local@domain address. 472 7. Prepend with 'im:' scheme (for XMPP stanzas) or 473 'pres:' scheme (for XMPP stanzas) if foreign domain 474 supports these, else prepend with 'sip:' or 'sips:' scheme 475 according to local service policy. 476 8. If the XMPP address included a resourcepart and the destination 477 URI scheme is 'sip:' or 'sips:', optionally append the slash 478 character '/' and then append the resourcepart (making sure to 479 percent-encode any UTF-8 characters outside the ASCII range) as 480 the "gr" URI parameter. 482 Several examples follow, illustrating steps 3, 5, and 8 described 483 above. 485 +---------------------------+---------------------------------+ 486 | XMPP Address | SIP URI | 487 +---------------------------+---------------------------------+ 488 | m\26m@xmpp.example | sip:m&m@xmpp.example | 489 | tschüss@xmpp.example | sip:tsch%C3%BCss@xmpp.example | 490 | baz@xmpp.example/qux | sip:baz@xmpp.example;gr=qux | 491 +---------------------------+---------------------------------+ 493 As above, in the first example the string "ü" is the Unicode 494 character LATIN SMALL LETTER U WITH DIAERESIS (U+00FC) shown for 495 documentation purposes using the XML Notation defined in [RFC3987] 496 (in XMPP it would be sent directly as a UTF-8-encoded Unicode 497 character and not percent-encoded, whereas the string "%C3%BC" is a 498 percent-encoded representation of the of the same character. 500 7. Error Mapping 502 Various differences between XMPP error conditions and SIP response 503 codes make it hard to provide a comprehensive and consistent mapping 504 between the protocols: 506 o Whereas the set of XMPP error conditions is fixed in the core XMPP 507 specification (and supplemented where needed by application- 508 specific extensions), the set of SIP response codes is more open 509 to change, as evidenced by the IANA registry of SIP response 510 codes. 511 o XMPP has defined fewer error conditions related to stanza handling 512 (22 are defined in [RFC6120]) than SIP has defined response codes 513 related to message handling (at the date of this writing, 71 SIP 514 response codes are registered with IANA as defined in [RFC3261] 515 and numerous SIP extensions). 516 o In many cases, the SIP response codes are more specific than the 517 XMPP error conditions (e.g., from an XMPP perspective the SIP 518 codes "413 Request Entity Too Large" and "414 Request-URI Too 519 Long" are just two forms of a bad request, and the SIP codes "415 520 Unsupported Media Type" and "416 Unsupported URI Scheme" are just 521 two forms of a request that is not acceptable). 522 o SIP differentiates between responses about a particular endpoint 523 or resource (the 4xx series) and responses about a user, i.e., all 524 of a user's endpoints or resources (the 6xx series). There is no 525 such distinction in XMPP, since the same error condition can be 526 returned in relation to the "bare JID" (localpart@domainpart) of a 527 user or the "full JID" (localpart@domainpart/resourcepart) of a 528 particular endpoint or resource, depending on the 'to' address of 529 the original request. 531 As a result of these and other factors, the mapping of error 532 conditions and response codes is more of an art than a science. This 533 document provides suggested mappings, but implementations are free to 534 deviate from these mappings if needed. Also, because no XMPP error 535 conditions are equivalent to the provisional (1xx) and successful 536 (2xx) response codes in SIP, this document suggests mappings only for 537 the SIP redirection (3xx), request failure (4xx), server failure 538 (5xx), and global failure (6xx) response code families. 540 Supplementary information about SIP response codes can be expressed 541 in the "Reason-Phrase" in the Status-Line header, and detailed 542 information about XMPP error conditions can be expressed in the 543 child of the element. Although the semantics of 544 these constructs are specified in a slightly different way, it is 545 reasonable for a gateway to map these constructs to each other if 546 they are found in a SIP response or XMPP error stanza. 548 7.1. XMPP to SIP 550 The mapping of specific XMPP error conditions to SIP response codes 551 SHOULD be as described in the following table. 553 Table 2: Mapping of XMPP error conditions to SIP response codes 555 +------------------------------+---------------------+ 556 | XMPP Error Condition | SIP Response Code | 557 +------------------------------+---------------------+ 558 | | 400 | 559 | | 400 | 560 | | 405 or 501 (1) | 561 | | 403 or 603 (2) | 562 | | 301 or 410 (3) | 563 | | 500 | 564 | | 404 or 604 (2) | 565 | | 400 | 566 | | 406 or 606 (2) | 567 | | 403 | 568 | | 401 | 569 | | 403 | 570 | | 480 or 600 (2) | 571 | | 302 | 572 | | 407 | 573 | | 404 or 408 (4) | 574 | | 408 | 575 | | 500 | 576 | | see note (5) below | 577 | | 400 | 578 | | 400 | 579 | | 491 or 400 | 580 +------------------------------+---------------------+ 582 1. If the error relates to a "full JID" 583 (localpart@domainpart/resourcepart), the SIP 405 response code is 584 RECOMMENDED. If the error relates to a "bare JID" 585 (localpart@domainpart), the SIP 501 response code is RECOMMENDED. 586 2. If the error relates to a "full JID" 587 (localpart@domainpart/resourcepart), the SIP response code from 588 the 4xx series is RECOMMENDED. If the error relates to a "bare 589 JID" (localpart@domainpart), the SIP response code from the 6xx 590 series is RECOMMENDED. 591 3. If the element includes XML character data specifying the 592 new address, the error MUST be mapped to SIP 301; if not, it MUST 593 be mapped to SIP 410. 595 4. The XMPP error can mean either that 596 the remote server (a) does not exist or (b) cannot be resolved. 597 SIP has two different response codes here, 404 to cover (a) and 598 408 to cover (b). 599 5. The XMPP error condition is widely used to 600 inform the requesting entity that the intended recipient does not 601 support the relevant feature, to signal that a server cannot 602 perform the requested service either generally or in relation to 603 a particular user, and to avoid disclosing whether a given 604 account exists at all. This is quite different from the 605 semantics of the SIP 503 Service Unavailable response code, which 606 is used to signal that communication with a server is impossible 607 (e.g., even if the XMPP error condition is 608 returned in relation to a specific user, the SIP 503 response 609 code will be interpreted as applying to all future requests to 610 this server, not just requests for the specific user). 611 Therefore, mapping the XMPP error 612 condition to the SIP 503 Service Unavailable response code is NOT 613 RECOMMENDED. Although no precise mapping is available, the SIP 614 403 Forbidden and 405 Method Not Allowed response codes are 615 closest in meaning to the XMPP error 616 condition. 618 7.2. SIP to XMPP 620 The mapping of SIP response codes to XMPP error conditions SHOULD be 621 as described in the following table. If a gateway encounters a SIP 622 response code that is not listed below, it SHOULD map a 3xx-series 623 code to , a 4xx-series code to , a 5xx- 624 series code to , and a 6xx-series code to 625 . 627 Table 3: Mapping of SIP response codes to XMPP error conditions 629 +---------------------+---------------------------------+ 630 | SIP Response Code | XMPP Error Condition | 631 +---------------------+---------------------------------+ 632 | 3xx | | 633 | 300 | | 634 | 301 | (1) | 635 | 302 | | 636 | 305 | | 637 | 380 | | 638 | 4xx | | 639 | 400 | | 640 | 401 | | 641 | 402 | (2) | 642 | 403 | (3) | 643 | 404 | (4) | 644 | 405 | | 645 | 406 | | 646 | 407 | | 647 | 408 | (5) | 648 | 410 | (1) | 649 | 413 | | 650 | 414 | | 651 | 415 | | 652 | 416 | | 653 | 420 | | 654 | 421 | | 655 | 423 | | 656 | 430 | (6) | 657 | 439 | (6) | 658 | 440 | (7) | 659 | 480 | | 660 | 481 | | 661 | 482 | | 662 | 483 | | 663 | 484 | | 664 | 485 | | 665 | 486 | | 666 | 487 | | 667 | 488 | | 668 | 489 | (8) | 669 | 491 | | 670 | 493 | | 671 | 5xx | | 672 | 500 | | 673 | 501 | | 674 | 502 | | 675 | 503 | (9) | 676 | 504 | | 677 | 505 | | 678 | 513 | | 679 | 6xx | | 680 | 600 | | 681 | 603 | | 682 | 604 | | 683 | 606 | | 684 +---------------------+---------------------------------+ 686 1. When mapping SIP 310 to XMPP , the element MUST 687 include XML character data specifying the new address. When 688 mapping SIP 410 to XMPP , the element MUST NOT 689 include XML character data specifying a new address. 691 2. The XMPP error condition was removed in 692 [RFC6120]. Therefore, a mapping to XMPP . 693 3. Depending on the scenario, other possible translations for SIP 694 403 are and . 695 4. Depending on the scenario, another possible translation for SIP 696 404 is . 697 5. Depending on the scenario, another possible translation for SIP 698 408 is . 699 6. Codes 430 and 439 are defined in [RFC5626]. 700 7. Code 440 is defined in [RFC5393]. 701 8. Code 489 is defined in [RFC6665]. 702 9. Regarding the semantic mismatch between XMPP and SIP code 503, see note under Section 6.1 of 704 this document. 706 8. IANA Considerations 708 This document makes no requests of IANA. 710 9. Security Considerations 712 Detailed security considerations for SIP are given in [RFC3261] and 713 for XMPP in [RFC6120]. 715 As specified in Section 26.4.4 of [RFC3261] and updated by [RFC5630], 716 a To header or a Request-URI containing a SIPS URI is used to 717 indicate that all hops in a communication path need to be protected 718 using Transport Layer Security [RFC5246]. Because XMPP lacks a way 719 to signal that all hops need to be encrypted, if the To header or 720 Request-URI of a SIP message is a SIPS URI then the SIP-to-XMPP 721 gateway MUST NOT translate the SIP message into an XMPP stanza and 722 MUST NOT route it to the destination XMPP server. 724 A gateway between SIP and XMPP (in either direction) effectively acts 725 as a SIP back-to-back user agent ("B2BUA"). The amplification 726 vulnerability described in [RFC5393] can manifest itself with B2BUAs 727 (see also [I-D.ietf-straw-b2bua-loop-detection]), and a gateway 728 SHOULD implement the loop-detection methods defined in that 729 specification to help mitigate the possibility of amplification 730 attacks. Note that, although it would be possible to signal the Max- 731 Forwards and Max-Breadth SIP headers over XMPP using the Stanza 732 Headers and Internet Metadata (SHIM) extension [XEP-0131], that 733 extension is not widely implemented; therefore, defenses against 734 excessive looping and amplification attacks when messages pass back 735 and forth through SIP and XMPP networks is out of scope for this 736 document. However, it ought to be addressed in the future, and 737 implementations are strongly encouraged to incorporate appropriate 738 counter measures wherever possible. 740 10. References 742 10.1. Normative References 744 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 745 Requirement Levels", BCP 14, RFC 2119, March 1997. 747 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 748 A., Peterson, J., Sparks, R., Handley, M., and E. 749 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 750 June 2002. 752 [RFC3263] Rosenberg, J. and H. Schulzrinne, "Session Initiation 753 Protocol (SIP): Locating SIP Servers", RFC 3263, 754 June 2002. 756 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 757 Resource Identifier (URI): Generic Syntax", STD 66, 758 RFC 3986, January 2005. 760 [RFC3987] Duerst, M. and M. Suignard, "Internationalized Resource 761 Identifiers (IRIs)", RFC 3987, January 2005. 763 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 764 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 766 [RFC5393] Sparks, R., Lawrence, S., Hawrylyshen, A., and B. Campen, 767 "Addressing an Amplification Vulnerability in Session 768 Initiation Protocol (SIP) Forking Proxies", RFC 5393, 769 December 2008. 771 [RFC5627] Rosenberg, J., "Obtaining and Using Globally Routable User 772 Agent URIs (GRUUs) in the Session Initiation Protocol 773 (SIP)", RFC 5627, October 2009. 775 [RFC5630] Audet, F., "The Use of the SIPS URI Scheme in the Session 776 Initiation Protocol (SIP)", RFC 5630, October 2009. 778 [RFC6120] Saint-Andre, P., "Extensible Messaging and Presence 779 Protocol (XMPP): Core", RFC 6120, March 2011. 781 [RFC6122] Saint-Andre, P., "Extensible Messaging and Presence 782 Protocol (XMPP): Address Format", RFC 6122, March 2011. 784 [UNICODE] The Unicode Consortium, "The Unicode Standard, Version 785 6.2", 2012, 786 . 788 10.2. Informative References 790 [I-D.ietf-straw-b2bua-loop-detection] 791 Kaplan, H. and V. Pascual, "Loop Detection Mechanisms for 792 Session Initiation Protocol (SIP) Back-to- Back User 793 Agents (B2BUAs)", draft-ietf-straw-b2bua-loop-detection-03 794 (work in progress), December 2013. 796 [RFC2782] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for 797 specifying the location of services (DNS SRV)", RFC 2782, 798 February 2000. 800 [RFC3428] Campbell, B., Rosenberg, J., Schulzrinne, H., Huitema, C., 801 and D. Gurle, "Session Initiation Protocol (SIP) Extension 802 for Instant Messaging", RFC 3428, December 2002. 804 [RFC3454] Hoffman, P. and M. Blanchet, "Preparation of 805 Internationalized Strings ("STRINGPREP")", RFC 3454, 806 December 2002. 808 [RFC3856] Rosenberg, J., "A Presence Event Package for the Session 809 Initiation Protocol (SIP)", RFC 3856, August 2004. 811 [RFC3859] Peterson, J., "Common Profile for Presence (CPP)", 812 RFC 3859, August 2004. 814 [RFC3860] Peterson, J., "Common Profile for Instant Messaging 815 (CPIM)", RFC 3860, August 2004. 817 [RFC3966] Schulzrinne, H., "The tel URI for Telephone Numbers", 818 RFC 3966, December 2004. 820 [RFC5122] Saint-Andre, P., "Internationalized Resource Identifiers 821 (IRIs) and Uniform Resource Identifiers (URIs) for the 822 Extensible Messaging and Presence Protocol (XMPP)", 823 RFC 5122, February 2008. 825 [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, 826 October 2008. 828 [RFC5626] Jennings, C., Mahy, R., and F. Audet, "Managing Client- 829 Initiated Connections in the Session Initiation Protocol 830 (SIP)", RFC 5626, October 2009. 832 [RFC6121] Saint-Andre, P., "Extensible Messaging and Presence 833 Protocol (XMPP): Instant Messaging and Presence", 834 RFC 6121, March 2011. 836 [RFC6665] Roach, A., "SIP-Specific Event Notification", RFC 6665, 837 July 2012. 839 [I-D.ietf-xmpp-6122bis] 840 Saint-Andre, P., "Extensible Messaging and Presence 841 Protocol (XMPP): Address Format", 842 draft-ietf-xmpp-6122bis-09 (work in progress), 843 November 2013. 845 [XEP-0106] 846 Saint-Andre, P. and J. Hildebrand, "JID Escaping", XSF 847 XEP 0106, June 2007. 849 [XEP-0131] 850 Saint-Andre, P. and J. Hildebrand, "Stanza Headers and 851 Internet Metadata", XSF XEP 0131, July 2006. 853 Appendix A. Acknowledgements 855 The authors wish to thank the following individuals for their 856 feedback: Mary Barnes, Dave Cridland, Mike De Vries, Fabio Forno, 857 Adrian Georgescu, Philipp Hancke, Saul Ibarra Corretge, Markus 858 Isomaki, Olle Johansson, Paul Kyzivat, Salvatore Loreto, Daniel- 859 Constantin Mierla, Tory Patnoe, and Robert Sparks. 861 Dan Romascanu reviewed the document on behalf of the General Area 862 Review Team. 864 The authors gratefully acknowledge the assistance of Markus Isomaki 865 and Yana Stamcheva as the working group chairs and Gonzalo Camarillo 866 as the sponsoring Area Director. 868 Authors' Addresses 870 Peter Saint-Andre 871 Cisco Systems, Inc. 872 1899 Wynkoop Street, Suite 600 873 Denver, CO 80202 874 USA 876 Phone: +1-303-308-3282 877 Email: psaintan@cisco.com 879 Avshalom Houri 880 IBM 881 Rorberg Building, Pekris 3 882 Rehovot 76123 883 Israel 885 Email: avshalom@il.ibm.com 887 Joe Hildebrand 888 Cisco Systems, Inc. 889 1899 Wynkoop Street, Suite 600 890 Denver, CO 80202 891 USA 893 Email: jhildebr@cisco.com