Network Working Group P. Saint-Andre Internet-Draft Cisco Systems, Inc. Intended status: Standards Track A. Houri Expires: June 13, 2014 IBM J. Hildebrand Cisco Systems, Inc. December 10, 2013 Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Instant Messaging draft-ietf-stox-im-06 Abstract This document defines a bidirectional protocol mapping for the exchange of single instant messages between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP). Status of this Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on June 13, 2014. Copyright Notice Copyright (c) 2013 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must Saint-Andre, et al. Expires June 13, 2014 [Page 1] Internet-Draft SIP-XMPP Interworking: IM December 2013 include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. XMPP to SIP . . . . . . . . . . . . . . . . . . . . . . . . . 4 4. SIP to XMPP . . . . . . . . . . . . . . . . . . . . . . . . . 6 5. Content Types . . . . . . . . . . . . . . . . . . . . . . . . 8 6. Internationalization Considerations . . . . . . . . . . . . . 9 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 8. Security Considerations . . . . . . . . . . . . . . . . . . . 9 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 10 9.1. Normative References . . . . . . . . . . . . . . . . . . . 10 9.2. Informative References . . . . . . . . . . . . . . . . . . 11 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 12 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 12 Saint-Andre, et al. Expires June 13, 2014 [Page 2] Internet-Draft SIP-XMPP Interworking: IM December 2013 1. Introduction In order to help ensure interworking between instant messaging (IM) systems that conform to the instant messaging / presence requirements [RFC2779], it is important to clearly define protocol mappings between such systems. Within the IETF, work has proceeded on two instant messaging technologies: o Various extensions to the Session Initiation Protocol ([RFC3261]) for instant messaging, as developed within the SIP for Instant Messaging and Presence Leveraging Extensions (SIMPLE) Working Group; the relevant specification for instant messaging is [RFC3428] o The Extensible Messaging and Presence Protocol (XMPP), which consists of a formalization of the core XML streaming protocols developed originally by the Jabber open-source community; the relevant specifications are [RFC6120] for the XML streaming layer and [RFC6121] for basic presence and instant messaging extensions One approach to helping ensure interworking between these protocols is to map each protocol to the abstract semantics described in [RFC3860]; that is the approach taken by [I-D.ietf-simple-cpim-mapping] and [RFC3922]. By contrast, the approach taken in this document is to directly map semantics from one protocol to another (i.e., from SIP/SIMPLE to XMPP and vice-versa). Both XMPP and IM-aware SIP systems enable entities to exchange "instant messages". The term "instant message" usually refers to a message sent between two entities for delivery in close to real time (rather than a message that is stored and forwarded to the intended recipient upon request). This document covers single messages only (sometimes called "pager-mode" messaging), since they form the lowest common denominator for IM. Separate documents cover one-to-one chat sessions [I-D.ietf-stox-chat] and multi-party groupchat [I-D.ietf-stox-groupchat]. The architectural assumptions underlying such direct mappings are provided in [I-D.ietf-stox-core], including mapping of addresses and error conditions. The mappings specified in this document cover basic instant messaging functionality, i.e., the exchange of a single instant message between a SIP user and an XMPP user in either direction. Mapping of more advanced functionality is out of scope for this document, but other documents in this "series" cover such topics. Saint-Andre, et al. Expires June 13, 2014 [Page 3] Internet-Draft SIP-XMPP Interworking: IM December 2013 2. Terminology A number of terms used here are explained in [RFC3261], [RFC3428], [RFC6120], and [RFC6121]. Continuing the tradition of Shakespearean examples in XMPP documentation, the actors in this document are an XMPP user and a SIP user . The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. 3. XMPP to SIP As described in [RFC6121], a single instant message is an XML stanza of type "normal" sent over an XML stream (since "normal" is the default for the 'type' attribute of the stanza, the attribute is often omitted). In this document we will assume that such a message is sent from an XMPP client to an XMPP server over an XML stream negotiated between the client and the server, and that the client is controlled by a human user (this is a simplifying assumption introduced for explanatory purposes only; the XMPP sender could be an automated client, a component such as a workflow application, a server, etc.). When Juliet wants to send an instant message to Romeo, she interacts with her XMPP client, which generates an XMPP stanza. The syntax of the stanza, including required and optional elements and attributes, is defined in [RFC6121] (for single instant messages, the value of the 'to' address SHOULD be a "bare JID" of the form "localpart@domainpart"). The following is an example of such a stanza: Example 1: XMPP user sends message: | | Art thou not Romeo, and a Montague? | Upon receiving such a message stanza, the XMPP server needs to determine the identity of the domainpart in the 'to' address, which it does by following the procedures discussed in [I-D.ietf-stox-core]. Here we assume that the XMPP server has determined the domain is serviced by a SIMPLE server, that it Saint-Andre, et al. Expires June 13, 2014 [Page 4] Internet-Draft SIP-XMPP Interworking: IM December 2013 contains or has available to it an XMPP-SIMPLE gateway or connection manager (which enables it to speak natively to SIMPLE servers), and that it hands off the message stanza to the XMPP-SIMPLE gateway. The XMPP-SIMPLE gateway is then responsible for translating the XMPP message stanza into a SIP MESSAGE request from the XMPP user to the SIP user: Example 2: XMPP user sends message (SIP transformation): | MESSAGE sip:romeo@example.net SIP/2.0 | Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bK776sgdkse | Max-Forwards: 70 | To: sip:romeo@example.net | From: ;tag=12345 | Call-ID: D9AA95FD-2BD5-46E2-AF0F-6CFAA96BDDFA | CSeq: 1 MESSAGE | Content-Type: text/plain | Content-Length: 35 | | Art thou not Romeo, and a Montague? The destination SIP server is responsible for delivering the message to the intended recipient, and the recipient is responsible for generating a response (e.g., 200 OK). Example 3: SIP user agent indicates receipt of message: | SIP/2.0 200 OK | Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bK776sgdkse | From: sip:romeo@example.net;tag=vwxyz | To: sip:juliet@example.com;tag=12345 | Call-ID: D9AA95FD-2BD5-46E2-AF0F-6CFAA96BDDFA | CSeq: 1 MESSAGE | Content-Length: 0 As described in [RFC3428], a downstream proxy could fork a MESSAGE request, but it would return only one 200 OK to the gateway. Informational Note: This document does not specify handling of the 200 OK by the XMPP-SIMPLE gateway (e.g., to enable message acknowledgements). See [I-D.ietf-stox-chat] for a mapping of message acknowledgements in the context of one-to-one chat sessions. The mapping of XMPP syntax to SIP syntax SHOULD be as shown in the following table. (Mappings for several aspects not mentioned here are specified in [I-D.ietf-stox-chat].) Saint-Andre, et al. Expires June 13, 2014 [Page 5] Internet-Draft SIP-XMPP Interworking: IM December 2013 Table 1: Message syntax mapping from XMPP to SIP +-----------------------------+--------------------------+ | XMPP Element or Attribute | SIP Header or Contents | +-----------------------------+--------------------------+ | | body of MESSAGE | | | Subject | | | Call-ID | | from | From (1) | | id | (no mapping) | | to | To or Request-URI | | type | (no mapping) (2) | | xml:lang | Content-Language | +-----------------------------+--------------------------+ 1. As shown in the foregoing example and described in [I-D.ietf-stox-core], the XMPP-SIMPLE gateway SHOULD map the full JID (localpart@domainpart/resourcepart) of the XMPP sender to the SIP From header and include the resourcepart as the GRUU portion [RFC5627] of the SIP URI. 2. Because there is no SIP header field that matches the meaning of the XMPP message 'type' values ("normal", "chat", "groupchat", "headline", "error"), no general mapping is possible here. 4. SIP to XMPP As described in [RFC3428], a single instant message is a SIP MESSAGE request sent from a SIP user agent to an intended recipient who is most generally referenced by an Instant Message URI of the form but who might be referenced by a SIP or SIPS URI of the form or . Here again we introduce the simplifying assumption that the user agent is controlled by a human user, whom we shall dub . When Romeo wants to send an instant message to Juliet, he interacts with his SIP user agent, which generates a SIP MESSAGE request. The syntax of the MESSAGE request is defined in [RFC3428]. The following is an example of such a request: Saint-Andre, et al. Expires June 13, 2014 [Page 6] Internet-Draft SIP-XMPP Interworking: IM December 2013 Example 4: SIP user sends message: | MESSAGE sip:juliet@example.com SIP/2.0 | Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKeskdgs677 | Max-Forwards: 70 | To: sip:juliet@example.com | From: sip:romeo@example.net;tag=vwxyz | Call-ID: 9E97FB43-85F4-4A00-8751-1124FD4C7B2E | CSeq: 1 MESSAGE | Content-Type: text/plain | Content-Length: 44 | | Neither, fair saint, if either thee dislike. Section 5 of [RFC3428] stipulates that a SIP User Agent presented with an im: URI should resolve it to a sip: or sips: URI. Therefore we assume that the Request-URI of a request received by a SIMPLE-XMPP gateway will contain a sip: or sips: URI. The SIP server needs to determine the identity of the domain portion of the Request-URI or To header, which it does by following the procedures discussed in [I-D.ietf-stox-core]. Here we assume that the SIP server has determined that the domain is serviced by an XMPP server, that it contains or has available to it a SIP-to-XMPP gateway or connection manager (which enables it to speak natively to XMPP servers), and that it hands off the message to the gateway. The SIP-to-XMPP gateway is then responsible for translating the request into an XMPP message stanza from the SIP user to the XMPP user and returning a SIP "200 OK" message to the sender: Example 5: SIP user sends message (XMPP transformation): | | Neither, fair saint, if either thee dislike. | Note that the stanza handling rules specified in [RFC6121] allow the receiving XMPP server to deliver a message stanza whose 'to' address is a bare JID ("localpart@domainpart") to multiple connected devices. This is similar to the "forking" of messages in SIP. The mapping of SIP syntax to XMPP syntax SHOULD be as shown in the following table. (Mappings for several aspects not mentioned here are specified in [I-D.ietf-stox-chat].) Saint-Andre, et al. Expires June 13, 2014 [Page 7] Internet-Draft SIP-XMPP Interworking: IM December 2013 Table 2: Message syntax mapping from SIP to XMPP +--------------------------+-----------------------------+ | SIP Header or Contents | XMPP Element or Attribute | +--------------------------+-----------------------------+ | Call-ID | | | Content-Language | xml:lang | | CSeq | (no mapping) | | From | from (1) | | Subject | | | Request-URI or To | to | | body of MESSAGE | | +--------------------------+-----------------------------+ 1. As shown in the foregoing example and described in [I-D.ietf-stox-core], if the SIMPLE-XMPP gateway has information about the GRUU [RFC5627] of the particular endpoint that sent the SIP message then it SHOULD map the sender's address to a full JID (localpart@domainpart/resourcepart) in the 'from' attribute of the XMPP stanza and include the GRUU as the resourcepart. When transforming SIP pager-mode messages, a SIMPLE-XMPP gateway SHOULD specify no XMPP 'type' attribute or, equivalently, a 'type' attribute whose value is "normal" [RFC6121]. See Section 5 of this document about the handling of SIP message bodies that contain content types other than plain text. 5. Content Types SIP requests of type MESSAGE are allowed to contain essentially any content type. The recommended procedures for SIMPLE-to-XMPP gateways to use in handling these content types are as follows. A SIMPLE-to-XMPP gateway MUST process SIP messages that contain message bodies of type "text/plain" and MUST encapsulate such message bodies as the XML character data of the XMPP element. A SIMPLE-to-XMPP gateway SHOULD process SIP messages that contain message bodies of type "text/html"; if so, a gateway MUST transform the "text/html" content into XHTML content that conforms to the XHTML-IM Integration Set specified in [XEP-0071]. Although a SIMPLE-to-XMPP gateway MAY process SIP messages that contain message bodies of types other than "text/plain" and "text/ html", the handling of such content types is a matter of implementation. Saint-Andre, et al. Expires June 13, 2014 [Page 8] Internet-Draft SIP-XMPP Interworking: IM December 2013 6. Internationalization Considerations Both XMPP and SIP support the UTF-8 encoding [RFC3629] of Unicode characters [UNICODE] within messages, and signalling of the language for a particular message (in XMPP via the 'xml:lang' attribute and in SIP via the Content-Language header). Several examples follow, using the "XML Notation" for Unicode characters outside the ASCII range described in [RFC3987]. Example 6: SIP user sends message: | MESSAGE sip:juliet@example.com SIP/2.0 | Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKeskdgs677 | Max-Forwards: 70 | To: sip:juliet@example.com | From: sip:romeo@example.net;tag=vwxyz | Call-ID: 9E97FB43-85F4-4A00-8751-1124FD4C7B2E | CSeq: 1 MESSAGE | Content-Type: text/plain | Content-Length: 45 | Content-Language: cs | | Nic z ob쎩ho, m쎡 d쒛vo spanil쎡, | nenavid쎭얡-li jedno nebo druh쎩. Example 7: SIP user sends message (XMPP transformation): | | | Nic z ob쎩ho, m쎡 d쒛vo spanil쎡, | nenavid쎭얡-li jedno nebo druh쎩. | | 7. IANA Considerations This document requests no actions of IANA. 8. Security Considerations Detailed security considerations for instant messaging protocols are given in [RFC2779], for SIP-based instant messaging in [RFC3428] (see also [RFC3261]), and for XMPP-based instant messaging in [RFC6121] (see also [RFC6120]). The security considerations provided in Saint-Andre, et al. Expires June 13, 2014 [Page 9] Internet-Draft SIP-XMPP Interworking: IM December 2013 [I-D.ietf-stox-core] also apply. This document specifies methods for exchanging instant messages through a gateway that translates between SIP and XMPP. Such a gateway MUST be compliant with the minimum security requirements of the instant messaging protocols for which it translates (i.e., SIP and XMPP). The addition of gateways to the security model of instant messaging specified in [RFC2779] introduces some new risks. In particular, end-to-end security properties (especially confidentiality and integrity) between instant messaging user agents that interface through a SIMPLE-XMPP gateway can be provided only if common formats are supported. Specification of those common formats is out of scope for this document, although it is preferred to use [RFC3862] for instant messages. 9. References 9.1. Normative References [I-D.ietf-stox-chat] Saint-Andre, P., Loreto, S., Gavita, E., and N. Hossain, "Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): One-to-One Text Chat Sessions", draft-ietf-stox-chat-03 (work in progress), October 2013. [I-D.ietf-stox-core] Saint-Andre, P., Houri, A., and J. Hildebrand, "Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Core", draft-ietf-stox-core-07 (work in progress), October 2013. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M., and E. Schooler, "SIP: Session Initiation Protocol", RFC 3261, June 2002. [RFC3428] Campbell, B., Rosenberg, J., Schulzrinne, H., Huitema, C., and D. Gurle, "Session Initiation Protocol (SIP) Extension for Instant Messaging", RFC 3428, December 2002. [RFC5627] Rosenberg, J., "Obtaining and Using Globally Routable User Agent URIs (GRUUs) in the Session Initiation Protocol Saint-Andre, et al. Expires June 13, 2014 [Page 10] Internet-Draft SIP-XMPP Interworking: IM December 2013 (SIP)", RFC 5627, October 2009. [RFC6120] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Core", RFC 6120, March 2011. [RFC6121] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence", RFC 6121, March 2011. [XEP-0071] Saint-Andre, P., "XHTML-IM", XSF XEP 0071, November 2012. 9.2. Informative References [I-D.ietf-simple-cpim-mapping] Rosenberg, J. and B. Campbell, "CPIM Mapping of SIMPLE Presence and Instant Messaging", draft-ietf-simple-cpim-mapping-01 (work in progress), June 2002. [I-D.ietf-stox-groupchat] Saint-Andre, P., Corretge, S., and S. Loreto, "Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Groupchat", draft-ietf-stox-groupchat-01 (work in progress), September 2013. [RFC2779] Day, M., Aggarwal, S., and J. Vincent, "Instant Messaging / Presence Protocol Requirements", RFC 2779, February 2000. [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 10646", STD 63, RFC 3629, November 2003. [RFC3860] Peterson, J., "Common Profile for Instant Messaging (CPIM)", RFC 3860, August 2004. [RFC3862] Klyne, G. and D. Atkins, "Common Presence and Instant Messaging (CPIM): Message Format", RFC 3862, August 2004. [RFC3922] Saint-Andre, P., "Mapping the Extensible Messaging and Presence Protocol (XMPP) to Common Presence and Instant Messaging (CPIM)", RFC 3922, October 2004. [RFC3987] Duerst, M. and M. Suignard, "Internationalized Resource Identifiers (IRIs)", RFC 3987, January 2005. [UNICODE] The Unicode Consortium, "The Unicode Standard, Version Saint-Andre, et al. Expires June 13, 2014 [Page 11] Internet-Draft SIP-XMPP Interworking: IM December 2013 6.2", 2012, . Appendix A. Acknowledgements The authors wish to thank the following individuals for their feedback: Dave Cridland, Adrian Georgescu, Christer Holmberg, Saul Ibarra Corretge, Olle Johansson, Paul Kyzivat, Salvatore Loreto, Daniel-Constantin Mierla, and Tory Patnoe. The authors gratefully acknowledge the assistance of Markus Isomaki and Yana Stamcheva as the working group chairs and Gonzalo Camarillo as the sponsoring Area Director. Authors' Addresses Peter Saint-Andre Cisco Systems, Inc. 1899 Wynkoop Street, Suite 600 Denver, CO 80202 USA Phone: +1-303-308-3282 Email: psaintan@cisco.com Avshalom Houri IBM Rorberg Building, Pekris 3 Rehovot 76123 Israel Email: avshalom@il.ibm.com Joe Hildebrand Cisco Systems, Inc. 1899 Wynkoop Street, Suite 600 Denver, CO 80202 USA Email: jhildebr@cisco.com Saint-Andre, et al. Expires June 13, 2014 [Page 12]