Skip to main content

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-09

The information below is for an old version of the document.
Document Type
This is an older version of an Internet-Draft that was ultimately published as RFC 7573.
Authors Peter Saint-Andre , Salvatore Loreto
Last updated 2015-02-02
Replaces draft-saintandre-sip-xmpp-chat
RFC stream Internet Engineering Task Force (IETF)
Formats
Reviews
Additional resources Mailing list discussion
Stream WG state Submitted to IESG for Publication
Document shepherd Yana Stamcheva
Shepherd write-up Show Last changed 2015-01-26
IESG IESG state Became RFC 7573 (Proposed Standard)
Consensus boilerplate Unknown
Telechat date (None)
Responsible AD Alissa Cooper
Send notices to stox@ietf.org, stox-chairs@ietf.org, yana@jitsi.org, draft-ietf-stox-chat.all@ietf.org
draft-ietf-stox-chat-09
Network Working Group                                     P. Saint-Andre
Internet-Draft                                                      &yet
Intended status: Standards Track                               S. Loreto
Expires: August 6, 2015                                         Ericsson
                                                        February 2, 2015

   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-09

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 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 August 6, 2015.

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

Saint-Andre & Loreto     Expires August 6, 2015                 [Page 1]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   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.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  Intended Audience . . . . . . . . . . . . . . . . . . . . . .   3
   3.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . .   3
   4.  XMPP to MSRP  . . . . . . . . . . . . . . . . . . . . . . . .   4
   5.  MSRP to XMPP  . . . . . . . . . . . . . . . . . . . . . . . .   8
   6.  Composing Events  . . . . . . . . . . . . . . . . . . . . . .  12
   7.  Delivery Reports  . . . . . . . . . . . . . . . . . . . . . .  15
   8.  Internationalization Considerations . . . . . . . . . . . . .  16
   9.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  16
   10. Security Considerations . . . . . . . . . . . . . . . . . . .  17
   11. References  . . . . . . . . . . . . . . . . . . . . . . . . .  17
   Appendix A.  Acknowledgements . . . . . . . . . . . . . . . . . .  18
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  18

1.  Introduction

   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 separate documents.

   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].

Saint-Andre & Loreto     Expires August 6, 2015                 [Page 2]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   o  MSRP chat sessions using the SIP INVITE and SEND request types are
      specified in [RFC4975].

   In SIP-based systems that use MSRP, a chat session is formally
   negotiated just as any other session type is 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.

2.  Intended Audience

   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 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: 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.

3.  Terminology

   A number of terms used here are explained in [RFC3261], [RFC4975],
   [RFC6120], and [RFC6121].

   In flow diagrams, SIP/MSRP traffic is shown using arrows such as
   "***>" whereas XMPP traffic is shown using arrows such as "...>".

Saint-Andre & Loreto     Expires August 6, 2015                 [Page 3]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   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].

4.  XMPP to MSRP

   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 [RFC7247].  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.

   XMPP            XMPP        XMPP-to-MSRP        SIP             SIP
   User           Server         Gateway          Server          User
    |               |               |               |               |
    | (F1) XMPP     |               |               |               |
    | message       |               |               |               |
    |..............>|               |               |               |
    |               | (F2) XMPP     |               |               |
    |               | message       |               |               |
    |               |..............>|               |               |
    |               |               | (F3) SIP      |               |
    |               |               | INVITE        |               |
    |               |               |**************>|               |
    |               |               |               | (F4) SIP      |
    |               |               |               | INVITE        |
    |               |               |               |**************>|
    |               |               |               | (F5) SIP      |
    |               |               |               | 200 OK        |
    |               |               |               |<**************|
    |               |               | (F6) SIP      |               |
    |               |               | 200 OK        |               |
    |               |               |<**************|               |
    |               |               | (F7) SIP ACK  |               |
    |               |               |**************>|               |
    |               |               |               | (F8) SIP ACK  |
    |               |               |               |**************>|
    |               |               | (F9) MSRP SEND                |
    |               |               |******************************>|
    .               .               .               .               .
    .               .               .               .               .
    |               |               | (F10) MSRP SEND               |
    |               |               |<******************************|
    |               | (F11) XMPP    |               |               |
    |               | message       |               |               |

Saint-Andre & Loreto     Expires August 6, 2015                 [Page 4]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

    |               |<..............|               |               |
    | (F12) XMPP    |               |               |               |
    | message       |               |               |               |
    |<..............|               |               |               |
    .               .               .               .               .
    .               .               .               .               .
    |               |               |               | (F13) SIP BYE |
    |               |               |               |<**************|
    |               |               | (F14) SIP BYE |               |
    |               |               |<**************|               |
    |               |               | (F15) SIP     |               |
    |               |               | 200 OK        |               |
    |               |               |**************>|               |
    |               |               |               | (F16) SIP     |
    |               |               |               | 200 OK        |
    |               |               |               |**************>|

                  Figure 1: XMPP to MSRP Order of Events

   The mapping of XMPP syntax to SIP syntax MUST be as shown in the
   following table.  (Mappings for several aspects not mentioned here
   are specified in [I-D.ietf-stox-im].)

   Table 1: Message syntax mapping from XMPP to SIP

      +-----------------------------+--------------------------+
      |  XMPP Element or Attribute  |  SIP Header or Contents  |
      +-----------------------------+--------------------------+
      |  <thread/>                  |  Call-ID                 |
      |  id                         |  transaction identifier  |
      +-----------------------------+--------------------------+

   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     Expires August 6, 2015                 [Page 5]
Internet-Draft         SIP-XMPP Interworking: Chat         February 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)

   | INVITE sip:romeo@example.net SIP/2.0
   | To: <sip:romeo@example.net>
   | From: <sip:juliet@example.com>
   | Contact: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   | Subject: Open chat with Juliet?
   | Call-ID: 29377446-0CBB-4296-8958-590D79094C50
   | Content-Type: application/sdp
   |
   | c=IN IP4 x2s.example.com
   | m=message 7654 TCP/MSRP *
   | a=accept-types:text/plain
   | a=path:msrp://x2s.example.com:7654/jshA7weztas;tcp

   Here we assume that Romeo's client supports MSRP and that Romeo
   accepts the MSRP session request.

   Example 3: Romeo accepts session request (F5)

   | SIP/2.0 200 OK
   | To: <sip:juliet@example.com>
   | From: <sip:romeo@example.net>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Call-ID: 29377446-0CBB-4296-8958-590D79094C50
   | Content-Type: application/sdp
   |
   | c=IN IP4 s2x.example.net
   | m=message 12763 TCP/MSRP *
   | a=accept-types:text/plain
   | a=path:msrp://s2x.example.net:12763/kjhd37s2s20w2a;tcp

   The XMPP-to-SIP gateway then acknowledges the session acceptance on
   behalf of Juliet.

Saint-Andre & Loreto     Expires August 6, 2015                 [Page 6]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   Example 4: Gateway sends ACK to Romeo (F7)

   | ACK sip:juliet@example.com SIP/2.0
   | To: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | From: <sip:juliet@example.com>
   | Contact: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   | Call-ID: 29377446-0CBB-4296-8958-590D79094C50

   The XMPP-to-SIP gateway then transforms the original XMPP chat
   message into MSRP.

   Example 5: Gateway maps XMPP message to MSRP (F9)

   | MSRP a786hjs2 SEND
   | From-Path: msrp://x2s.example.com:7654/jshA7weztas;tcp
   | To-Path: msrp://s2x.example.net:12763/kjhd37s2s20w2a;tcp
   | Message-ID: 54C6F4F1-A39C-47D6-8718-FA65B3D0414A
   | Byte-Range: 1-25/25
   | Content-Type: text/plain
   |
   | Art thou not Romeo, and a Montague?
   | -------a786hjs2$

   Romeo can then send a reply using his MSRP client.

   Example 6: Romeo sends reply (F10)

   | MSRP di2fs53v SEND
   | To-Path: msrp://x2s.example.com:7654/jshA7weztas;tcp
   | From-Path: msrp://s2x.example.net:12763/kjhd37s2s20w2a;tcp
   | Message-ID: 6480C096-937A-46E7-BF9D-1353706B60AA
   | Byte-Range: 1-25/25
   | Failure-Report: no
   | Content-Type: text/plain
   |
   | Neither, fair saint, if either thee dislike.
   | -------di2fs53v$

   The SIP-to-XMPP gateway would then transform that message into
   appropriate XMPP syntax for routing to the intended recipient.

Saint-Andre & Loreto     Expires August 6, 2015                 [Page 7]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   Example 7: Gateway maps MSRP message to XMPP (F11)

   | <message from='romeo@example.net/dr4hcr0st3lup4c'
   |          to='juliet@example.com/yn0cl4bnw0yr3vym'
   |          id='di2fs53v'
   |          type='chat'>
   |   <thread>29377446-0CBB-4296-8958-590D79094C50</thread>
   |   <body>Neither, fair saint, if either thee dislike.</body>
   | </message>

   When the MSRP user wishes to end the chat session, the user's MSRP
   client sends a SIP BYE.

   Example 8: Romeo terminates chat session (F13)

   | BYE juliet@example.com sip: SIP/2.0
   | From: <sip:romeo@example.net>;tag=087js
   | To: <sip:juliet@example.com>;tag=786
   | Call-ID: 29377446-0CBB-4296-8958-590D79094C50
   | Cseq: 1 BYE
   | Content-Length: 0

   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: 1 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.

5.  MSRP to XMPP

   When an MSRP client sends messages through a gateway to an XMPP
   client, the order of events is as follows.

   SIP             SIP         MSRP-to-XMPP       XMPP            XMPP
   User           Server         Gateway         Server           User
    |               |               |               |               |
    | (F17) SIP     |               |               |               |
    | INVITE        |               |               |               |

Saint-Andre & Loreto     Expires August 6, 2015                 [Page 8]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

    |**************>|               |               |               |
    |               | (F18) SIP     |               |               |
    |               | INVITE        |               |               |
    |               |**************>|               |               |
    |               | (F19) SIP     |               |               |
    |               | 200 OK        |               |               |
    |               |<**************|               |               |
    | (F20) SIP     |               |               |               |
    | 200 OK        |               |               |               |
    |<**************|               |               |               |
    | (F21) SIP ACK |               |               |               |
    |**************>|               |               |               |
    |               | (F22) SIP ACK |               |               |
    |               |**************>|               |               |
    | (F23) MSRP SEND               |               |               |
    |******************************>|               |               |
    |               |               | (F24) XMPP    |               |
    |               |               | message       |               |
    |               |               |..............>|               |
    |               |               |               | (F25) XMPP    |
    |               |               |               | message       |
    |               |               |               |..............>|
    .               .               .               .               .
    .               .               .               .               .
    |               |               |               | (F26) XMPP    |
    |               |               |               | message       |
    |               |               |               |<..............|
    |               |               | (F27) XMPP    |               |
    |               |               | message       |               |
    |               |               |<..............|               |
    | (F28) MSRP SEND               |               |               |
    |<******************************|               |               |
    .               .               .               .               .
    .               .               .               .               .
    |               |               |               |               |
    |               |               |               |               |
    | (F29) SIP BYE |               |               |               |
    |**************>|               |               |               |
    |               | (F30) SIP BYE |               |               |
    |               |**************>|               |               |
    |               | (F31) SIP     |               |               |
    |               | 200 OK        |               |               |
    |               |<**************|               |               |
    | (F32) SIP     |               |               |               |
    | 200 OK        |               |               |               |
    |<**************|               |               |               |

                  Figure 2: MSRP to XMPP Order of Events

Saint-Andre & Loreto     Expires August 6, 2015                 [Page 9]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   The mapping of SIP syntax to XMPP syntax MUST be as shown in the
   following table.  (Mappings for several aspects not mentioned here
   are specified in [I-D.ietf-stox-im].)

   Table 2: Message syntax mapping from SIP to XMPP

      +--------------------------+-----------------------------+
      |  SIP Header or Contents  |  XMPP Element or Attribute  |
      +--------------------------+-----------------------------+
      |  Call-ID                 |  <thread/>                  |
      |  transaction identifier  |  id                         |
      +--------------------------+-----------------------------+

   The protocol flow begins when Romeo starts a chat session with
   Juliet.

   Example 10: Romeo starts chat session (F17)

   | INVITE sip:juliet@example.com SIP/2.0
   | To: <sip:juliet@example.com>
   | From: <sip:romeo@example.net>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Subject: Open chat with Romeo?
   | Call-ID: F6989A8C-DE8A-4E21-8E07-F0898304796F
   | Content-Type: application/sdp
   |
   | c=IN IP4 s2x.example.net
   | m=message 7313 TCP/MSRP *
   | a=accept-types:text/plain
   | a=path:msrp://s2x.example.net:7313/ansp71weztas;tcp

   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     Expires August 6, 2015                [Page 10]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   Example 11: Gateway accepts session on Juliet's behalf (F19)

   | SIP/2.0 200 OK
   | To: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | From: <sip:juliet@example.com>
   | Contact: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   | Call-ID: F6989A8C-DE8A-4E21-8E07-F0898304796F
   | Content-Type: application/sdp
   |
   | c=IN IP4 x2s.example.com
   | m=message 8763 TCP/MSRP *
   | a=accept-types:text/plain
   | a=path:msrp://x2s.example.com:8763/lkjh37s2s20w2a;tcp

   Example 12: Romeo sends ACK (F21)

   | ACK sip:juliet@example.com SIP/2.0
   | To: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   | From: <sip:romeo@example.net>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Call-ID: F6989A8C-DE8A-4E21-8E07-F0898304796F

   Example 13: Romeo sends message (F23)

   | MSRP ad49kswow SEND
   | To-Path: msrp://x2s.example.com:8763/lkjh37s2s20w2a;tcp
   | From-Path: msrp://s2x.example.net:7313/ansp71weztas;tcp
   | Message-ID: 676FDB92-7852-443A-8005-2A1B9FE44F4E
   | Byte-Range: 1-32/32
   | Failure-Report: no
   | Content-Type: text/plain
   |
   | I take thee at thy word ...
   | -------ad49kswow$

   Example 14: MSRP-to-XMPP gateway maps MSRP message to XMPP (F24)

   | <message from='romeo@example.net'
   |          to='juliet@example.com'
   |          id='ad49kswow'
   |          type='chat'>
   |   <thread>F6989A8C-DE8A-4E21-8E07-F0898304796F</thread>
   |   <body>I take thee at thy word ...</body>
   | </message>

Saint-Andre & Loreto     Expires August 6, 2015                [Page 11]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   Example 15: Juliet sends reply (F26)

   | <message from='juliet@example.com'
   |          to='romeo@example.net'
   |          id='ms53b7z9'
   |          type='chat'>
   |   <thread>29377446-0CBB-4296-8958-590D79094C50</thread>
   |   <body>What man art thou ...?</body>
   | </message>

   Example 16: Gateway maps XMPP message to MSRP (F28)

   | MSRP ms53b7z9 SEND
   | To-Path: msrp://s2x.example.net:7313/jshA7weztas;tcp
   | From-Path: msrp://x2s.example.com:8763/lkjh37s2s20w2a;tcp
   | Message-ID: 17EBA17B-94C0-463B-AD84-DE405C4C9D41
   | Byte-Range: 1-25/25
   | Failure-Report: no
   | Content-Type: text/plain
   |
   | What man art thou ...?
   | -------ms53b7z9$

   Example 17: Romeo terminates chat session (F29)

   | BYE juliet@example.com sip: SIP/2.0
   | To: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   | From: <sip:romeo@example.net>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Call-ID: F6989A8C-DE8A-4E21-8E07-F0898304796F
   | Cseq: 1 BYE
   | Content-Length: 0

   Example 18: Gateway acknowledges termination of session on behalf of
   Juliet (F31)

   | SIP/2.0 200 OK
   | To: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   | From: <sip:romeo@example.net>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Call-ID: F6989A8C-DE8A-4E21-8E07-F0898304796F
   | CSeq: 1 BYE

6.  Composing Events

   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.

Saint-Andre & Loreto     Expires August 6, 2015                [Page 12]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   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 SIP/SIMPLE in general), 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, changing to
   active if the user is actively composing a message and changing to
   idle if the user is no longer actively composing a message).

   Because the 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

   +-------------------+--------------------+
   | Chat State        | isComposing Event  |
   +-------------------+--------------------+
   | active            |  idle              |
   | inactive          |  idle              |
   | gone              |  [none, see note]  |
   | composing         |  active            |
   | paused            |  idle              |
   +-------------------+--------------------+

Saint-Andre & Loreto     Expires August 6, 2015                [Page 13]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

6.1.  Use of the Gone Chat State

   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 occur after step F14 in
   Figure 1).

   Example 19: Juliet sends gone chat state

   | <message from='juliet@example.com'
   |          id='nx62f197'
   |          to='romeo@example.net'
   |          type='chat'>
   |   <thread>29377446-0CBB-4296-8958-590D79094C50</thread>
   |   <gone xmlns='http://jabber.org/protocol/chatstates'/>
   | </message>

   Example 20: XMPP-to-MSRP gateway maps gone chat state to SIP BYE

   | BYE romeo@example.net sip: SIP/2.0
   | From: <sip:juliet@example.com>;tag=786
   | To: <sip:romeo@example.net>;tag=087js
   | Call-ID: 29377446-0CBB-4296-8958-590D79094C50
   | Cseq: 1 BYE
   | Content-Length: 0

   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 F30 in Figure 2).

   Example 21: Romeo terminates chat session

   | BYE juliet@example.com sip: SIP/2.0
   | To: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   | From: <sip:romeo@example.net>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Call-ID: F6989A8C-DE8A-4E21-8E07-F0898304796F
   | Cseq: 1 BYE
   | Content-Length: 0

Saint-Andre & Loreto     Expires August 6, 2015                [Page 14]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   Example 22: MSRP-to-XMPP gateway generates gone chat state

   | <message from='romeo@example.net'
   |          id='hs61v397'
   |          to='juliet@example.com'
   |          type='chat'>
   |   <thread>F6989A8C-DE8A-4E21-8E07-F0898304796F</thread>
   |   <gone xmlns='http://jabber.org/protocol/chatstates'/>
   | </message>

   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.

7.  Delivery Reports

   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]).

   Examples follow.

   First, the XMPP user sends a message containing a request for
   delivery notification.

   Example 23: Juliet sends XMPP message with receipt request

   | <message from='juliet@example.com'
   |          id='bf9m36d5'
   |          to='romeo@example.net'
   |          type='chat'>
   |   <thread>29377446-0CBB-4296-8958-590D79094C50</thread>
   |   <body>What man art thou ...?</body>
   |   <request xmlns='urn:xmpp:receipts'/>
   | </message>

Saint-Andre & Loreto     Expires August 6, 2015                [Page 15]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   Example 24: Gateway maps XMPP message to MSRP

   | MSRP bf9m36d5 SEND
   | To-Path: msrp://s2x.example.net:7313/jshA7weztas;tcp
   | From-Path: msrp://x2s.example.com:8763/lkjh37s2s20w2a;tcp
   | Message-ID: 6187CF9B-317A-41DA-BB6A-5E48A9C794EF
   | Byte-Range: 1-25/25
   | Success-Report: yes
   | Failure-Report: no
   | Content-Type: text/plain
   |
   | What man art thou ...?
   | -------bf9m36d5$

   Next, the recipient returns a report.

   Example 25: Romeo returns MSRP receipt

   | MSRP hx74g336 REPORT
   | To-Path: msrp://x2s.example.com:8763/lkjh37s2s20w2a;tcp
   | From-Path: msrp://s2x.example.net:7313/jshA7weztas;tcp
   | Message-ID: 6187CF9B-317A-41DA-BB6A-5E48A9C794EF
   | Byte-Range: 1-106/106
   | Status: 000 200 OK
   | -------hx74g336$

   Example 26: MSRP-to-XMPP gateway maps receipt to XMPP

   | <message from='romeo@example.net'
   |          id='hx74g336'
   |          to='juliet@example.com'>
   |   <received xmlns='urn:xmpp:receipts' id='87652491'/>
   | </message>

8.  Internationalization Considerations

   Relevant discussion of internationalized text in messages can be
   found in [I-D.ietf-stox-im].

9.  IANA Considerations

   This document requests no actions of IANA.

Saint-Andre & Loreto     Expires August 6, 2015                [Page 16]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

10.  Security Considerations

   Detailed security considerations for instant messaging protocols are
   given in [RFC2779], for MSRP chat in [RFC4975] (see also [RFC3261]
   when SIP is used to negotiate MSRP sessions), and for XMPP-based
   instant messaging in [RFC6121] (see also [RFC6120]).  The security
   considerations provided in [RFC7247] also apply.

   This document specifies methods for exchanging instant messages
   through a gateway that translates between SIP/MSRP and XMPP.  Such a
   gateway MUST be compliant with the minimum security requirements of
   the textual chat protocols for which it translates (i.e., MSRP 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 clients that
   interface through an MSRP-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 suggested to use [RFC3862]
   for instant messages.

11.  References

11.1.  Normative References

   [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.

   [RFC3862]  Klyne, G. and D. Atkins, "Common Presence and Instant
              Messaging (CPIM): Message Format", RFC 3862, August 2004.

   [RFC3994]  Schulzrinne, H., "Indication of Message Composition for
              Instant Messaging", RFC 3994, January 2005.

   [RFC4975]  Campbell, B., Mahy, R., and C. Jennings, "The Message
              Session Relay Protocol (MSRP)", RFC 4975, September 2007.

   [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.

Saint-Andre & Loreto     Expires August 6, 2015                [Page 17]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   [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, May 2014.

   [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.

11.2.  Informative References

   [I-D.ietf-stox-im]
              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", draft-ietf-stox-im-10 (work in
              progress), August 2014.

   [RFC2779]  Day, M., Aggarwal, S., and J. Vincent, "Instant Messaging
              / Presence Protocol Requirements", RFC 2779, February
              2000.

Appendix A.  Acknowledgements

   Special thanks to Eddy Gavita and Nazin Hossain for co-authoring an
   early 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.

   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 versions of this document.

Authors' Addresses

Saint-Andre & Loreto     Expires August 6, 2015                [Page 18]
Internet-Draft         SIP-XMPP Interworking: Chat         February 2015

   Peter Saint-Andre
   &yet

   Email: peter@andyet.com
   URI:   https://andyet.com/

   Salvatore Loreto
   Ericsson
   Hirsalantie 11
   Jorvas  02420
   Finland

   Email: Salvatore.Loreto@ericsson.com

Saint-Andre & Loreto     Expires August 6, 2015                [Page 19]