Internet Engineering Task Force (IETF)                    P. Saint-Andre
Request for Comments: 7573                                          &yet
Category: Standards Track                                      S. Loreto
ISSN: 2070-1721                                                 Ericsson
                                                               June 2015
        
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

会话启动协议(SIP)和可扩展消息和状态协议(XMPP)之间的互通:一对一文本聊天会话

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

本文档定义了一个双向协议映射,用于在会话发起协议(SIP)用户和可扩展消息和状态协议(XMPP)用户之间的一对一聊天会话的上下文中交换即时消息。特别是对于SIP文本聊天,本文档指定了到消息会话中继协议(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.

本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 5741第2节。

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.

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问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.

版权所有(c)2015 IETF信托基金和确定为文件作者的人员。版权所有。

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.

本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。

Table of Contents

目录

   1. Introduction ....................................................2
   2. Intended Audience ...............................................3
   3. Terminology .....................................................4
   4. XMPP to MSRP ....................................................4
   5. MSRP to XMPP ....................................................9
   6. Composing Events ...............................................13
      6.1. Use of the Gone Chat State ................................14
   7. Delivery Reports ...............................................15
   8. Message Size ...................................................17
   9. Internationalization Considerations ............................18
   10. Security Considerations .......................................18
   11. References ....................................................18
      11.1. Normative References .....................................18
      11.2. Informative References ...................................19
   Acknowledgements ..................................................20
   Authors' Addresses ................................................20
        
   1. Introduction ....................................................2
   2. Intended Audience ...............................................3
   3. Terminology .....................................................4
   4. XMPP to MSRP ....................................................4
   5. MSRP to XMPP ....................................................9
   6. Composing Events ...............................................13
      6.1. Use of the Gone Chat State ................................14
   7. Delivery Reports ...............................................15
   8. Message Size ...................................................17
   9. Internationalization Considerations ............................18
   10. Security Considerations .......................................18
   11. References ....................................................18
      11.1. Normative References .....................................18
      11.2. Informative References ...................................19
   Acknowledgements ..................................................20
   Authors' Addresses ................................................20
        
1. Introduction
1. 介绍

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.

会话启动协议(SIP)[RFC3261]和可扩展消息和状态协议(XMPP)[RFC6120]都可用于通过互联网进行一对一文本聊天。为了确保这些技术之间的互通,定义双向协议映射非常重要。

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

[RFC7247]中提供了此类协议映射的基础架构假设,包括地址和错误条件的映射。本文档指定了一对一文本聊天会话的映射(有时称为“会话模式”消息传递);特别是,本文档指定了类型为“chat”的XMPP消息与消息会话中继协议(MSRP)[RFC4975]之间的映射,该协议通常用于基于SIP的系统中的聊天功能(尽管请注意,MSRP未连接到SIP,可由非SIP技术使用)。[RFC7572]和[groupchat]中提供了单个即时消息和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 [RFC6121]中指定了使用“chat”类型消息节的XMPP聊天会话。

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

o [RFC4975]中指定了使用SIP INVITE和SEND请求类型的MSRP聊天会话。

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.

在使用MSRP的基于SIP的系统中,正式协商聊天会话(就像使用SIP时协商任何其他会话类型一样)。相比之下,XMPP中的一对一聊天“会话”是一种非正式的构造,并且不是正式协商的:用户只需向联系人发送“chat”类型的消息,然后联系人回复该消息,并且在定义的时间段内交换的此类消息的总和被视为聊天会话(理想情况下,使用[RFC6121]第5.1节中所述的XMPP<thread/>元素将其连接在一起)。为了克服这些方法之间的差异,希望在SIP/MSRP和XMPP之间映射一对一聊天会话的网关需要保持一些附加状态,如下所述。

2. Intended Audience
2. 目标受众

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:

本系列中的文档旨在供软件开发人员使用,这些软件开发人员拥有基于其中一种技术(如SIP)的现有系统,并且希望能够实现从该现有系统到基于其他技术(如XMPP)的系统的通信。我们假设读者熟悉SIP[RFC3261]和XMPP[RFC6120]的核心规范、本系列的基础文档[RFC7247]以及以下与聊天相关的规范:

o "The Message Session Relay Protocol (MSRP)" [RFC4975]

o “消息会话中继协议(MSRP)”[RFC4975]

o "Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence" [RFC6121]

o “可扩展消息和状态协议(XMPP):即时消息和状态”[RFC6121]

o "Indication of Message Composition for Instant Messaging" [RFC3994]

o “即时消息的消息合成指示”[RFC3994]

o "Chat State Notifications" [XEP-0085]

o “聊天状态通知”[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.

请注意,并非所有符合协议的消息都被显示(例如SIP 100 TRYING消息),以便使读者关注协议流的基本方面。

3. Terminology
3. 术语

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

[RFC3261]、[RFC4975]、[RFC6120]和[RFC6121]中解释了此处使用的许多术语。

   In flow diagrams, SIP/MSRP traffic is shown using arrows such as
   "***>" whereas XMPP traffic is shown using arrows such as "...>".
        
   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].

本文件中的关键词“必须”、“不得”、“必需”、“应”、“不应”、“建议”、“不建议”、“可”和“可选”应按照[RFC2119]中的说明进行解释。

4. XMPP to MSRP
4. XMPP到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 [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.

在XMPP中,“非正式会话”方法是简单地向某人发送“chat”类型的<message/>,而不提前开始任何会话协商(如[RFC6121]中所述)。XMPP“非正式会话”方法很好地映射到SIP消息请求中,如[RFC7572]中所述。但是,如果XMPP到SIP网关保持附加状态,则XMPP非正式会话方法也可以映射到MSRP。事件顺序如下。

   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  |               |
    |               |               |**************>|               |
        
   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       |               |               |
    |               |<..............|               |               |
    | (F12) XMPP    |               |               |               |
    | message       |               |               |               |
    |<..............|               |               |               |
    .               .               .               .               .
    .               .               .               .               .
    |               |               |               | (F13) SIP BYE |
    |               |               |               |<**************|
    |               |               | (F14) SIP BYE |               |
    |               |               |<**************|               |
    |               |               | (F15) SIP     |               |
    |               |               | 200 OK        |               |
    |               |               |**************>|               |
    |               |               |               | (F16) SIP     |
    |               |               |               | 200 OK        |
    |               |               |               |**************>|
        
    |               |               |               | (F8) SIP ACK  |
    |               |               |               |**************>|
    |               |               | (F9) MSRP SEND                |
    |               |               |******************************>|
    .               .               .               .               .
    .               .               .               .               .
    |               |               | (F10) MSRP SEND               |
    |               |               |<******************************|
    |               | (F11) XMPP    |               |               |
    |               | message       |               |               |
    |               |<..............|               |               |
    | (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

图1:XMPP到MSRP的事件顺序

The mapping of XMPP syntax to SIP syntax MUST be as specified in [RFC7572].

XMPP语法到SIP语法的映射必须符合[RFC7572]中的规定。

First, the XMPP user would generate an XMPP chat message.

首先,XMPP用户将生成一条XMPP聊天消息。

Example 1: Juliet Sends XMPP Message (F1)

示例1:Juliet发送XMPP消息(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>
        
   | <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

在接收到这样一个消息节时,XMPP服务器需要确定“to”地址中domainpart的标识,这是通过遵循[RFC7247]第5节中解释的过程来完成的。如果域是SIP域,XMPP服务器将

off the message stanza to an XMPP-to-SIP gateway or connection manager that natively communicates with MSRP-aware SIP servers.

关闭XMPP到SIP网关或连接管理器的消息节,该网关或连接管理器本机与支持MSRP的SIP服务器通信。

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

然后,XMPP服务器上的XMPP到SIP网关将代表朱丽叶启动与Romeo的MSRP会话(因为网关无法可靠地确定Romeo的客户端是否支持MSRP,如果不是这样,则MSRP会话启动可能会导致错误)。

Example 2: Gateway Starts SIP Session on Behalf of Juliet (F3)

示例2:网关代表Juliet(F3)启动SIP会话

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

这里我们假设Romeo的客户端支持MSRP,并且Romeo接受MSRP会话请求。

Example 3: Romeo Accepts Session Request (F5)

示例3:Romeo接受会话请求(F5)

   | SIP/2.0 200 OK
   | From: <sip:juliet@example.com>
   | To: <sip:romeo@example.net>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Call-ID: 29377446-0CBB-4296-8958-590D79094C50
   | CSeq: 1 INVITE
   | 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
        
   | SIP/2.0 200 OK
   | From: <sip:juliet@example.com>
   | To: <sip:romeo@example.net>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Call-ID: 29377446-0CBB-4296-8958-590D79094C50
   | CSeq: 1 INVITE
   | 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.

然后XMPP到SIP网关代表Juliet确认会话接受。

Example 4: Gateway Sends ACK to Romeo (F7)

示例4:网关向Romeo发送ACK(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
   | CSeq: 2 ACK
        
   | 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
   | CSeq: 2 ACK
        

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

然后,XMPP到SIP网关将原始XMPP聊天消息转换为MSRP。

Example 5: Gateway Maps XMPP Message to MSRP (F9)

示例5:网关将XMPP消息映射到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$
        
   | 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.

罗密欧可以使用他的MSRP客户端发送回复。

Example 6: Romeo Sends Reply (F10)

示例6:罗密欧发送回复(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$
        
   | 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.

SIP-to-XMPP网关随后将该消息转换为适当的XMPP语法,以便路由到预期的接收者。

Example 7: Gateway Maps MSRP Message to XMPP (F11)

示例7:网关将MSRP消息映射到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>
        
   | <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.

当MSRP用户希望结束聊天会话时,用户的MSRP客户端发送SIP BYE。

Example 8: Romeo Terminates Chat Session (F13)

示例8:Romeo终止聊天会话(F13)

   | BYE juliet@example.com 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: 3 BYE
   | Content-Length: 0
        
   | BYE juliet@example.com 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: 3 BYE
   | Content-Length: 0
        

The BYE is then acknowledged by the XMPP-to-SIP gateway.

然后XMPP到SIP网关确认BYE。

Example 9: Gateway Acknowledges Termination (F15)

示例9:网关确认终止(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
        
   | 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.

因为XMPP端没有正式会话,所以网关与XMPP用户之间没有相应的通信。然而,网关发送“消失”聊天状态通知[XEP-0085]是合理的,如第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).

此外,[RFC6121]中没有为XMPP用户定义明确的方法来正式终止聊天会话,因此网关需要监听来自XMPP用户的“消失”聊天状态通知,或者设置一个计时器,认为XMPP非正式聊天会话将在经过一段时间后结束([XEP-0085]建议如果用户在相当长的一段时间(例如10分钟)内没有与聊天会话界面、系统或设备进行交互,则生成“消失”的聊天状态。

5. MSRP to XMPP
5. MSRP到XMPP

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

当MSRP客户端通过网关向XMPP客户端发送消息时,事件顺序如下。

   SIP             SIP         MSRP-to-XMPP       XMPP            XMPP
   User           Server         Gateway         Server           User
    |               |               |               |               |
    | (F17) SIP     |               |               |               |
    | INVITE        |               |               |               |
    |**************>|               |               |               |
    |               | (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 |               |               |               |
    |**************>|               |               |               |
        
   SIP             SIP         MSRP-to-XMPP       XMPP            XMPP
   User           Server         Gateway         Server           User
    |               |               |               |               |
    | (F17) SIP     |               |               |               |
    | INVITE        |               |               |               |
    |**************>|               |               |               |
    |               | (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        |               |               |               |
    |<**************|               |               |               |
        
    |               | (F30) SIP BYE |               |               |
    |               |**************>|               |               |
    |               | (F31) SIP     |               |               |
    |               | 200 OK        |               |               |
    |               |<**************|               |               |
    | (F32) SIP     |               |               |               |
    | 200 OK        |               |               |               |
    |<**************|               |               |               |
        

Figure 2: MSRP to XMPP Order of Events

图2:MSRP到XMPP的事件顺序

The mapping of SIP syntax to XMPP syntax MUST be as specified in [RFC7572].

SIP语法到XMPP语法的映射必须符合[RFC7572]中的规定。

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

当罗密欧开始与朱丽叶聊天时,协议流程开始。

Example 10: Romeo Starts Chat Session (F17)

示例10:Romeo启动聊天会话(F17)

   | INVITE sip:juliet@example.com SIP/2.0
   | From: <sip:romeo@example.net>
   | To: <sip:juliet@example.com>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Subject: Open chat with Romeo?
   | Call-ID: F6989A8C-DE8A-4E21-8E07-F0898304796F
   | CSeq: 1 INVITE
   | 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
        
   | INVITE sip:juliet@example.com SIP/2.0
   | From: <sip:romeo@example.net>
   | To: <sip:juliet@example.com>
   | Contact: <sip:romeo@example.net>;gr=dr4hcr0st3lup4c
   | Subject: Open chat with Romeo?
   | Call-ID: F6989A8C-DE8A-4E21-8E07-F0898304796F
   | CSeq: 1 INVITE
   | 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.

收到邀请后,SIP(MSRP)服务器需要确定请求URI或to头的域部分的标识,这是通过遵循[RFC7247]第5节中解释的过程来完成的。如果域是XMPP域,SIP服务器将把邀请传递给与XMPP服务器进行本机通信的关联MSRP到XMPP网关或连接管理器。

Example 11: Gateway Accepts Session on Juliet's Behalf (F19)

示例11:网关代表朱丽叶接受会话(F19)

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

示例12:Romeo发送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
   | CSeq: 2 ACK
        
   | 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
   | CSeq: 2 ACK
        

Example 13: Romeo Sends Message (F23)

示例13:罗密欧发送消息(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$
        
   | 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)

示例14:MSRP到XMPP网关将MSRP消息映射到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>
        
   | <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>
        

Example 15: Juliet Sends Reply (F26)

示例15:Juliet发送回复(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>
        
   | <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)

示例16:网关将XMPP消息映射到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$
        
   | 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)

示例17:Romeo终止聊天会话(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: 3 BYE
   | Content-Length: 0
        
   | 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: 3 BYE
   | Content-Length: 0
        

Example 18: Gateway Acknowledges Termination of Session on Behalf of Juliet (F31)

示例18:网关代表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: 3 BYE
        
   | 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: 3 BYE
        
6. Composing Events
6. 撰写事件

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.

XMPP和MSRP都使客户机能够在一个人的对话伙伴在聊天会话上下文中编写即时消息时接收通知。

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

对于XMPP,聊天状态通知规范[XEP-0085]定义了五种状态:活动、非活动、消失、合成和暂停。其中一些状态与消息合成行为(合成、暂停)有关,而另一些状态与发送者参与聊天会话(活动、非活动、消失)有关。请注意,“Goe”聊天状态不能与[RFC6120]中定义的<Goe/>节错误条件混淆。

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

对于MSRP(一般来说,对于所谓的SIP即时消息和利用状态扩展(简单)系统),即时消息规范[RFC3994]的消息组合指示定义了两种状态:空闲和活动。在这里,空闲状态表示发送方没有在积极地撰写消息,而活动状态表示发送方确实在积极地撰写消息(发送客户端只是在这两种状态之间切换)。

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.

因为XEP-0085状态可以表示RFC 3994中未捕获的信息,所以网关可以(a)仅映射组成相关状态,或者(b)映射所有XEP-0085状态。

The following mappings are suggested.

建议使用以下映射。

Table 3: Mapping of SIP/SIMPLE isComposing Events to XMPP Chat states

表3:SIP/SIMPLE isComposing事件到XMPP聊天状态的映射

   +-------------------+--------------------+
   | isComposing Event |  Chat State        |
   +-------------------+--------------------+
   | active            |  composing         |
   | idle              |  active            |
   +-------------------+--------------------+
        
   +-------------------+--------------------+
   | isComposing Event |  Chat State        |
   +-------------------+--------------------+
   | active            |  composing         |
   | idle              |  active            |
   +-------------------+--------------------+
        

Table 4: Mapping of XMPP Chat States to SIP/SIMPLE isComposing Events

表4:XMPP聊天状态到SIP/SIMPLE isComposing事件的映射

   +-------------------+--------------------+
   | Chat State        | isComposing Event  |
   +-------------------+--------------------+
   | active            |  idle              |
   | inactive          |  idle              |
   | gone              |  none (Section 6.1)|
   | composing         |  active            |
   | paused            |  idle              |
   +-------------------+--------------------+
        
   +-------------------+--------------------+
   | Chat State        | isComposing Event  |
   +-------------------+--------------------+
   | active            |  idle              |
   | inactive          |  idle              |
   | gone              |  none (Section 6.1)|
   | composing         |  active            |
   | paused            |  idle              |
   +-------------------+--------------------+
        

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.

XMPP聊天状态通知规范[XEP-0085]允许在消息上下文之外发送“独立通知”,理论上甚至在交换任何消息之前;尽管网关因此可以在SIP用户接受或发起聊天会话时(即,在第4节中的F6之后或在第5节中的F22之后)向XMPP用户发送<active/>通知,但XMPP客户端可能会意外地使用此用法作为非正式聊天会话开始的信号。

6.1. Use of the Gone Chat State
6.1. 使用过去的聊天状态

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

尽管“gone”聊天状态没有直接映射到isComposing事件,但在XMPP到MSRP网关处接收到“gone”状态可以作为终止MSRP内正式聊天会话的触发器,即,用于将会话的SIP BYE从XMPP到MSRP网关发送给SIP用户。下面的示例说明了这种间接映射(例如,如果XMPP用户在图1中的步骤F12或图2中的步骤F28之后发送“gone”聊天状态通知,则会出现这种映射;在这两种情况中,会话将由XMPP用户而不是SIP用户终止,如图1和图2所示)。

Example 19: Juliet Sends Gone Chat State

例19:朱丽叶发送聊天状态

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

示例20:XMPP到MSRP网关将聊天状态映射到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: 3 BYE
   | Content-Length: 0
        
   | 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: 3 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 F14 in Figure 1 or step F30 in Figure 2).

类似地,在MSRP到XMPP网关处接收到SIP BYE消息可以作为向XMPP用户发送“消失”聊天状态通知的触发器。以下示例说明了这种间接映射(在图1中的步骤F14或图2中的步骤F30之后发生)。

Example 21: Romeo Terminates Chat Session

例21:Romeo终止聊天会话

   | 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: 3 BYE
   | Content-Length: 0
        
   | 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: 3 BYE
   | Content-Length: 0
        

Example 22: MSRP-to-XMPP Gateway Generates Gone Chat State

示例22:MSRP到XMPP网关生成聊天状态

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

为了实现这些用途,支持聊天状态通知的网关必须支持“gone”状态(这只是[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).

如果XMPP用户在给定的时间段内没有在“会话”中发送消息,网关也可以实现计时器,自动触发“gone”聊天状态([XEP-0085]建议生成“gone”聊天状态(如果用户在相当长的时间内(例如10分钟)未与聊天会话界面、系统或设备进行交互)。

7. Delivery Reports
7. 交付报告

Both XMPP and MSRP enable a client to receive notifications when a message has been received by the intended recipient.

XMPP和MSRP都允许客户端在预期收件人收到消息时接收通知。

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.

对于XMPP,消息接收规范[XEP-0184]定义了一个方法和XML名称空间,用于请求和返回消息已由预期收件人控制的客户端接收的指示。

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

对于MSRP,以报告块的形式包含本机报告功能(见[RFC4975]第7.1.2节和第7.1.3节)。

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

element of <received xmlns='urn:xmpp:receipts'/> is to be mapped to an MSRP REPORT request.

<received xmlns='urn:xmpp:receipts'/>的元素将映射到MSRP报告请求。

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'/>.

MSRP发送请求中值为“yes”的成功报告头字段将映射到<request xmns='urn:XMPP:Receipts'/>的XMPP消息接收元素,MSRP报告请求将映射到仅包含<received xmns='urn:XMPP:Receipts'/>的消息接收元素的XMPP消息。

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

由于XMPP消息接收规范不支持故障报告,因此MSRP故障报告头字段没有映射,网关应将该头字段设置为“否”。

Examples follow.

下面是一些例子。

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

首先,XMPP用户发送一条包含传递通知请求的消息。

Example 23: Juliet Sends XMPP Message with Receipt Request

示例23:Juliet发送带有接收请求的XMPP消息

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

Example 24: Gateway Maps XMPP Message to MSRP

示例24:网关将XMPP消息映射到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$
        
   | 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

示例25:Romeo返回MSRP收据

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

示例26:MSRP到XMPP网关将接收映射到XMPP

   | <message from='romeo@example.net'
   |          id='hx74g336'
   |          to='juliet@example.com'>
   |   <received xmlns='urn:xmpp:receipts' id='87652491'/>
   | </message>
        
   | <message from='romeo@example.net'
   |          id='hx74g336'
   |          to='juliet@example.com'>
   |   <received xmlns='urn:xmpp:receipts' id='87652491'/>
   | </message>
        
8. Message Size
8. 消息大小

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

与页面模式消息[RFC3428](指定消息请求的大小不允许超过1300字节)不同,会话模式消息[RFC4975]可用于发送更大的消息。MSRP包括一个分块机制,这样较大的消息可以被分成多个MSRP发送请求。由于XMPP服务中的MSRP网关充当MSRP端点,因此它负责接收分块消息并将其重新构建为单个消息,以便向XMPP收件人传递。(当然,实现需要小心接受非常大的消息;请参阅[RFC4975]的第14.5节。)

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.

尽管XMPP节的大小没有硬性限制,但实际上,大多数XMPP服务(至少在公共Internet上)都配置了最大节大小,以帮助防止拒绝服务攻击。根据[RFC6120]第13.12节的规定,该最大值不允许小于10000字节。

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.

XMPP服务的管理员需要确保关联的MSRP网关配置为与最大XMPP节大小相同或更小的最大MSRP消息大小;这使网关能够为会话描述协议(SDP)“最大大小”属性返回适当的值(参见[RFC4975]第8.6节),并正确处理大于配置限制的传入消息。

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

如果MSRP到XMPP网关实现接收到的MSRP消息超过了刚才描述的配置限制,则必须返回MSRP 413错误(例如,响应第一个发送请求,其字节范围标头字段指示字节总数超过限制)。

9. Internationalization Considerations
9. 国际化考虑

Relevant discussion of internationalized text in messages can be found in [RFC7572].

有关消息中国际化文本的相关讨论,请参见[RFC7572]。

10. Security Considerations
10. 安全考虑

Detailed security considerations are given in the following documents:

以下文件中给出了详细的安全注意事项:

o For instant messaging protocols in general, see [RFC2779]

o 有关即时消息协议的一般信息,请参见[RFC2779]

o For MSRP chat, see [RFC4975]; for when SIP is used to negotiate MSRP sessions, see [RFC3261]

o MSRP聊天请参见[RFC4975];有关何时使用SIP协商MSRP会话,请参阅[RFC3261]

o For XMPP-based instant messaging, see [RFC6121] and also [RFC6120]

o 有关基于XMPP的即时消息,请参见[RFC6121]和[RFC6120]

o For SIP-XMPP interworking in general, see [RFC7247]

o 有关SIP-XMPP互通的一般信息,请参见[RFC7247]

o For end-to-end encryption of instant messages, see [RFC7572]

o 有关即时消息的端到端加密,请参阅[RFC7572]

11. References
11. 工具书类
11.1. Normative References
11.1. 规范性引用文件

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <http://www.rfc-editor.org/info/rfc2119>.

[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,DOI 10.17487/RFC2119,1997年3月<http://www.rfc-editor.org/info/rfc2119>.

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

[RFC3261]Rosenberg,J.,Schulzrinne,H.,Camarillo,G.,Johnston,A.,Peterson,J.,Sparks,R.,Handley,M.,和E.Schooler,“SIP:会话启动协议”,RFC 3261,DOI 10.17487/RFC3261,2002年6月<http://www.rfc-editor.org/info/rfc3261>.

[RFC3994] Schulzrinne, H., "Indication of Message Composition for Instant Messaging", RFC 3994, DOI 10.17487/RFC3994, January 2005, <http://www.rfc-editor.org/info/rfc3994>.

[RFC3994]Schulzrinne,H.,“即时消息的消息组合指示”,RFC 3994,DOI 10.17487/RFC3994,2005年1月<http://www.rfc-editor.org/info/rfc3994>.

[RFC4975] Campbell, B., Ed., Mahy, R., Ed., and C. Jennings, Ed., "The Message Session Relay Protocol (MSRP)", RFC 4975, DOI 10.17487/RFC4975, September 2007, <http://www.rfc-editor.org/info/rfc4975>.

[RFC4975]Campbell,B.,Ed.,Mahy,R.,Ed.,和C.Jennings,Ed.,“消息会话中继协议(MSRP)”,RFC 4975,DOI 10.17487/RFC4975,2007年9月<http://www.rfc-editor.org/info/rfc4975>.

[RFC6120] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Core", RFC 6120, DOI 10.17487/RFC6120, March 2011, <http://www.rfc-editor.org/info/rfc6120>.

[RFC6120]Saint Andre,P.,“可扩展消息和状态协议(XMPP):核心”,RFC 6120,DOI 10.17487/RFC6120,2011年3月<http://www.rfc-editor.org/info/rfc6120>.

[RFC6121] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence", RFC 6121, DOI 10.17487/RFC6121, March 2011, <http://www.rfc-editor.org/info/rfc6121>.

[RFC6121]Saint Andre,P.,“可扩展消息和状态协议(XMPP):即时消息和状态”,RFC 6121DOI 10.17487/RFC6121,2011年3月<http://www.rfc-editor.org/info/rfc6121>.

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

[RFC7247]Saint Andre,P.,Houri,A.,和J.Hildebrand,“会话启动协议(SIP)和可扩展消息和状态协议(XMPP)之间的互通:体系结构、地址和错误处理”,RFC 7247,DOI 10.17487/RFC7247,2014年5月<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>.

[RFC7572]Saint Andre,P.,Houri,A.,和J.Hildebrand,“会话启动协议(SIP)和可扩展消息和状态协议(XMPP)之间的互通:即时消息传递”,RFC 7572,DOI 10.17487/RFC7572,2015年6月<http://www.rfc-editor.org/info/rfc7572>.

[XEP-0085] Saint-Andre, P. and D. Smith, "Chat State Notifications", XSF XEP 0085, September 2009.

[XEP-0085]Saint Andre,P.和D.Smith,“聊天状态通知”,XSF XEP 00852009年9月。

[XEP-0184] Saint-Andre, P. and J. Hildebrand, "Message Delivery Receipts", XSF XEP 0184, March 2011.

[XEP-0184]Saint Andre,P.和J.Hildebrand,“邮件交付收据”,XSF XEP 0184,2011年3月。

11.2. Informative References
11.2. 资料性引用

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

[GROUPCHAT]Saint Andre,P.,Corretge,S.,和S.Loreto,“会话启动协议(SIP)和可扩展消息和状态协议(XMPP)之间的互通:GROUPCHAT”,正在进行的工作,草稿-ietf-stox-GROUPCHAT-11,2015年3月。

[RFC2779] Day, M., Aggarwal, S., Mohr, G., and J. Vincent, "Instant Messaging / Presence Protocol Requirements", RFC 2779, DOI 10.17487/RFC2779, February 2000, <http://www.rfc-editor.org/info/rfc2779>.

[RFC2779]Day,M.,Aggarwal,S.,Mohr,G.,和J.Vincent,“即时消息传递/存在协议要求”,RFC 2779,DOI 10.17487/RFC27792000年2月<http://www.rfc-editor.org/info/rfc2779>.

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

[RFC3428]Campbell,B.,Ed.,Rosenberg,J.,Schulzrinne,H.,Huitema,C.,和D.Gurle,“即时消息的会话启动协议(SIP)扩展”,RFC 3428,DOI 10.17487/RFC3428,2002年12月<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.

特别感谢Eddy Gavita和Nazin Hossain共同撰写本文件的早期草稿。

Thanks to Mary Barnes, Ben Campbell, Dave Crocker, Adrian Georgescu, Philipp Hancke, Saul Ibarra Corretge, Tory Patnoe, and Matt Ryan for their feedback.

感谢Mary Barnes、Ben Campbell、Dave Crocker、Adrian Georgescu、Philipp Hancke、Saul Ibarra Corretge、Tory Patnoe和Matt Ryan的反馈。

Stephen Farrell, Brian Haberman, Joel Jaeggli, Barry Leiba, Kathleen Moriarty, and Pete Resnick provided helpful input during IESG review.

Stephen Farrell、Brian Haberman、Joel Jaeggli、Barry Leiba、Kathleen Moriarty和Pete Resnick在IESG审查期间提供了有用的意见。

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.

作者衷心感谢工作组主席Markus Isomaki和Yana Stamcheva以及赞助区域主任Gonzalo Camarillo和Alissa Cooper的协助。

Peter Saint-Andre wishes to acknowledge Cisco Systems, Inc., for employing him during his work on earlier draft versions of this document.

Peter Saint Andre希望感谢Cisco Systems,Inc.在编写本文件早期草稿期间聘用了他。

Authors' Addresses

作者地址

Peter Saint-Andre &yet

彼得·圣安德烈&还没有

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

Salvatore Loreto Ericsson Hirsalantie 11 Jorvas 02420 Finland

萨尔瓦托·洛雷托·爱立信·赫萨兰蒂11 Jorvas 02420芬兰

   EMail: Salvatore.Loreto@ericsson.com
        
   EMail: Salvatore.Loreto@ericsson.com