Internet Engineering Task Force (IETF) P. Saint-Andre Request for Comments: 7573 &yet Category: Standards Track S. Loreto ISSN: 2070-1721 Ericsson June 2015
Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): One-to-One Text Chat Sessions
Abstract
This document defines a bidirectional protocol mapping for the exchange of instant messages in the context of a one-to-one chat session between a user of the Session Initiation Protocol (SIP) and a user of the Extensible Messaging and Presence Protocol (XMPP). Specifically for SIP text chat, this document specifies a mapping to the Message Session Relay Protocol (MSRP).
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7573.
Copyright Notice
Copyright (c) 2015 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 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.
Both the Session Initiation Protocol (SIP) [RFC3261] and the Extensible Messaging and Presence Protocol (XMPP) [RFC6120] can be used for the purpose of one-to-one text chat over the Internet. To ensure interworking between these technologies, it is important to define bidirectional protocol mappings.
The architectural assumptions underlying such protocol mappings are provided in [RFC7247], including mapping of addresses and error conditions. This document specifies mappings for one-to-one text chat sessions (sometimes called "session-mode" messaging); in particular, this document specifies mappings between XMPP messages of type "chat" and the Message Session Relay Protocol (MSRP) [RFC4975], which is commonly used in SIP-based systems for chat functionality (although note that MSRP is not conjoined to SIP, and can be used by non-SIP technologies). Mappings for single instant messages and groupchat are provided in [RFC7572] and [GROUPCHAT].
The approach taken here is to directly map syntax and semantics from one protocol to another. The mapping described herein depends on the protocols defined in the following specifications:
o XMPP chat sessions using message stanzas of type "chat" are specified in [RFC6121].
o MSRP chat sessions using the SIP INVITE and SEND request types are specified in [RFC4975].
Saint-Andre & Loreto Standards Track [Page 2]
RFC 7573 SIP-XMPP Interworking: Chat June 2015
In SIP-based systems that use MSRP, a chat session is formally negotiated (just as any other session type is negotiated when using SIP). By contrast, a one-to-one chat "session" in XMPP is an informal construct and is not formally negotiated: a user simply sends a message of type "chat" to a contact, the contact then replies to the message, and the sum total of such messages exchanged during a defined period of time is considered to be a chat session (ideally tied together using an XMPP <thread/> element as described in Section 5.1 of [RFC6121]). To overcome the disparity between these approaches, a gateway that wishes to map between SIP/MSRP and XMPP for one-to-one chat sessions needs to maintain some additional state, as described below.
The documents in this series are intended for use by software developers who have an existing system based on one of these technologies (e.g., SIP) and who would like to enable communication from that existing system to systems based on the other technology (e.g., XMPP). We assume that readers are familiar with the core specifications for both SIP [RFC3261] and XMPP [RFC6120], with the base document for this series [RFC7247], and with the following chat- related specifications:
o "The Message Session Relay Protocol (MSRP)" [RFC4975]
o "Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence" [RFC6121]
o "Indication of Message Composition for Instant Messaging" [RFC3994]
o "Chat State Notifications" [XEP-0085]
Note well that not all protocol-compliant messages are shown (such as SIP 100 TRYING messages), in order to focus the reader on the essential aspects of the protocol flows.
In flow diagrams, SIP/MSRP traffic is shown using arrows such as "***>" whereas XMPP traffic is shown using arrows such as "...>".
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].
In XMPP, the "informal session" approach is to simply send someone a <message/> of type "chat" without starting any session negotiation ahead of time (as described in [RFC6121]). The XMPP "informal session" approach maps very well into a SIP MESSAGE request, as described in [RFC7572]. However, the XMPP informal session approach can also be mapped to MSRP if the XMPP-to-SIP gateway maintains additional state. The order of events is as follows.
The mapping of XMPP syntax to SIP syntax MUST be as specified in [RFC7572].
First, the XMPP user would generate an XMPP chat message.
Example 1: Juliet Sends XMPP Message (F1)
| <message from='juliet@example.com/yn0cl4bnw0yr3vym' | to='romeo@example.net' | id='a786hjs2' | type='chat'> | <thread>29377446-0CBB-4296-8958-590D79094C50</thread> | <body>Art thou not Romeo, and a Montague?</body> | </message>
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 explained in Section 5 of [RFC7247]. If the domain is a SIP domain, the XMPP server will hand
Saint-Andre & Loreto Standards Track [Page 5]
RFC 7573 SIP-XMPP Interworking: Chat June 2015
off the message stanza to an XMPP-to-SIP gateway or connection manager that natively communicates with MSRP-aware SIP servers.
The XMPP-to-SIP gateway at the XMPP server would then initiate an MSRP session with Romeo on Juliet's behalf (since there is no reliable way for the gateway to determine whether Romeo's client supports MSRP, if that is not the case then MSRP session initiation might result in an error).
Example 2: Gateway Starts SIP Session on Behalf of Juliet (F3)
The BYE is then acknowledged by the XMPP-to-SIP gateway.
Example 9: Gateway Acknowledges Termination (F15)
| SIP/2.0 200 OK | From: <sip:juliet@example.com>;tag=786 | To: <sip:romeo@example.net>;tag=087js | Call-ID: 29377446-0CBB-4296-8958-590D79094C50 | CSeq: 3 BYE | Content-Length: 0
Because there is no formal session on the XMPP side, there is no corresponding communication from the gateway to the XMPP user. However, it is reasonable for the gateway to send a "gone" chat state notification [XEP-0085], as described under Section 6.1.
In addition, there is no explicit method defined in [RFC6121] for an XMPP user to formally terminate a chat session, so a gateway would need to listen for a "gone" chat state notification from the XMPP user or institute a timer that considers the XMPP informal chat session to be ended after some amount of time has elapsed ([XEP-0085] suggests generating a "gone" chat state if a user has not interacted with the chat session interface, system, or device for a relatively long period of time, e.g., 10 minutes).
Upon receiving the INVITE, the SIP (MSRP) server needs to determine the identity of the domain portion of the Request-URI or To header, which it does by following the procedures explained in Section 5 of [RFC7247]. If the domain is an XMPP domain, the SIP server will hand off the INVITE to an associated MSRP-to-XMPP gateway or connection manager that natively communicates with XMPP servers.
Saint-Andre & Loreto Standards Track [Page 10]
RFC 7573 SIP-XMPP Interworking: Chat June 2015
Example 11: Gateway Accepts Session on Juliet's Behalf (F19)
Both XMPP and MSRP enable a client to receive notifications when a person's conversation partner is composing an instant message within the context of a chat session.
For XMPP, the Chat State Notifications specification [XEP-0085] defines five states: active, inactive, gone, composing, and paused. Some of these states are related to the act of message composition (composing, paused), whereas others are related to the sender's involvement with the chat session (active, inactive, gone). Note that the "gone" chat state is not to be confused with the <gone/> stanza error condition defined in [RFC6120].
For MSRP (and, in general, for so-called SIP for Instant Messaging and Presence Leveraging Extensions (SIMPLE) systems), the Indication of Message Composition for Instant Messaging specification [RFC3994] defines two states: idle and active. Here the idle state indicates that the sender is not actively composing a message, and the active state indicates that the sender is indeed actively composing a message (the sending client simply toggles between the two states).
Because XEP-0085 states can represent information that is not captured in RFC 3994, gateways can either (a) map only the composing- related states or (b) map all the XEP-0085 states.
The following mappings are suggested.
Table 3: Mapping of SIP/SIMPLE isComposing Events to XMPP Chat states
+-------------------+--------------------+ | isComposing Event | Chat State | +-------------------+--------------------+ | active | composing | | idle | active | +-------------------+--------------------+
Table 4: Mapping of XMPP Chat States to SIP/SIMPLE isComposing Events
The XMPP Chat State Notifications specification [XEP-0085] allows the sending of "standalone notifications" outside the context of a message, theoretically even before any messages are exchanged; although a gateway could thus send an <active/> notification to the XMPP user when the SIP user accepts or initiates a chat session (i.e., after F6 in Section 4 or after F22 in Section 5), this usage might be unexpected by XMPP clients as a way to signal the beginning of an informal chat session.
Although there is no direct mapping for the "gone" chat state to an isComposing event, receipt of the "gone" state at an XMPP-to-MSRP gateway can serve as a trigger for terminating the formal chat session within MSRP, i.e., for sending a SIP BYE for the session from the XMPP-to-MSRP gateway to the SIP user. The following examples illustrate this indirect mapping (which would arise if, for example, the XMPP user were to send a "gone" chat state notification after step F12 in Figure 1 or step F28 in Figure 2; in either of these cases, the session would be terminated by the XMPP user instead of by the SIP user, as currently shown in Figures 1 and 2).
Similarly, receipt of a SIP BYE message at an MSRP-to-XMPP gateway can serve as a trigger for sending a "gone" chat state notification to the XMPP user. The following examples illustrate this indirect mapping (which would occur after step F14 in Figure 1 or step F30 in Figure 2).
To enable these uses, gateways that support chat state notifications MUST support the "gone" state (which is merely recommended, not required, by [XEP-0085]).
It is also reasonable for gateways to implement timers that automatically trigger a "gone" chat state if the XMPP user has not sent a message within the "session" for a given amount of time ([XEP-0085] suggests generating a "gone" chat state if a user has not interacted with the chat session interface, system, or device for a relatively long period of time, e.g., 10 minutes).
Both XMPP and MSRP enable a client to receive notifications when a message has been received by the intended recipient.
For XMPP, the Message Receipts specification [XEP-0184] defines a method and XML namespace for requesting and returning indications that a message has been received by a client controlled by the intended recipient.
For MSRP, a native reporting feature is included, in the form of REPORT chunks (see Sections 7.1.2 and 7.1.3 of [RFC4975]).
An XMPP Message Receipts element of <request xmlns='urn:xmpp:receipts'/> is to be mapped to an MSRP Success-Report header field with a value of "yes", and an XMPP Message Receipts
Saint-Andre & Loreto Standards Track [Page 15]
RFC 7573 SIP-XMPP Interworking: Chat June 2015
element of <received xmlns='urn:xmpp:receipts'/> is to be mapped to an MSRP REPORT request.
A Success-Report header field with a value of "yes" in an MSRP SEND request is to be mapped to an XMPP Message Receipts element of <request xmlns='urn:xmpp:receipts'/>, and an MSRP REPORT request is to be mapped to an XMPP message containing only a Message Receipts element of <received xmlns='urn:xmpp:receipts'/>.
Because the XMPP Message Receipts specification does not support failure reports, there is no mapping for the MSRP Failure-Report header field and gateways SHOULD set that header field to "no".
Examples follow.
First, the XMPP user sends a message containing a request for delivery notification.
Example 23: Juliet Sends XMPP Message with Receipt Request
Unlike page-mode messaging [RFC3428] (which specifies that the size of a MESSAGE request is not allowed to exceed 1300 bytes), session- mode messaging [RFC4975] can be used to send larger messages. MSRP includes a chunking mechanism such that larger messages can be broken up into multiple MSRP SEND requests. Because the MSRP gateway at an XMPP service acts as an MSRP endpoint, it is responsible for receiving chunked messages and reconstructing them into a single message for delivery toward the XMPP recipient. (Naturally, implementations need to be careful about accepting very large messages; see Section 14.5 of [RFC4975].)
Although there is no hard limit on the size of an XMPP stanza, in practice, most XMPP services (at least on the public Internet) are configured with a maximum stanza size in order to help prevent denial-of-service attacks. As specified in Section 13.12 of [RFC6120], this maximum is not allowed to be less than 10,000 bytes.
The administrators of an XMPP service need to ensure that the associated MSRP gateway is configured with the same or smaller maximum MSRP message size as the maximum XMPP stanza size; this enables the gateway to return an appropriate value for the Session Description Protocol (SDP) "max-size" attribute (see Section 8.6 of [RFC4975]) and to properly handle incoming messages larger than the configured limits.
Saint-Andre & Loreto Standards Track [Page 17]
RFC 7573 SIP-XMPP Interworking: Chat June 2015
If an MSRP-to-XMPP gateway implementation receives an MSRP message that exceeds its configured limit as just described, it MUST return an MSRP 413 error (e.g., in response to the first SEND request whose Byte-Range header field indicates a byte total exceeding the limit).
[RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M., and E. Schooler, "SIP: Session Initiation Protocol", RFC 3261, DOI 10.17487/RFC3261, June 2002, <http://www.rfc-editor.org/info/rfc3261>.
[RFC7247] Saint-Andre, P., Houri, A., and J. Hildebrand, "Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Architecture, Addresses, and Error Handling", RFC 7247, DOI 10.17487/RFC7247, May 2014, <http://www.rfc-editor.org/info/rfc7247>.
[RFC7572] Saint-Andre, P., Houri, A., and J. Hildebrand, "Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Instant Messaging", RFC 7572, DOI 10.17487/RFC7572, June 2015, <http://www.rfc-editor.org/info/rfc7572>.
[XEP-0085] Saint-Andre, P. and D. Smith, "Chat State Notifications", XSF XEP 0085, September 2009.
[XEP-0184] Saint-Andre, P. and J. Hildebrand, "Message Delivery Receipts", XSF XEP 0184, March 2011.
[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", Work in Progress, draft-ietf-stox-groupchat-11, March 2015.
[RFC3428] Campbell, B., Ed., Rosenberg, J., Schulzrinne, H., Huitema, C., and D. Gurle, "Session Initiation Protocol (SIP) Extension for Instant Messaging", RFC 3428, DOI 10.17487/RFC3428, December 2002, <http://www.rfc-editor.org/info/rfc3428>.
Acknowledgements
Special thanks to Eddy Gavita and Nazin Hossain for coauthoring an early draft version of this document.
Thanks to Mary Barnes, Ben Campbell, Dave Crocker, Adrian Georgescu, Philipp Hancke, Saul Ibarra Corretge, Tory Patnoe, and Matt Ryan for their feedback.
Stephen Farrell, Brian Haberman, Joel Jaeggli, Barry Leiba, Kathleen Moriarty, and Pete Resnick provided helpful input during IESG review.
The authors gratefully acknowledge the assistance of Markus Isomaki and Yana Stamcheva as the working group chairs and Gonzalo Camarillo and Alissa Cooper as the sponsoring Area Directors.
Peter Saint-Andre wishes to acknowledge Cisco Systems, Inc., for employing him during his work on earlier draft versions of this document.