Internet Engineering Task Force (IETF)                    P. Saint-Andre
Request for Comments: 7248                                          &yet
Category: Standards Track                                       A. Houri
ISSN: 2070-1721                                                      IBM
                                                           J. Hildebrand
                                                     Cisco Systems, Inc.
                                                                May 2014
        
Internet Engineering Task Force (IETF)                    P. Saint-Andre
Request for Comments: 7248                                          &yet
Category: Standards Track                                       A. Houri
ISSN: 2070-1721                                                      IBM
                                                           J. Hildebrand
                                                     Cisco Systems, Inc.
                                                                May 2014
        

Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Presence

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

Abstract

摘要

This document defines a bidirectional protocol mapping for the exchange of presence information between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP).

本文档定义了一个双向协议映射,用于在会话启动协议(SIP)和可扩展消息和状态协议(XMPP)之间交换状态信息。

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

有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc7248.

Copyright Notice

版权公告

Copyright (c) 2014 IETF Trust and the persons identified as the document authors. All rights reserved.

版权所有(c)2014 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 .....................................................3
   4. Subscriptions to Presence Information ...........................4
      4.1. Overview ...................................................4
      4.2. XMPP to SIP ................................................5
           4.2.1. Establishing a Presence Subscription ................5
           4.2.2. Refreshing a Presence Subscription ..................9
           4.2.3. Cancelling a Presence Subscription .................10
      4.3. SIP to XMPP ...............................................12
           4.3.1. Establishing a Presence Subscription ...............12
           4.3.2. Refreshing a Presence Subscription .................14
           4.3.3. Cancelling a Presence Subscription .................17
   5. Notifications of Presence Information ..........................17
      5.1. Overview ..................................................17
      5.2. XMPP to SIP ...............................................19
      5.3. SIP to XMPP ...............................................22
   6. Requests for Presence Information ..............................24
      6.1. XMPP to SIP ...............................................24
      6.2. SIP to XMPP ...............................................25
   7. Security Considerations ........................................26
   8. References .....................................................27
      8.1. Normative References ......................................27
      8.2. Informative References ....................................27
   Appendix A. Acknowledgements ......................................29
        
   1. Introduction ....................................................2
   2. Intended Audience ...............................................3
   3. Terminology .....................................................3
   4. Subscriptions to Presence Information ...........................4
      4.1. Overview ...................................................4
      4.2. XMPP to SIP ................................................5
           4.2.1. Establishing a Presence Subscription ................5
           4.2.2. Refreshing a Presence Subscription ..................9
           4.2.3. Cancelling a Presence Subscription .................10
      4.3. SIP to XMPP ...............................................12
           4.3.1. Establishing a Presence Subscription ...............12
           4.3.2. Refreshing a Presence Subscription .................14
           4.3.3. Cancelling a Presence Subscription .................17
   5. Notifications of Presence Information ..........................17
      5.1. Overview ..................................................17
      5.2. XMPP to SIP ...............................................19
      5.3. SIP to XMPP ...............................................22
   6. Requests for Presence Information ..............................24
      6.1. XMPP to SIP ...............................................24
      6.2. SIP to XMPP ...............................................25
   7. Security Considerations ........................................26
   8. References .....................................................27
      8.1. Normative References ......................................27
      8.2. Informative References ....................................27
   Appendix A. Acknowledgements ......................................29
        
1. Introduction
1. 介绍

In order to help ensure interworking between presence systems that conform to the instant message / presence requirements [RFC2779], it is important to clearly define protocol mappings between such systems. Within the IETF, work has proceeded on two presence technologies:

为了帮助确保符合即时消息/状态需求[RFC2779]的状态系统之间的互通,必须明确定义此类系统之间的协议映射。在IETF内,两项存在技术的工作正在进行:

o Various extensions to the Session Initiation Protocol ([RFC3261]) for presence, in particular [RFC3856]

o 会话启动协议([RFC3261])的各种存在扩展,特别是[RFC3856]

o The Extensible Messaging and Presence Protocol (XMPP), which consists of a formalization of the core XML streaming protocols developed originally by the Jabber open-source community; the relevant specifications are [RFC6120] for the XML streaming layer and [RFC6121] for basic presence and instant-messaging extensions

o 可扩展消息和状态协议(XMPP),它由最初由Jabber开源社区开发的核心XML流协议的形式化组成;XML流媒体层的相关规范为[RFC6120],基本状态和即时消息扩展的相关规范为[RFC6121]

One approach to helping ensure interworking between these protocols is to map each protocol to the abstract semantics described in [RFC3860]; although that is the approach taken by both [RFC3922] and

帮助确保这些协议之间互通的一种方法是将每个协议映射到[RFC3860]中描述的抽象语义;尽管[RFC3922]和

[SIMPLE-CPIM-MAPPING], to the best of our knowledge that approach has never been implemented. The approach taken in this document is to directly map semantics from one protocol to another (i.e., from SIP/ SIMPLE (SIP for Instant Messaging and Presence Leveraging Extensions) to XMPP and vice versa), since that is how existing systems solve the interworking problem.

[SIMPLE-CPIM-MAPPING],据我们所知,该方法从未实施过。本文档中采用的方法是直接将语义从一个协议映射到另一个协议(即,从SIP/SIMPLE(SIP用于即时消息传递和状态利用扩展)映射到XMPP,反之亦然),因为这是现有系统解决互通问题的方式。

The architectural assumptions underlying such direct mappings are provided in [RFC7247], including mapping of addresses and error conditions. The mappings specified in this document cover basic presence functionality. Mapping of more advanced functionality (e.g., so-called "rich presence") is out of scope for this document.

[RFC7247]中提供了此类直接映射的基础架构假设,包括地址映射和错误条件。本文档中指定的映射包括基本的状态信息功能。更高级功能的映射(例如,所谓的“丰富存在”)超出了本文档的范围。

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 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 presence-related specifications:

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

o "A Presence Event Package for the Session Initiation Protocol (SIP)" [RFC3856]

o “会话启动协议(SIP)的状态事件包”[RFC3856]

o "Presence Information Data Format (PIDF)" [RFC3863]

o “状态信息数据格式(PIDF)”[RFC3863]

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

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

o "SIP-Specific Event Notification" [RFC6665]

o “SIP特定事件通知”[RFC6665]

3. Terminology
3. 术语

A number of terms used here (user, contact, subscription, notification, etc.) are explained in [RFC3261], [RFC3856], [RFC6120], and [RFC6121]. This document uses some, but not all, of the terms defined in the Model for Presence and Instant Messaging [RFC2778].

[RFC3261]、[RFC3856]、[RFC6120]和[RFC6121]中解释了此处使用的许多术语(用户、联系人、订阅、通知等)。本文档使用了模型中为状态和即时消息[RFC2778]定义的部分术语,但不是全部术语。

   In flow diagrams, SIP traffic is shown using arrows such as "***>",
   whereas XMPP traffic is shown using arrows such as "...>".
        
   In flow diagrams, SIP 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. Subscriptions to Presence Information
4. 对状态信息的订阅
4.1. Overview
4.1. 概述

Both XMPP and presence-aware SIP systems enable entities (often, but not necessarily, human users) to subscribe to the presence of other entities. XMPP presence subscriptions are specified in [RFC6121]. Presence subscriptions using a SIP event package for presence are specified in [RFC3856].

XMPP和感知状态的SIP系统都允许实体(通常但不一定是人类用户)订阅其他实体的状态。[RFC6121]中指定了XMPP状态订阅。[RFC3856]中指定了使用SIP事件包进行状态订阅的状态。

As described in [RFC6121], XMPP presence subscriptions are managed using XMPP <presence/> stanzas of type "subscribe", "subscribed", "unsubscribe", and "unsubscribed". The main subscription states are:

如[RFC6121]所述,XMPP状态订阅使用类型为“订阅”、“订阅”、“取消订阅”和“取消订阅”的XMPP<presence/>节进行管理。主要订阅状态为:

o "none" (neither the user nor the contact is subscribed to the other's presence information)

o “无”(用户和联系人均未订阅对方的状态信息)

o "from" (the user has a subscription from the contact)

o “发件人”(用户已从联系人处订阅)

o "to" (the user has a subscription to the contact's presence information)

o “to”(用户订阅了联系人的状态信息)

o "both" (both user and contact are subscribed to each other's presence information)

o “两者”(用户和联系人都订阅了对方的状态信息)

As described in [RFC3856], SIP presence subscriptions are managed through the use of SIP SUBSCRIBE events sent from a SIP user agent to an intended recipient who is most generally referenced by a Presence URI of the form <pres:user@domain> but who might be referenced by a SIP or SIPS (Session Initiation Protocol Secure) URI of the form <sip:user@domain> or <sips:user@domain>. In practice, 'pres' URIs are rarely used, which is why the examples in this document use 'sip' URIs.

如[RFC3856]中所述,SIP状态订阅通过使用SIP用户代理发送给预期接收者的SIP订阅事件进行管理,该接收者通常由形式为<pres:user@domain>但是SIP或SIPS(会话启动协议安全)可能引用谁格式为<sip:user@domain>或<sips:user@domain>. 实际上,很少使用“pres”uri,这就是本文中的示例使用“sip”uri的原因。

The subscription models underlying XMPP and SIP differ mainly in the fact that XMPP presence subscriptions are long-lived (indeed permanent if not explicitly cancelled, so that a subscription need never be refreshed during any given presence "session"), whereas SIP presence subscriptions are short-lived (the default time-to-live of a SIP presence subscription is 3600 seconds, as specified in Section 6.4 of [RFC3856], so that a subscription needs to be explicitly refreshed if it will have the appearance of being permanent or even of lasting as long as the duration of a presence "session"). This disparity has implications for the handling of subscription cancellations in either direction and, from the SIP side, subscription refreshes.

XMPP和SIP的订阅模型主要不同之处在于,XMPP状态订阅是长期存在的(如果没有明确取消,则实际上是永久的,因此在任何给定的状态“会话”期间都不需要刷新订阅),而SIP状态订阅是短期存在的(根据[RFC3856]第6.4节的规定,SIP状态订阅的默认生存时间为3600秒,因此,如果订阅的外观是永久性的,甚至与状态“会话”的持续时间一样长,则需要显式刷新订阅)。这种差异对处理任何方向的订阅取消以及SIP端的订阅刷新都有影响。

4.2. XMPP to SIP
4.2. XMPP到SIP
4.2.1. Establishing a Presence Subscription
4.2.1. 建立状态订阅

The following diagram illustrates the protocol flow for establishing a presence subscription from an XMPP user to a SIP user, as further explained in the text and examples after the diagram.

下图说明了用于建立从XMPP用户到SIP用户的状态订阅的协议流,如图后的文本和示例中进一步解释的。

   XMPP       XMPP      XMPP-to-SIP    SIP-to-XMPP     SIP          SIP
   User      Server      Gateway        Gateway       Server        User
    |           |            |              |            |           |
    | (F1) XMPP |            |              |            |           |
    | subscribe |            |              |            |           |
    |..........>|            |              |            |           |
    |           | (F2) XMPP  |              |            |           |
    |           | subscribe  |              |            |           |
    |           |...........>|              |            |           |
    |           |            | (F3) SIP SUBSCRIBE        |           |
    |           |            |**************************>|           |
    |           |            |              |            | (F4) SIP  |
    |           |            |              |            | SUBSCRIBE |
    |           |            |              |            |**********>|
    |           |            |              |            | (F5) SIP  |
    |           |            |              |            | 200 OK    |
    |           |            |              | (F6) SIP   |<**********|
    |           |            |              | 200 OK     | (F7) SIP  |
    |           |            |              |<***********| NOTIFY    |
    |           |            |              |            |<**********|
    |           |            |              | (F8) SIP   |           |
    |           |            |              | NOTIFY     |           |
    |           |            |              |<***********|           |
    |           |            |              | (F9) SIP   |           |
    |           |            |              | 200 OK     |           |
    |           |            |              |***********>|           |
    |           |            |              |            | (F10) SIP |
    |           |    (F11) XMPP subscribed  |            | 200 OK    |
    |           |<..........................|            |**********>|
    |           |    (F12) XMPP presence    |            |           |
    |           |<..........................|            |           |
    | (F13) XMPP|            |              |            |           |
    | subscribed|            |              |            |           |
    |<..........|            |              |            |           |
    | (F14) XMPP|            |              |            |           |
    | presence  |            |              |            |           |
    |<..........|            |              |            |           |
        
   XMPP       XMPP      XMPP-to-SIP    SIP-to-XMPP     SIP          SIP
   User      Server      Gateway        Gateway       Server        User
    |           |            |              |            |           |
    | (F1) XMPP |            |              |            |           |
    | subscribe |            |              |            |           |
    |..........>|            |              |            |           |
    |           | (F2) XMPP  |              |            |           |
    |           | subscribe  |              |            |           |
    |           |...........>|              |            |           |
    |           |            | (F3) SIP SUBSCRIBE        |           |
    |           |            |**************************>|           |
    |           |            |              |            | (F4) SIP  |
    |           |            |              |            | SUBSCRIBE |
    |           |            |              |            |**********>|
    |           |            |              |            | (F5) SIP  |
    |           |            |              |            | 200 OK    |
    |           |            |              | (F6) SIP   |<**********|
    |           |            |              | 200 OK     | (F7) SIP  |
    |           |            |              |<***********| NOTIFY    |
    |           |            |              |            |<**********|
    |           |            |              | (F8) SIP   |           |
    |           |            |              | NOTIFY     |           |
    |           |            |              |<***********|           |
    |           |            |              | (F9) SIP   |           |
    |           |            |              | 200 OK     |           |
    |           |            |              |***********>|           |
    |           |            |              |            | (F10) SIP |
    |           |    (F11) XMPP subscribed  |            | 200 OK    |
    |           |<..........................|            |**********>|
    |           |    (F12) XMPP presence    |            |           |
    |           |<..........................|            |           |
    | (F13) XMPP|            |              |            |           |
    | subscribed|            |              |            |           |
    |<..........|            |              |            |           |
    | (F14) XMPP|            |              |            |           |
    | presence  |            |              |            |           |
    |<..........|            |              |            |           |
        

An XMPP user (e.g., juliet@example.com) initiates a subscription by sending a subscription request to a contact (e.g., romeo@example.net), and the contact either accepts or declines the request. If the contact accepts the request, the user will have a subscription to the contact's presence information until (1) the user unsubscribes or (2) the contact cancels the subscription. The subscription request is encapsulated in a <presence/> stanza of type "subscribe":

XMPP用户(例如:。,juliet@example.com)通过向联系人发送订阅请求(例如。,romeo@example.net),联系人接受或拒绝请求。如果联系人接受请求,用户将订阅联系人的状态信息,直到(1)用户取消订阅或(2)联系人取消订阅。订阅请求封装在类型为“subscribe”的<presence/>节中:

Example 1: XMPP User Subscribes to SIP Contact (F1)

示例1:XMPP用户订阅SIP联系人(F1)

   |  <presence from='juliet@example.com'
   |            to='romeo@example.net'
   |            type='subscribe'/>
        
   |  <presence from='juliet@example.com'
   |            to='romeo@example.net'
   |            type='subscribe'/>
        

Upon receiving such a <presence/> stanza, the XMPP server to which Juliet has connected 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 off the <presence/> stanza to an associated XMPP-to-SIP gateway or connection manager that natively communicates with presence-aware SIP servers.

在收到这样一个<presence/>节时,Juliet所连接的XMPP服务器需要确定“to”地址中domainpart的身份,这是通过遵循[RFC7247]第5节中解释的程序来实现的。如果域是SIP域,XMPP服务器将把<presence/>节移交给关联的XMPP-to-SIP网关或连接管理器,该网关或连接管理器本机与感知状态的SIP服务器进行通信。

The XMPP-to-SIP gateway is then responsible for translating the XMPP subscription request into a SIP SUBSCRIBE request addressed from the XMPP user to the SIP user:

然后,XMPP到SIP网关负责将XMPP订阅请求转换为从XMPP用户到SIP用户的SIP订阅请求:

Example 2: SIP Transformation of XMPP Subscription Request (F3)

示例2:XMPP订阅请求的SIP转换(F3)

   |  SUBSCRIBE sip:romeo@example.net SIP/2.0
   |  Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=ffd2
   |  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 123 SUBSCRIBE
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Accept: application/pidf+xml
   |  Expires: 3600
   |  Content-Length: 0
        
   |  SUBSCRIBE sip:romeo@example.net SIP/2.0
   |  Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=ffd2
   |  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 123 SUBSCRIBE
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Accept: application/pidf+xml
   |  Expires: 3600
   |  Content-Length: 0
        

Once the XMPP-to-SIP gateway has passed the SIP SUBSCRIBE off to the SIP server (via the SIP-to-XMPP gateway) and the SIP server has delivered the SIP SUBSCRIBE to the SIP user (F3 and F4; no example shown for F4), the SIP user would then send a response indicating acceptance of the subscription request:

一旦XMPP-to-SIP网关将SIP订阅传递给SIP服务器(通过SIP-to-XMPP网关),并且SIP服务器已将SIP订阅传递给SIP用户(F3和F4;没有显示F4的示例),SIP用户随后将发送指示接受订阅请求的响应:

Example 3: SIP Accepts Subscription Request (F6)

示例3:SIP接受订阅请求(F6)

   |  SIP/2.0 200 OK
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=ffd2
   |  To: <sip:juliet@example.com>;tag=j89d
   |  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
   |  CSeq: 234 SUBSCRIBE
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Expires: 3600
   |  Content-Length: 0
        
   |  SIP/2.0 200 OK
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=ffd2
   |  To: <sip:juliet@example.com>;tag=j89d
   |  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
   |  CSeq: 234 SUBSCRIBE
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Expires: 3600
   |  Content-Length: 0
        

In accordance with [RFC6665], the XMPP-to-SIP gateway SHOULD consider the subscription state to be "neutral" until it receives a NOTIFY message. Therefore, the SIP user or SIP-to-XMPP gateway at the SIP user's domain SHOULD immediately send a NOTIFY message containing a Subscription-State header whose value contains the string "active" (see Section 5).

根据[RCF6665 ],XMPP到SIP网关应该考虑订阅状态是“中立”的,直到它接收到通知消息。因此,SIP用户域中的SIP用户或SIP-to-XMPP网关应立即发送包含订阅状态头的通知消息,该订阅状态头的值包含字符串“active”(参见第5节)。

Example 4: SIP User Sends Presence Notification (F7)

示例4:SIP用户发送状态通知(F7)

   |  NOTIFY sip:192.0.2.1 SIP/2.0
   |  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=yt66
   |  To: <sip:juliet@example.com>;tag=bi54
   |  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
   |  Event: presence
   |  Subscription-State: active;expires=499
   |  Max-Forwards: 70
   |  CSeq: 8775 NOTIFY
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 193
   |
   |  <?xml version='1.0' encoding='UTF-8'?>
   |  <presence xmlns='urn:ietf:params:xml:ns:pidf'
   |            entity='pres:romeo@example.net'>
   |    <tuple id='ID-orchard'>
   |      <status>
   |        <basic>open</basic>
   |        <show xmlns='jabber:client'>away</show>
   |      </status>
   |    </tuple>
   |  </presence>
        
   |  NOTIFY sip:192.0.2.1 SIP/2.0
   |  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=yt66
   |  To: <sip:juliet@example.com>;tag=bi54
   |  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
   |  Event: presence
   |  Subscription-State: active;expires=499
   |  Max-Forwards: 70
   |  CSeq: 8775 NOTIFY
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 193
   |
   |  <?xml version='1.0' encoding='UTF-8'?>
   |  <presence xmlns='urn:ietf:params:xml:ns:pidf'
   |            entity='pres:romeo@example.net'>
   |    <tuple id='ID-orchard'>
   |      <status>
   |        <basic>open</basic>
   |        <show xmlns='jabber:client'>away</show>
   |      </status>
   |    </tuple>
   |  </presence>
        

In response, the presence-aware SIP-to-XMPP gateway would send a 200 OK to the SIP user (not shown here, since it is not translated into an XMPP stanza).

作为响应,感知状态的SIP-to-XMPP网关将向SIP用户发送200ok(此处未显示,因为它未转换为XMPP节)。

Upon receiving the first NOTIFY with a subscription state of active, the XMPP-to-SIP gateway MUST generate a <presence/> stanza of type "subscribed":

在收到订阅状态为active的第一个通知后,XMPP-to-SIP网关必须生成类型为“subscribed”的<presence/>节:

Example 5: XMPP User Receives Acknowledgement from SIP Contact (F13)

示例5:XMPP用户从SIP联系人(F13)接收确认

   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='subscribed'/>
        
   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='subscribed'/>
        

As described in Section 5, the gateway MUST also generate a presence notification addressed to the XMPP user:

如第5节所述,网关还必须生成发送给XMPP用户的状态通知:

Example 6: XMPP User Receives Presence Notification from SIP Contact (F14)

示例6:XMPP用户从SIP联系人(F14)接收状态通知

   |  <presence from='romeo@example.net/orchard'
   |            to='juliet@example.com'/>
        
   |  <presence from='romeo@example.net/orchard'
   |            to='juliet@example.com'/>
        
4.2.2. Refreshing a Presence Subscription
4.2.2. 刷新状态订阅

It is the responsibility of the XMPP-to-SIP gateway to set the value of the Expires header and to periodically renew the subscription on the SIP side of the gateway so that the subscription appears to be permanent to the XMPP user. For example, the XMPP-to-SIP gateway SHOULD send a new SUBSCRIBE request to the SIP user whenever the XMPP user initiates a presence session with the XMPP server by sending initial presence to its XMPP server. The XMPP-to-SIP gateway also SHOULD send a new SUBSCRIBE request to the SIP user whenever the SIP presence subscription is scheduled to expire during the XMPP user's active presence session.

XMPP-to-SIP网关负责设置Expires报头的值,并在网关的SIP端定期续订,以便该订阅对XMPP用户来说是永久性的。例如,每当XMPP用户通过向其XMPP服务器发送初始状态来启动与XMPP服务器的状态会话时,XMPP到SIP网关应向SIP用户发送新的订阅请求。每当SIP状态订阅计划在XMPP用户的活动状态会话期间过期时,XMPP到SIP网关还应向SIP用户发送新的订阅请求。

The rules regarding SIP SUBSCRIBE requests for the purpose of establishing and refreshing a presence subscription are provided in [RFC6665]. Those rules also apply to XMPP-to-SIP gateways. Furthermore, an XMPP-to-SIP gateway MUST consider the XMPP subscription to be permanently cancelled (and so inform the XMPP user) if it receives a SIP response of 403, 489, or 603. By contrast, it is appropriate to consider a SIP response of 423 or 481 to be a transient error and to maintain the long-lived XMPP presence subscription. [RFC6665] explains more detailed considerations about the handling of SIP responses in relation to subscription requests and refreshes.

[RFC6665]中提供了有关建立和刷新状态订阅的SIP订阅请求的规则。这些规则也适用于XMPP到SIP网关。此外,XMPP到SIP网关必须考虑XMPP订阅被永久取消(并且因此通知XMPP用户),如果它接收到403, 489或603的SIP响应。相比之下,考虑423或481的SIP响应是暂时性错误,并维持长寿命XMPP存在订阅是合适的。[RFC6665]解释了与订阅请求和刷新相关的SIP响应处理的更详细注意事项。

Finally, see the security considerations section (Section 7) of this document for important information and requirements regarding the security implications of subscription refreshes.

最后,有关订阅刷新的安全影响的重要信息和要求,请参阅本文档的安全注意事项部分(第7节)。

4.2.3. Cancelling a Presence Subscription
4.2.3. 取消状态订阅

The following diagram illustrates the protocol flow for cancelling an XMPP user's presence subscription to a SIP user, as further explained in the text and examples after the diagram.

下图说明了用于取消XMPP用户对SIP用户的状态订阅的协议流,如图后的文本和示例所述。

   XMPP       XMPP      XMPP-to-SIP    SIP-to-XMPP     SIP          SIP
   User      Server      Gateway        Gateway       Server        User
    |           |            |              |            |           |
    | (F15) XMPP|            |              |            |           |
    |unsubscribe|            |              |            |           |
    |..........>|            |              |            |           |
    |           | (F16) XMPP |              |            |           |
    |           | unsubscribe|              |            |           |
    |           |...........>|              |            |           |
    |           |            | (F17) SIP SUBSCRIBE       |           |
    |           |            | Expires: 0   |            |           |
    |           |            |**************************>|           |
    |           |            |              |            | (F18) SIP |
    |           |            |              |            | SUBSCRIBE |
    |           |            |              |            | Expires: 0|
    |           |            |              |            |**********>|
    |           |            |              |            | (F19) SIP |
    |           |            |              |            | 200 OK    |
    |           |            |              |            |<**********|
    |           |            |              | (F20) SIP  |           |
    |           |            |              | 200 OK     |           |
    |           |            |              |<***********|           |
    |           |  (F21) XMPP unsubscribed  |            |           |
    |           |<..........................|            |           |
    | (F22) XMPP|            |              |            |           |
    | unsubscribed           |              |            |           |
    |<..........|            |              |            |           |
    |           |            |              |            |           |
        
   XMPP       XMPP      XMPP-to-SIP    SIP-to-XMPP     SIP          SIP
   User      Server      Gateway        Gateway       Server        User
    |           |            |              |            |           |
    | (F15) XMPP|            |              |            |           |
    |unsubscribe|            |              |            |           |
    |..........>|            |              |            |           |
    |           | (F16) XMPP |              |            |           |
    |           | unsubscribe|              |            |           |
    |           |...........>|              |            |           |
    |           |            | (F17) SIP SUBSCRIBE       |           |
    |           |            | Expires: 0   |            |           |
    |           |            |**************************>|           |
    |           |            |              |            | (F18) SIP |
    |           |            |              |            | SUBSCRIBE |
    |           |            |              |            | Expires: 0|
    |           |            |              |            |**********>|
    |           |            |              |            | (F19) SIP |
    |           |            |              |            | 200 OK    |
    |           |            |              |            |<**********|
    |           |            |              | (F20) SIP  |           |
    |           |            |              | 200 OK     |           |
    |           |            |              |<***********|           |
    |           |  (F21) XMPP unsubscribed  |            |           |
    |           |<..........................|            |           |
    | (F22) XMPP|            |              |            |           |
    | unsubscribed           |              |            |           |
    |<..........|            |              |            |           |
    |           |            |              |            |           |
        

At any time after subscribing, the XMPP user can unsubscribe from the contact's presence. This is done by sending a <presence/> stanza of type "unsubscribe":

在订阅后的任何时候,XMPP用户都可以在联系人在场时取消订阅。这是通过发送类型为“unsubscribe”的<presence/>节来完成的:

Example 7: XMPP User Unsubscribes from SIP Contact (F15)

示例7:XMPP用户取消订阅SIP联系人(F15)

   |  <presence from='juliet@example.com'
   |            to='romeo@example.net'
   |            type='unsubscribe'/>
        
   |  <presence from='juliet@example.com'
   |            to='romeo@example.net'
   |            type='unsubscribe'/>
        

The XMPP-to-SIP gateway is responsible for translating the unsubscribe command into a SIP SUBSCRIBE request with the Expires header set to a value of zero:

XMPP到SIP网关负责将unsubscribe命令转换为SIP SUBSCRIBE请求,并将Expires头设置为零值:

Example 8: SIP Transformation of XMPP Unsubscribe (F17)

示例8:XMPP取消订阅的SIP转换(F17)

   |  SUBSCRIBE sip:romeo@example.net SIP/2.0
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=j89d
   |  Call-ID: 9D9F00DF-FCA9-4E7E-B970-80B638D5218A
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 789 SUBSCRIBE
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Accept: application/pidf+xml
   |  Expires: 0
   |  Content-Length: 0
        
   |  SUBSCRIBE sip:romeo@example.net SIP/2.0
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=j89d
   |  Call-ID: 9D9F00DF-FCA9-4E7E-B970-80B638D5218A
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 789 SUBSCRIBE
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Accept: application/pidf+xml
   |  Expires: 0
   |  Content-Length: 0
        

Upon sending the transformed unsubscribe, the XMPP-to-SIP gateway SHOULD send a <presence/> stanza of type "unsubscribed" addressed to the XMPP user:

发送转换后的取消订阅后,XMPP-to-SIP网关应向XMPP用户发送类型为“unsubscribed”的<presence/>节:

Example 9: XMPP User Receives Unsubscribed Notification (F22)

示例9:XMPP用户收到未订阅通知(F22)

   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='unsubscribed'/>
        
   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='unsubscribed'/>
        
4.3. SIP to XMPP
4.3. SIP到XMPP
4.3.1. Establishing a Presence Subscription
4.3.1. 建立状态订阅

The following diagram illustrates the protocol flow for establishing a presence subscription from a SIP user to an XMPP user, as further explained in the text and examples after the diagram.

下图说明了用于建立从SIP用户到XMPP用户的存在订阅的协议流,如图后的文本和示例中进一步解释的。

   SIP        SIP      SIP-to-XMPP    XMPP-to-SIP      XMPP         XMPP
   User      Server      Gateway        Gateway       Server        User
    |           |            |              |            |           |
    | (F23) SIP |            |              |            |           |
    | SUBSCRIBE |            |              |            |           |
    |**********>|            |              |            |           |
    |           | (F24) SIP  |              |            |           |
    |           | SUBSCRIBE  |              |            |           |
    |           |***********>|              |            |           |
    |           |            | (F25) XMPP subscribe      |           |
    |           |            |..........................>|           |
    |           |            |              |            | (F26) XMPP|
    |           |            |              |            | subscribe |
    |           |            |              |            |..........>|
    |           |            |              |            | (F27) XMPP|
    |           |            |              |            | subscribed|
    |           |            |              |            |<..........|
    |           |            |              | (F28) XMPP |           |
    |           |            |              | subscribed |           |
    |           |            |              |<...........|           |
    |           | (F29) SIP 200 OK          |            |           |
    |           |<**************************|            |           |
    | (F30) SIP |            |              |            |           |
    | 200 OK    |            |              |            |           |
    |<**********|            |              |            |           |
    |           |            |              |            |           |
        
   SIP        SIP      SIP-to-XMPP    XMPP-to-SIP      XMPP         XMPP
   User      Server      Gateway        Gateway       Server        User
    |           |            |              |            |           |
    | (F23) SIP |            |              |            |           |
    | SUBSCRIBE |            |              |            |           |
    |**********>|            |              |            |           |
    |           | (F24) SIP  |              |            |           |
    |           | SUBSCRIBE  |              |            |           |
    |           |***********>|              |            |           |
    |           |            | (F25) XMPP subscribe      |           |
    |           |            |..........................>|           |
    |           |            |              |            | (F26) XMPP|
    |           |            |              |            | subscribe |
    |           |            |              |            |..........>|
    |           |            |              |            | (F27) XMPP|
    |           |            |              |            | subscribed|
    |           |            |              |            |<..........|
    |           |            |              | (F28) XMPP |           |
    |           |            |              | subscribed |           |
    |           |            |              |<...........|           |
    |           | (F29) SIP 200 OK          |            |           |
    |           |<**************************|            |           |
    | (F30) SIP |            |              |            |           |
    | 200 OK    |            |              |            |           |
    |<**********|            |              |            |           |
    |           |            |              |            |           |
        

A SIP user initiates a subscription to a contact's presence information by sending a SIP SUBSCRIBE request to the contact. The following is an example of such a request:

SIP用户通过向联系人发送SIP SUBSCRIBE请求来发起对联系人的状态信息的订阅。以下是此类请求的示例:

Example 10: SIP User Subscribes to XMPP Contact (F23)

示例10:SIP用户订阅XMPP联系人(F23)

   |  SUBSCRIBE sip:juliet@example.com SIP/2.0
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=xfg9
   |  Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 263 SUBSCRIBE
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Accept: application/pidf+xml
   |  Content-Length: 0
        
   |  SUBSCRIBE sip:juliet@example.com SIP/2.0
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=xfg9
   |  Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 263 SUBSCRIBE
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Accept: application/pidf+xml
   |  Content-Length: 0
        

Notice that the Expires header was not included in the SUBSCRIBE request; this means that the default value of 3600 (i.e., 3600 seconds = 1 hour) applies.

请注意,订阅请求中不包括Expires标头;这意味着默认值3600(即3600秒=1小时)适用。

Upon receiving the SUBSCRIBE, the SIP server needs to determine the identity of the domain portion of the Request-URI or To header, which it does by following the procedures explained in Section 5 of [RFC7247]. If the domain is an XMPP domain, the SIP server will hand off the SUBSCRIBE to an associated SIP-to-XMPP gateway or connection manager that natively communicates with XMPP servers.

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

The SIP-to-XMPP gateway is then responsible for translating the SUBSCRIBE into an XMPP subscription request addressed from the SIP user to the XMPP user:

然后,SIP到XMPP网关负责将订阅转换为从SIP用户到XMPP用户的XMPP订阅请求:

Example 11: XMPP Transformation of SIP SUBSCRIBE (F25)

示例11:SIP SUBSCRIBE的XMPP转换(F25)

   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='subscribe'/>
        
   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='subscribe'/>
        

In accordance with [RFC6121], once it receives the stanza from the XMPP-to-SIP gateway, the XMPP user's server MUST deliver the presence subscription request to the XMPP user (or, if a subscription already exists in the XMPP user's roster, the XMPP server SHOULD auto-reply with a <presence/> stanza of type "subscribed").

根据[RFC6121],一旦从XMPP到SIP网关接收到节,XMPP用户服务器必须将状态订阅请求发送给XMPP用户(或者,如果XMPP用户名册中已经存在订阅,XMPP服务器应自动回复类型为“subscribed”的<presence/>节)。

If the XMPP user approves the subscription request, the XMPP server then MUST return a <presence/> stanza of type "subscribed" addressed from the XMPP user to the SIP user. The XMPP-to-SIP gateway is responsible for translating the <presence/> stanza of type "subscribed" into a SIP 200 OK response.

如果XMPP用户批准订阅请求,则XMPP服务器必须将类型为“subscribed”的<presence/>节从XMPP用户返回给SIP用户。XMPP到SIP网关负责将类型为“subscribed”的<presence/>节转换为SIP 200 OK响应。

If the XMPP user declines the subscription request, the XMPP server then MUST return a <presence/> stanza of type "unsubscribed" addressed from the XMPP user to the SIP user and the XMPP-to-SIP gateway MUST transform that stanza into an empty SIP NOTIFY message with a Subscription-State of "terminated" and a reason of "rejected":

如果XMPP用户拒绝订阅请求,则XMPP服务器必须将类型为“unsubscribed”的<presence/>节从XMPP用户返回给SIP用户,并且XMPP-to-SIP网关必须将该节转换为空的SIP NOTIFY消息,订阅状态为“已终止”,原因为“已拒绝”:

Example 12: Subscription Request Rejected

示例12:订阅请求被拒绝

   |  NOTIFY sip:192.0.2.2 SIP/2.0
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=ur93
   |  To: <sip:romeo@example.net>;tag=pq72
   |  Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
   |  Event: presence
   |  Subscription-State: terminated;reason=rejected
   |  Max-Forwards: 70
   |  CSeq: 232 NOTIFY
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 0
        
   |  NOTIFY sip:192.0.2.2 SIP/2.0
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=ur93
   |  To: <sip:romeo@example.net>;tag=pq72
   |  Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
   |  Event: presence
   |  Subscription-State: terminated;reason=rejected
   |  Max-Forwards: 70
   |  CSeq: 232 NOTIFY
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 0
        
4.3.2. Refreshing a Presence Subscription
4.3.2. 刷新状态订阅

For as long as a SIP user is online and interested in receiving presence notifications from the XMPP contact, the user's SIP user agent is responsible for periodically refreshing the subscription by sending an updated SUBSCRIBE request with an appropriate value for the Expires header. In response, the presence-aware SIP-to-XMPP gateway MUST send a SIP NOTIFY to the user agent (per [RFC6665]); if the gateway has meaningful information about the availability state of the XMPP user (e.g., obtained from the core presence session in the XMPP server) then the NOTIFY MUST communicate that information (e.g., by including a PIDF body [RFC3863] with the relevant data), whereas if the gateway does not have meaningful information about the availability state of the XMPP user then the NOTIFY MUST be empty as allowed by [RFC6665].

只要SIP用户在线并且有兴趣从XMPP联系人接收状态通知,用户的SIP用户代理就负责通过发送具有适当Expires报头值的更新订阅请求来定期刷新订阅。作为响应,感知状态的SIP到XMPP网关必须向用户代理发送SIP通知(根据[RFC6665]);如果网关具有关于XMPP用户可用性状态的有意义的信息(例如,从XMPP服务器中的核心存在会话中获得),则通知必须传达该信息(例如,通过包括具有相关数据的PIDF正文[RFC3863]),然而,如果网关没有关于XMPP用户可用性状态的有意义的信息,则通知必须为空,这是[RFC6665]允许的。

Once the SIP user ends its presence session, it is the responsibility of the presence-aware SIP-to-XMPP gateway to properly handle the difference between short-lived SIP presence subscriptions and long-lived XMPP presence subscriptions. The gateway has two options when the SIP user's subscription expires:

一旦SIP用户结束其状态会话,状态感知SIP-to-XMPP网关就有责任正确处理短期SIP状态订阅和长期XMPP状态订阅之间的差异。当SIP用户的订阅过期时,网关有两个选项:

o Cancel the subscription (i.e., treat it as temporary) and send an XMPP <presence/> stanza of type "unsubscribe" to the XMPP contact; this honors the SIP semantic but will seem strange to the XMPP contact (since it will appear that the SIP user has cancelled a long-lived subscription).

o 取消订阅(即,将其视为临时订阅),并向XMPP联系人发送类型为“unsubscribe”的XMPP<presence/>节;这尊重SIP语义,但对XMPP联系人来说似乎很奇怪(因为SIP用户似乎取消了长期订阅)。

o Maintain the subscription (i.e., treat it as long-lived), and

o 维持订阅(即将其视为长期订阅),以及

1. send a SIP NOTIFY request to the SIP user containing a PIDF document specifying that the XMPP contact now has a basic status of "closed", including a Subscription-State of "terminated" with a reason of "timeout"

1. 向SIP用户发送SIP NOTIFY请求,其中包含一个PIDF文档,指定XMPP联系人现在的基本状态为“已关闭”,包括订阅状态为“已终止”,原因为“超时”

2. send an XMPP <presence/> stanza of type "unavailable" to the XMPP contact; this violates the letter of the SIP semantic but will seem more natural to the XMPP contact

2. 向XMPP联系人发送类型为“不可用”的XMPP<presence/>节;这违反了SIP语义的字母,但对XMPP联系人来说似乎更自然

Which of these options a presence-aware SIP-to-XMPP gateway chooses is up to the implementation.

感知状态的SIP到XMPP网关选择这些选项中的哪一个取决于实现。

If the implementation chooses the first option, the protocol generated would be as follows:

如果实现选择第一个选项,则生成的协议如下:

Example 13: XMPP Handling of Temporary Subscription Expiry

示例13:XMPP处理临时订阅到期

   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='unsubscribe'/>
        
   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='unsubscribe'/>
        

If the implementation chooses the second option, the protocol generated would be as follows:

如果实现选择第二个选项,则生成的协议如下:

Example 14: SIP Handling of Long-Lived Subscription Expiry

示例14:长期订阅到期的SIP处理

   |  NOTIFY sip:192.0.2.2 SIP/2.0
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=ur93
   |  To: <sip:romeo@example.net>;tag=pq72
   |  Call-ID: 2B44E147-3B53-45E4-9D48-C051F3216D14
   |  Event: presence
   |  Subscription-State: terminated;reason=timeout
   |  Max-Forwards: 70
   |  CSeq: 232 NOTIFY
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 194
   |
   |  <?xml version='1.0' encoding='UTF-8'?>
   |  <presence xmlns='urn:ietf:params:xml:ns:pidf'
   |            entity='pres:juliet@example.com'>
   |    <tuple id='ID-balcony'>
   |      <status>
   |        <basic>closed</basic>
   |      </status>
   |    </tuple>
   |  </presence>
        
   |  NOTIFY sip:192.0.2.2 SIP/2.0
   |  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=ur93
   |  To: <sip:romeo@example.net>;tag=pq72
   |  Call-ID: 2B44E147-3B53-45E4-9D48-C051F3216D14
   |  Event: presence
   |  Subscription-State: terminated;reason=timeout
   |  Max-Forwards: 70
   |  CSeq: 232 NOTIFY
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 194
   |
   |  <?xml version='1.0' encoding='UTF-8'?>
   |  <presence xmlns='urn:ietf:params:xml:ns:pidf'
   |            entity='pres:juliet@example.com'>
   |    <tuple id='ID-balcony'>
   |      <status>
   |        <basic>closed</basic>
   |      </status>
   |    </tuple>
   |  </presence>
        

Example 15: XMPP Handling of Long-Lived Subscription Expiry

示例15:XMPP处理长期订阅到期

   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='unavailable'/>
        
   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='unavailable'/>
        
4.3.3. Cancelling a Presence Subscription
4.3.3. 取消状态订阅

At any time, the SIP user can cancel the subscription by sending a SUBSCRIBE message whose Expires header is set to a value of zero ("0"):

在任何时候,SIP用户都可以通过发送其Expires头设置为零值(“0”)的订阅消息来取消订阅:

Example 16: SIP User Cancels Subscription

示例16:SIP用户取消订阅

   |  SUBSCRIBE sip:juliet@example.com SIP/2.0
   |  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=yt66
   |  Call-ID: 717B1B84-F080-4F12-9F44-0EC1ADE767B9
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 8775 SUBSCRIBE
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Expires: 0
   |  Content-Length: 0
        
   |  SUBSCRIBE sip:juliet@example.com SIP/2.0
   |  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=yt66
   |  Call-ID: 717B1B84-F080-4F12-9F44-0EC1ADE767B9
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 8775 SUBSCRIBE
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Expires: 0
   |  Content-Length: 0
        

As above, upon receiving such a request, a presence-aware SIP-to-XMPP gateway is responsible for doing one of the following:

如上所述,在接收到这样的请求时,感知状态的SIP到XMPP网关负责执行以下操作之一:

o Cancel the subscription (i.e., treat it as temporary) and send an XMPP <presence/> stanza of type "unsubscribe" to the XMPP contact.

o 取消订阅(即,将其视为临时订阅),并向XMPP联系人发送类型为“unsubscribe”的XMPP<presence/>节。

o Maintain the subscription (i.e., treat it as long-lived), and

o 维持订阅(即将其视为长期订阅),以及

1. send a SIP NOTIFY request to the SIP user containing a PIDF document specifying that the XMPP contact now has a basic status of "closed"

1. 向SIP用户发送SIP NOTIFY请求,其中包含一个PIDF文档,指定XMPP联系人现在的基本状态为“已关闭”

2. send a SIP SUBSCRIBE request to the SIP user with an Expires header set to a value of "0" (zero) when it receives XMPP presence of type "unavailable" from the XMPP contact

2. 当SIP用户从XMPP联系人接收到类型为“不可用”的XMPP存在时,向SIP用户发送SIP订阅请求,并将Expires标头设置为值“0”(零)

3. send an XMPP <presence/> stanza of type "unavailable" to the XMPP contact

3. 向XMPP联系人发送类型为“不可用”的XMPP<presence/>节

5. Notifications of Presence Information
5. 状态信息通知
5.1. Overview
5.1. 概述

Both XMPP and presence-aware SIP systems enable entities (often, but not necessarily, human users) to send presence notifications to other entities. At its most basic, the term "presence" refers to information about an entity's "on/off" availability for communication on a network. Often, this basic concept is supplemented by information that further specifies the entity's context or status

XMPP和感知状态的SIP系统都支持实体(通常但不一定是人类用户)向其他实体发送状态通知。最基本的术语“存在”是指关于实体在网络上通信的“开/关”可用性的信息。通常,这一基本概念由进一步指定实体的上下文或状态的信息补充

while available for communication; these availability states commonly include "away" and "do not disturb". Some systems and protocols extend the concepts of presence and availability even further and refer to any relatively ephemeral information about an entity as a kind of presence; categories of such "extended presence" include geographical location (e.g., GPS coordinates), user mood (e.g., grumpy), user activity (e.g., walking), and ambient environment (e.g., noisy). In this document, we focus on the "least common denominator" of network availability only, although future documents might address broader notions of presence, including availability states and extended presence.

在可用于通信的情况下;这些可用性状态通常包括“远离”和“请勿打扰”。一些系统和协议进一步扩展了存在性和可用性的概念,并将关于实体的任何相对短暂的信息称为一种存在;此类“扩展存在”的类别包括地理位置(例如GPS坐标)、用户情绪(例如脾气暴躁)、用户活动(例如步行)和周围环境(例如噪音)。在本文档中,我们只关注网络可用性的“最小公分母”,尽管未来的文档可能会涉及更广泛的存在性概念,包括可用性状态和扩展存在性。

[RFC6121] defines how XMPP <presence/> stanzas can indicate availability (via absence of a 'type' attribute) or lack of availability (via a 'type' attribute with a value of "unavailable"). SIP presence using a SIP event package for presence is specified in [RFC3856].

[RFC6121]定义XMPP<presence/>节如何表示可用性(通过缺少“type”属性)或缺乏可用性(通过值为“unavailable”的“type”属性)。[RFC3856]中规定了使用SIP事件包进行存在的SIP存在。

As described in [RFC6121], XMPP presence information about an entity is communicated by means of an XML <presence/> stanza sent over an XML stream. In this document we will assume that such a <presence/> stanza is sent from an XMPP client to an XMPP server over an XML stream negotiated between the client and the server, and that the client is controlled by a human user. In general, XMPP presence is sent by the user to the user's server and then broadcast to all entities who are subscribed to the user's presence information.

如[RFC6121]中所述,关于实体的XMPP状态信息通过通过XML流发送的XML<presence/>节进行通信。在本文档中,我们将假设这样一个<presence/>节通过客户机和服务器之间协商的XML流从XMPP客户机发送到XMPP服务器,并且客户机由人工用户控制。通常,XMPP状态由用户发送到用户的服务器,然后广播到订阅用户状态信息的所有实体。

As described in [RFC3856], presence information about an entity is communicated by means of a SIP NOTIFY event sent from a SIP user agent to an intended recipient who is most generally referenced by a Presence URI of the form <pres:user@domain> but who might be referenced by a SIP or SIPS URI of the form <sip:user@domain> or <sips:user@domain>.

如[RFC3856]中所述,关于实体的存在信息通过SIP用户代理发送的SIP NOTIFY事件传递给预期接收者,该接收者通常由形式为<pres:user@domain>但SIP或SIPS URI形式为<SIP:user@domain>或<sips:user@domain>.

This document addresses basic presence or network availability only, not the various extensions to SIP and XMPP for "rich presence" such as [RFC4480], [XEP-0107], and [XEP-0108].

本文档仅讨论基本存在或网络可用性,而不是针对[RFC4480]、[XEP-0107]和[XEP-0108]等“丰富存在”对SIP和XMPP的各种扩展。

5.2. XMPP to SIP
5.2. XMPP到SIP

When Juliet interacts with her XMPP client to modify her presence information (or when her client automatically updates her presence information, e.g., via an "auto-away" feature), her client generates an XMPP <presence/> stanza. The syntax of the <presence/> stanza, including required and optional elements and attributes, is defined in [RFC6121]. The following is an example of such a stanza:

当Juliet与她的XMPP客户端交互以修改她的状态信息时(或者当她的客户端自动更新她的状态信息时,例如通过“自动离开”功能),她的客户端将生成一个XMPP<presence/>节。[RFC6121]中定义了<presence/>节的语法,包括必需的和可选的元素和属性。以下是这一节的一个例子:

Example 17: XMPP User Sends Presence Notification

示例17:XMPP用户发送状态通知

   |  <presence from='juliet@example.com/balcony'/>
        
   |  <presence from='juliet@example.com/balcony'/>
        

Upon receiving such a stanza, the XMPP server to which Juliet has connected broadcasts it to all subscribers who are authorized to receive presence notifications from Juliet (this is similar to the SIP NOTIFY method). For each subscriber, broadcasting the presence notification involves either delivering it to a local recipient (if the hostname in the subscriber's address matches one of the hostnames serviced by the XMPP server) or attempting to route it to the foreign domain that services the hostname in the subscriber's address. Thus, the XMPP server needs to determine the identity of the domainpart in the 'to' address, which it does by following the procedures discussed in [RFC7247]. If the domain is a SIP domain, the XMPP server will hand off the <presence/> stanza to an associated XMPP-to-SIP gateway or connection manager that natively communicates with presence-aware SIP servers (no example shown).

在接收到这样一个节时,Juliet连接到的XMPP服务器将它广播给所有有权从Juliet接收状态通知的订阅者(这类似于SIP NOTIFY方法)。对于每个订阅者,广播状态通知涉及将其发送给本地收件人(如果订阅者地址中的主机名与XMPP服务器提供服务的主机名之一匹配),或者尝试将其路由到为订阅者地址中的主机名提供服务的外域。因此,XMPP服务器需要根据[RFC7247]中讨论的过程确定“to”地址中domainpart的标识。如果域是SIP域,XMPP服务器将把<presence/>节移交给关联的XMPP-to-SIP网关或连接管理器,该网关或连接管理器本机与感知状态的SIP服务器通信(未显示示例)。

The XMPP-to-SIP gateway is then responsible for translating the XMPP <presence/> stanza into a SIP NOTIFY request and included PIDF document from the XMPP user to the SIP user.

然后,XMPP到SIP网关负责将XMPP<presence/>节转换为SIP通知请求,并将包含的PIDF文档从XMPP用户转换为SIP用户。

Example 18: SIP Transformation of XMPP Presence Notification

示例18:XMPP状态通知的SIP转换

   |  NOTIFY sip:192.0.2.2 SIP/2.0
   |  Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=gh19
   |  To: <sip:romeo@example.net>;tag=yt66
   |  Contact: <sip:juliet@example.com>;gr=balcony
   |  Call-ID: 2B44E147-3B53-45E4-9D48-C051F3216D14
   |  Event: presence
   |  Subscription-State: active;expires=599
   |  Max-Forwards: 70
   |  CSeq: 157 NOTIFY
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 192
   |
        
   |  NOTIFY sip:192.0.2.2 SIP/2.0
   |  Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=gh19
   |  To: <sip:romeo@example.net>;tag=yt66
   |  Contact: <sip:juliet@example.com>;gr=balcony
   |  Call-ID: 2B44E147-3B53-45E4-9D48-C051F3216D14
   |  Event: presence
   |  Subscription-State: active;expires=599
   |  Max-Forwards: 70
   |  CSeq: 157 NOTIFY
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 192
   |
        
   |  <?xml version='1.0' encoding='UTF-8'?>
   |  <presence xmlns='urn:ietf:params:xml:ns:pidf'
   |            entity='pres:juliet@example.com'>
   |    <tuple id='ID-balcony'>
   |      <status>
   |        <basic>open</basic>
   |        <show xmlns='jabber:client'>away</show>
   |      </status>
   |    </tuple>
   |  </presence>
        
   |  <?xml version='1.0' encoding='UTF-8'?>
   |  <presence xmlns='urn:ietf:params:xml:ns:pidf'
   |            entity='pres:juliet@example.com'>
   |    <tuple id='ID-balcony'>
   |      <status>
   |        <basic>open</basic>
   |        <show xmlns='jabber:client'>away</show>
   |      </status>
   |    </tuple>
   |  </presence>
        

The mapping of XMPP syntax elements to SIP syntax elements SHOULD be as shown in the following table. (Mappings for elements not mentioned are undefined.)

XMPP语法元素到SIP语法元素的映射应如下表所示。(未提及的元素映射未定义。)

        +-----------------------------+---------------------------+
        |  XMPP Element or Attribute  |  SIP Header or PIDF Data  |
        +-----------------------------+---------------------------+
        |  <presence/> stanza         |  "Event: presence" (1)    |
        +-----------------------------+---------------------------+
        |  XMPP resource identifier   |  tuple 'id' attribute (2) |
        +-----------------------------+---------------------------+
        |  from                       |  From                     |
        +-----------------------------+---------------------------+
        |  id                         |  CSeq (3)                 |
        +-----------------------------+---------------------------+
        |  to                         |  To                       |
        +-----------------------------+---------------------------+
        |  type                       |  basic status (4) (5)     |
        +-----------------------------+---------------------------+
        |  xml:lang                   |  Content-Language         |
        +-----------------------------+---------------------------+
        |  <priority/>                |  priority for tuple (6)   |
        +-----------------------------+---------------------------+
        |  <show/>                    |  no mapping (7)           |
        +-----------------------------+---------------------------+
        |  <status/>                  |  <note/>                  |
        +-----------------------------+---------------------------+
        
        +-----------------------------+---------------------------+
        |  XMPP Element or Attribute  |  SIP Header or PIDF Data  |
        +-----------------------------+---------------------------+
        |  <presence/> stanza         |  "Event: presence" (1)    |
        +-----------------------------+---------------------------+
        |  XMPP resource identifier   |  tuple 'id' attribute (2) |
        +-----------------------------+---------------------------+
        |  from                       |  From                     |
        +-----------------------------+---------------------------+
        |  id                         |  CSeq (3)                 |
        +-----------------------------+---------------------------+
        |  to                         |  To                       |
        +-----------------------------+---------------------------+
        |  type                       |  basic status (4) (5)     |
        +-----------------------------+---------------------------+
        |  xml:lang                   |  Content-Language         |
        +-----------------------------+---------------------------+
        |  <priority/>                |  priority for tuple (6)   |
        +-----------------------------+---------------------------+
        |  <show/>                    |  no mapping (7)           |
        +-----------------------------+---------------------------+
        |  <status/>                  |  <note/>                  |
        +-----------------------------+---------------------------+
        

Table 1: Presence Syntax Mapping from XMPP to SIP

表1:从XMPP到SIP的状态语法映射

Note the following regarding these mappings:

请注意有关这些映射的以下内容:

(1) Only an XMPP <presence/> stanza that lacks a 'type' attribute or whose 'type' attribute has a value of "unavailable" SHOULD be mapped by an XMPP-to-SIP gateway to a SIP NOTIFY request, since those are the only <presence/> stanzas that represent notifications.

(1) XMPP-to-SIP-gateway只能将缺少“type”属性或其“type”属性值为“unavailable”的XMPP<presence/>节映射到SIP-NOTIFY请求,因为这些节是表示通知的唯一<presence/>节。

(2) The PIDF schema defines the tuple 'id' attribute as having a datatype of "xs:ID"; because this datatype is more restrictive than the "xs:string" datatype for XMPP resourceparts (in particular, a number is not allowed as the first character of an ID), prepending the resourcepart with "ID-" or some other alphabetic string when mapping from XMPP to SIP is RECOMMENDED.

(2) PIDF模式将元组“id”属性定义为具有数据类型“xs:id”;由于此数据类型比XMPP resourceparts的“xs:string”数据类型更具限制性(特别是,不允许数字作为ID的第一个字符),因此建议在从XMPP映射到SIP时,在resourcepart前面加上“ID-”或其他字母字符串。

(3) In practice, XMPP <presence/> stanzas often do not include the 'id' attribute.

(3) 实际上,XMPP<presence/>节通常不包含“id”属性。

(4) Because the lack of a 'type' attribute indicates that an XMPP entity is available for communications, the gateway SHOULD map that information to a PIDF basic status of "open". Because a 'type' attribute with a value of "unavailable" indicates that an XMPP entity is not available for communications, the gateway SHOULD map that information to a PIDF basic status of "closed".

(4) 由于缺少“type”属性表示XMPP实体可用于通信,因此网关应将该信息映射到PIDF基本状态“open”。由于值为“unavailable”的“type”属性表示XMPP实体不可用于通信,因此网关应将该信息映射到PIDF基本状态“closed”。

(5) When the XMPP-to-SIP gateway receives XMPP presence of type "unavailable" from the XMPP contact, it SHOULD (a) send a SIP NOTIFY request to the SIP user containing a PIDF document specifying that the XMPP contact now has a basic status of "closed" and (b) send a SIP SUBSCRIBE request to the SIP user with an Expires header set to a value of "0" (zero).

(5) 当XMPP-to-SIP网关从XMPP联系人接收到类型为“不可用”的XMPP存在时,它应该(a)向SIP用户发送SIP NOTIFY请求,其中包含指定XMPP联系人现在的基本状态为“已关闭”的PIDF文档,以及(b)向SIP用户发送SIP SUBSCRIBE请求,其中Expires头设置为“0”(零)。

(6) The value of the XMPP <priority/> element is an integer between -128 and +127, whereas the value of the PIDF <contact/> element's 'priority' attribute is a decimal number from zero to one inclusive, with a maximum of three decimal places. If the value of the XMPP <priority/> element is negative, an XMPP-to-SIP gateway MUST NOT map the value. If an XMPP-to-SIP gateway maps positive values, it SHOULD treat XMPP priority 0 as PIDF priority 0 and XMPP priority 127 as PIDF priority 1, mapping intermediate values appropriately so that they are unique (e.g., XMPP priority 1 to PIDF priority 0.007, XMPP priority 2 to PIDF priority 0.015, and so on up through mapping XMPP priority 126 to PIDF priority 0.992; note that this is an example only and that the exact mapping is up to the implementation).

(6) XMPP<priority/>元素的值是一个介于-128和+127之间的整数,而PIDF<contact/>元素的“priority”属性的值是一个从零到一(含一)的十进制数,最多有三位小数。如果XMPP<priority/>元素的值为负,则XMPP-to-SIP网关不能映射该值。如果XMPP到SIP网关映射正值,则应将XMPP优先级0视为PIDF优先级0,将XMPP优先级127视为PIDF优先级1,并适当映射中间值,使其唯一(例如,通过将XMPP优先级126映射到PIDF优先级0.992,XMPP优先级1到PIDF优先级0.007,XMPP优先级2到PIDF优先级0.015等等;请注意,这只是一个示例,具体映射取决于实现)。

(7) Some implementations support custom extensions to encapsulate detailed information about availability; however, there is no need to standardize a PIDF extension for this purpose, since PIDF is already extensible and thus the <show/> element (qualified by the 'jabber:client' namespace) can be included directly in the PIDF XML. The examples in this document illustrate this usage, which is RECOMMENDED. The most useful values are likely "away" and "dnd", although note that the latter value merely means "busy" and does not imply that a server or client ought to block incoming traffic while the user

(7) 一些实现支持定制扩展来封装有关可用性的详细信息;但是,没有必要为此标准化PIDF扩展,因为PIDF已经是可扩展的,因此<show/>元素(由“jabber:client”名称空间限定)可以直接包含在PIDF XML中。本文档中的示例说明了此用法,推荐使用。最有用的值可能是“away”和“dnd”,不过请注意,后一个值仅表示“busy”,并不意味着服务器或客户端应该在用户访问时阻止传入流量

is in that state. Naturally, a gateway can choose to translate a custom extension into an established value of the <show/> element [RFC6121] or translate a <show/> element into a custom extension that the gateway knows is supported by the user agent of the intended recipient. Unfortunately, this behavior does not guarantee that information will not be lost; to help prevent information loss, a gateway ought to include both the <show/> element and the custom extension if the gateway cannot suitably translate the custom value into a <show/> value.

他处于那种状态。当然,网关可以选择将自定义扩展转换为<show/>元素[RFC6121]的既定值,或者将<show/>元素转换为网关知道目标接收者的用户代理支持的自定义扩展。不幸的是,这种行为不能保证信息不会丢失;为了帮助防止信息丢失,如果网关不能将自定义值适当地转换为<show/>值,那么网关应该同时包含<show/>元素和自定义扩展名。

5.3. SIP to XMPP
5.3. SIP到XMPP

When Romeo changes his presence, his SIP user agent generates a SIP NOTIFY request for any active subscriptions. The syntax of the NOTIFY request is defined in [RFC3856]. The following is an example of such a request:

当Romeo改变他的状态时,他的SIP用户代理为任何活动订阅生成SIP NOTIFY请求。通知请求的语法在[RFC3856]中定义。以下是此类请求的示例:

Example 19: SIP User Sends Presence Notification

示例19:SIP用户发送状态通知

   |  NOTIFY sip:192.0.2.1 SIP/2.0
   |  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=yt66
   |  To: <sip:juliet@example.com>;tag=bi54
   |  Contact: <sip:romeo@example.net>;gr=orchard
   |  Call-ID: C33C6C9D-0F4A-42F9-B95C-7CE86B526B5B
   |  Event: presence
   |  Subscription-State: active;expires=499
   |  Max-Forwards: 70
   |  CSeq: 8775 NOTIFY
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 193
   |
   |  <?xml version='1.0' encoding='UTF-8'?>
   |  <presence xmlns='urn:ietf:params:xml:ns:pidf'
   |            entity='pres:romeo@example.net'>
   |    <tuple id='ID-orchard'>
   |      <status>
   |        <basic>closed</basic>
   |      </status>
   |    </tuple>
   |  </presence>
        
   |  NOTIFY sip:192.0.2.1 SIP/2.0
   |  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=yt66
   |  To: <sip:juliet@example.com>;tag=bi54
   |  Contact: <sip:romeo@example.net>;gr=orchard
   |  Call-ID: C33C6C9D-0F4A-42F9-B95C-7CE86B526B5B
   |  Event: presence
   |  Subscription-State: active;expires=499
   |  Max-Forwards: 70
   |  CSeq: 8775 NOTIFY
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Content-Type: application/pidf+xml
   |  Content-Length: 193
   |
   |  <?xml version='1.0' encoding='UTF-8'?>
   |  <presence xmlns='urn:ietf:params:xml:ns:pidf'
   |            entity='pres:romeo@example.net'>
   |    <tuple id='ID-orchard'>
   |      <status>
   |        <basic>closed</basic>
   |      </status>
   |    </tuple>
   |  </presence>
        

Upon receiving the NOTIFY, the SIP server needs to determine the identity of the domain portion of the Request-URI or To header, which it does by following the procedures discussed in [RFC7247]. If the domain is an XMPP domain, the SIP server will hand off the NOTIFY to an associated SIP-to-XMPP gateway or connection manager that natively communicates with XMPP servers.

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

The SIP-to-XMPP gateway is then responsible for translating the NOTIFY into an XMPP <presence/> stanza addressed from the SIP user to the XMPP user:

然后,SIP到XMPP网关负责将通知转换为从SIP用户到XMPP用户的XMPP<presence/>节:

Example 20: XMPP Transformation of SIP Presence Notification

示例20:SIP状态通知的XMPP转换

   |  <presence from='romeo@example.net'
   |            to='juliet@example.com/balcony'
   |            type='unavailable'/>
        
   |  <presence from='romeo@example.net'
   |            to='juliet@example.com/balcony'
   |            type='unavailable'/>
        

The mapping of SIP syntax elements to XMPP syntax elements SHOULD be as shown in the following table. (Mappings for elements not mentioned are undefined.)

SIP语法元素到XMPP语法元素的映射应如下表所示。(未提及的元素映射未定义。)

        +---------------------------+-----------------------------+
        |  SIP Header or PIDF Data  |  XMPP Element or Attribute  |
        +---------------------------+-----------------------------+
        |  basic status             |  type (1)                   |
        +---------------------------+-----------------------------+
        |  Content-Language         |  xml:lang                   |
        +---------------------------+-----------------------------+
        |  CSeq                     |  id (2)                     |
        +---------------------------+-----------------------------+
        |  From                     |  from                       |
        +---------------------------+-----------------------------+
        |  priority for tuple       |  <priority/> (3)            |
        +---------------------------+-----------------------------+
        |  To                       |  to                         |
        +---------------------------+-----------------------------+
        |  <note/>                  |  <status/>                  |
        +---------------------------+-----------------------------+
        |  <show/>                  |  <show/> (4)                |
        +---------------------------+-----------------------------+
        
        +---------------------------+-----------------------------+
        |  SIP Header or PIDF Data  |  XMPP Element or Attribute  |
        +---------------------------+-----------------------------+
        |  basic status             |  type (1)                   |
        +---------------------------+-----------------------------+
        |  Content-Language         |  xml:lang                   |
        +---------------------------+-----------------------------+
        |  CSeq                     |  id (2)                     |
        +---------------------------+-----------------------------+
        |  From                     |  from                       |
        +---------------------------+-----------------------------+
        |  priority for tuple       |  <priority/> (3)            |
        +---------------------------+-----------------------------+
        |  To                       |  to                         |
        +---------------------------+-----------------------------+
        |  <note/>                  |  <status/>                  |
        +---------------------------+-----------------------------+
        |  <show/>                  |  <show/> (4)                |
        +---------------------------+-----------------------------+
        

Table 2: Presence Syntax Mapping from SIP to XMPP

表2:从SIP到XMPP的状态语法映射

Note the following regarding these mappings:

请注意有关这些映射的以下内容:

(1) A PIDF basic status of "open" SHOULD be mapped to no 'type' attribute, and a PIDF basic status of "closed" SHOULD be mapped to a 'type' attribute whose value is "unavailable".

(1) PIDF基本状态“打开”应映射到无“类型”属性,PIDF基本状态“关闭”应映射到值为“不可用”的“类型”属性。

(2) This mapping is OPTIONAL.

(2) 此映射是可选的。

(3) See the notes following Table 1 of this document regarding mapping of presence priority.

(3) 请参阅本文档表1中关于状态优先级映射的注释。

(4) If a SIP implementation supports the <show/> element (qualified by the 'jabber:client' namespace) as a PIDF extension for availability status as described in the notes following Table 1 of this document, the SIP-to-XMPP gateway is responsible for including that element in the XMPP presence notification.

(4) 如果SIP实现支持<show/>元素(由“jabber:client”命名空间限定)作为本文档表1下注释中描述的可用性状态的PIDF扩展,则SIP到XMPP网关负责将该元素包括在XMPP存在通知中。

6. Requests for Presence Information
6. 要求提供在场信息

Both SIP and XMPP provide methods for requesting presence information about another entity.

SIP和XMPP都提供了请求另一个实体的状态信息的方法。

6.1. XMPP to SIP
6.1. XMPP到SIP

In XMPP, a request for presence information is completed by sending a <presence/> stanza of type "probe":

在XMPP中,通过发送类型为“probe”的<presence/>节来完成对状态信息的请求:

Example 21: XMPP Server Sends Presence Probe on Behalf of XMPP User

示例21:XMPP服务器代表XMPP用户发送状态探测

   |  <presence from='juliet@example.com/chamber'
   |            to='romeo@example.net'
   |            type='probe'/>
        
   |  <presence from='juliet@example.com/chamber'
   |            to='romeo@example.net'
   |            type='probe'/>
        

Note: As described in [RFC6121], presence probes are used by XMPP servers to request presence on behalf of XMPP users; XMPP clients are discouraged from sending presence probes, since retrieving presence is a service that servers provide.

注:如[RFC6121]所述,XMPP服务器使用状态探测代表XMPP用户请求状态;不鼓励XMPP客户端发送状态探测,因为检索状态是服务器提供的服务。

An XMPP-to-SIP gateway would transform the presence probe into its SIP equivalent, which is a SUBSCRIBE request with an Expires header value of zero:

XMPP到SIP网关将状态探测转换为其SIP等价物,即Expires头值为零的订阅请求:

Example 22: SIP Transformation of XMPP Presence Probe

示例22:XMPP存在探测的SIP转换

   |  SUBSCRIBE sip:romeo@example.net SIP/2.0
   |  Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=ffd2
   |  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 123 SUBSCRIBE
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Accept: application/pidf+xml
   |  Expires: 0
   |  Content-Length: 0
        
   |  SUBSCRIBE sip:romeo@example.net SIP/2.0
   |  Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
   |  From: <sip:juliet@example.com>;tag=ffd2
   |  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 123 SUBSCRIBE
   |  Contact: <sip:x2s.example.com;transport=tcp>
   |  Accept: application/pidf+xml
   |  Expires: 0
   |  Content-Length: 0
        

As described in [RFC3856], this cancels any subscription but causes a NOTIFY to be sent to the subscriber, just as a presence probe does (the transformation rules for presence notifications have been previously described in Section 5.2 of this document).

如[RFC3856]中所述,这会取消任何订阅,但会导致向订阅方发送通知,就像状态探测一样(本文档第5.2节中已经描述了状态通知的转换规则)。

6.2. SIP to XMPP
6.2. SIP到XMPP

In SIP, a request for presence information is effectively completed by sending a SUBSCRIBE with an Expires header value of zero:

在SIP中,通过发送Expires报头值为零的订阅,有效地完成对状态信息的请求:

Example 23: SIP User Sends Presence Request

示例23:SIP用户发送状态请求

   |  SUBSCRIBE sip:juliet@example.com SIP/2.0
   |  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=yt66
   |  Call-ID: 717B1B84-F080-4F12-9F44-0EC1ADE767B9
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 8775 SUBSCRIBE
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Expires: 0
   |  Content-Length: 0
        
   |  SUBSCRIBE sip:juliet@example.com SIP/2.0
   |  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
   |  From: <sip:romeo@example.net>;tag=yt66
   |  Call-ID: 717B1B84-F080-4F12-9F44-0EC1ADE767B9
   |  Event: presence
   |  Max-Forwards: 70
   |  CSeq: 8775 SUBSCRIBE
   |  Contact: <sip:simple.example.net;transport=tcp>
   |  Expires: 0
   |  Content-Length: 0
        

When honoring the long-lived semantics of an XMPP presence subscription, a presence-aware SIP-to-XMPP gateway SHOULD translate such a SIP request into a <presence/> stanza of type "probe" if it does not already have presence information about the contact:

当遵守XMPP状态订阅的长期语义时,感知状态的SIP-to-XMPP网关应将此类SIP请求转换为类型为“probe”的<presence/>节(如果它还没有关于联系人的状态信息):

Example 24: XMPP Transformation of SIP Presence Request

示例24:SIP状态请求的XMPP转换

   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='probe'/>
        
   |  <presence from='romeo@example.net'
   |            to='juliet@example.com'
   |            type='probe'/>
        
7. Security Considerations
7. 安全考虑

Detailed security considerations for presence protocols are given in [RFC2779], for SIP-based presence in [RFC3856] (see also [RFC3261]), and for XMPP-based presence in [RFC6121] (see also [RFC6120]).

[RFC2779]中给出了存在协议的详细安全注意事项,[RFC3856]中基于SIP的存在(另请参见[RFC3261]),以及[RFC6121]中基于XMPP的存在(另请参见[RFC6120])。

The mismatch between long-lived XMPP presence subscriptions and short-lived SIP presence subscriptions introduces the possibility of an amplification attack launched from the XMPP network against a SIP presence server (since each long-lived XMPP presence subscription would typically result in multiple subscription refresh requests on the SIP side of a gateway). Therefore, access to an XMPP-to-SIP gateway SHOULD be restricted in various ways; among other things, only an XMPP service that carefully controls account provisioning and provides effective methods for the administrators to control the behavior of registered users ought to host such a gateway (e.g., not a service that offers open account registration), and a gateway ought to be associated only with a single domain or trust realm (e.g., a gateway hosted at simple.example.com ought to allow only users within the example.com domain to access the gateway, not users within example.org, example.net, or any other domain). If a SIP presence server receives communications through an XMPP-to-SIP gateway from users who are not associated with a domain that is so related to the hostname of the gateway, it SHOULD (based on local service provisioning) refuse to service such users or refuse to receive traffic from the gateway. As a further check, whenever an XMPP-to-SIP gateway seeks to refresh an XMPP user's long-lived subscription to a SIP user's presence, it MUST first send an XMPP <presence/> stanza of type "probe" from the address of the gateway to the "bare Jabber ID (JID)" (user@domain.tld) of the XMPP user, to which the user's XMPP server MUST respond in accordance with [RFC6121]; this puts an equal burden on the XMPP server and the SIP server.

长寿命XMPP状态订阅和短命SIP状态订阅之间的不匹配引入了从XMPP网络针对SIP状态服务器发起放大攻击的可能性(因为每个长期存在的XMPP状态订阅通常会在网关的SIP端产生多个订阅刷新请求)因此,对XMPP-to-SIP网关的访问应以各种方式进行限制;除其他外,只有谨慎控制帐户设置并为管理员提供有效方法来控制注册用户行为的XMPP服务才应托管此类网关(例如,不是提供开放帐户注册的服务),网关应仅与单个域或信任域关联(例如,托管在simple.example.com上的网关应仅允许example.com域内的用户访问网关,而不允许example.org、example.net或任何其他域内的用户访问网关)。如果SIP状态服务器通过XMPP-to-SIP网关接收来自与网关主机名不相关的域的用户的通信,则应(基于本地服务配置)拒绝为此类用户提供服务或拒绝接收来自网关的流量。作为进一步检查,每当XMPP-to-SIP网关试图刷新XMPP用户对SIP用户状态的长期订阅时,它必须首先从网关地址向“裸Jabber ID(JID)”发送类型为“probe”的XMPP<presence/>节(user@domain.tld)对于XMPP用户,用户的XMPP服务器必须根据[RFC6121]响应;这给XMPP服务器和SIP服务器带来了相同的负担。

8. References
8. 工具书类
8.1. Normative References
8.1. 规范性引用文件

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。

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

[RFC3261]Rosenberg,J.,Schulzrinne,H.,Camarillo,G.,Johnston,A.,Peterson,J.,Sparks,R.,Handley,M.,和E.Schooler,“SIP:会话启动协议”,RFC 3261,2002年6月。

[RFC3856] Rosenberg, J., "A Presence Event Package for the Session Initiation Protocol (SIP)", RFC 3856, August 2004.

[RFC3856]Rosenberg,J.,“会话启动协议(SIP)的存在事件包”,RFC3856,2004年8月。

[RFC3863] Sugano, H., Fujimoto, S., Klyne, G., Bateman, A., Carr, W., and J. Peterson, "Presence Information Data Format (PIDF)", RFC 3863, August 2004.

[RFC3863]Sugano,H.,Fujimoto,S.,Klyne,G.,Batman,A.,Carr,W.,和J.Peterson,“状态信息数据格式(PIDF)”,RFC 38632004年8月。

[RFC6120] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Core", RFC 6120, March 2011.

[RFC6120]Saint Andre,P.,“可扩展消息和状态协议(XMPP):核心”,RFC61202011年3月。

[RFC6121] Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence", RFC 6121, March 2011.

[RFC6121]圣安德烈,P.,“可扩展消息和状态协议(XMPP):即时消息和状态”,RFC61212011年3月。

[RFC6665] Roach, A., "SIP-Specific Event Notification", RFC 6665, July 2012.

[RFC6665]Roach,A.,“SIP特定事件通知”,RFC 66652012年7月。

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

[RFC7247]Saint Andre,P.,Houri,A.,和J.Hildebrand,“会话启动协议(SIP)和可扩展消息和状态协议(XMPP)之间的互通:架构、地址和错误处理”,RFC 7247,2014年5月。

8.2. Informative References
8.2. 资料性引用

[RFC2778] Day, M., Rosenberg, J., and H. Sugano, "A Model for Presence and Instant Messaging", RFC 2778, February 2000.

[RFC2778]Day,M.,Rosenberg,J.,和H.Sugano,“状态和即时信息模型”,RFC 27782000年2月。

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

[RFC2779]Day,M.,Aggarwal,S.,Mohr,G.,和J.Vincent,“即时消息/存在协议要求”,RFC 27792000年2月。

[RFC3860] Peterson, J., "Common Profile for Instant Messaging (CPIM)", RFC 3860, August 2004.

[RFC3860]Peterson,J.,“即时消息的通用配置文件(CPIM)”,RFC3860,2004年8月。

[RFC3922] Saint-Andre, P., "Mapping the Extensible Messaging and Presence Protocol (XMPP) to Common Presence and Instant Messaging (CPIM)", RFC 3922, October 2004.

[RFC3922]Saint Andre,P.,“将可扩展消息和状态协议(XMPP)映射到公共状态和即时消息(CPIM)”,RFC 3922,2004年10月。

[RFC4480] Schulzrinne, H., Gurbani, V., Kyzivat, P., and J. Rosenberg, "RPID: Rich Presence Extensions to the Presence Information Data Format (PIDF)", RFC 4480, July 2006.

[RFC4480]Schulzrinne,H.,Gurbani,V.,Kyzivat,P.,和J.Rosenberg,“RPID:状态信息数据格式(PIDF)的丰富状态扩展”,RFC 44802006年7月。

[SIMPLE-CPIM-MAPPING] Campbell, B. and J. Rosenberg, "CPIM Mapping of SIMPLE Presence and Instant Messaging", Work in Progress, June 2002.

[SIMPLE-CPIM-MAPPING]Campbell,B.和J.Rosenberg,“简单状态和即时消息的CPIM映射”,正在进行的工作,2002年6月。

[XEP-0107] Saint-Andre, P. and R. Meijer, "User Mood", XSF XEP 0107, October 2008, <http://xmpp.org/extensions/xep-0107.html>.

[XEP-0107]Saint Andre,P.和R.Meijer,“用户情绪”,XSF XEP 0107,2008年10月<http://xmpp.org/extensions/xep-0107.html>.

[XEP-0108] Meijer, R. and P. Saint-Andre, "User Activity", XSF XEP 0108, October 2008, <http://xmpp.org/extensions/xep-0108.html>.

[XEP-0108]Meijer,R.和P.Saint Andre,“用户活动”,XSF XEP 0108,2008年10月<http://xmpp.org/extensions/xep-0108.html>.

Appendix A. Acknowledgements
附录A.确认书

The authors wish to thank the following individuals for their feedback: Chris Christou, Fabio Forno, Adrian Georgescu, Philipp Hancke, Saul Ibarra Corretge, Markus Isomaki, Olle Johansson, Paul Kyzivat, Salvatore Loreto, Michael Lundberg, Daniel-Constantin Mierla, and Tory Patnoe.

作者希望感谢以下个人的反馈:克里斯·克里斯托、法比奥·福诺、阿德里安·乔治斯库、菲利普·汉克、索尔·伊巴拉·科雷奇、马库斯·伊索马基、奥利·约翰森、保罗·基齐瓦特、萨尔瓦托·洛雷托、迈克尔·伦德伯格、丹尼尔·康斯坦丁·米尔拉和托利·帕特诺。

Dave Crocker provided helpful and detailed feedback on behalf of the Applications Area Directorate.

Dave Crocker代表应用领域董事会提供了有用且详细的反馈。

Ben Laurie performed a review on behalf of the Security Directorate, resulting in improvements to the security considerations.

Ben Laurie代表安全理事会进行了审查,从而改进了安全考虑。

During IESG review, Pete Resnick caught several oversights in the document with regard to interoperability.

在IESG审查期间,Pete Resnick发现了文档中关于互操作性的几个疏忽。

The authors gratefully acknowledge the assistance of Markus Isomaki and Yana Stamcheva as the working group chairs and Gonzalo Camarillo as the sponsoring Area Director.

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

Some text in this document was borrowed from [RFC3922].

本文件中的某些文本借用自[RFC3922]。

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

Peter Saint Andre希望感谢Cisco Systems,Inc.在编写本文件早期版本时雇用了他。

Authors' Addresses

作者地址

Peter Saint-Andre &yet

彼得·圣安德烈&还没有

   EMail: ietf@stpeter.im
        
   EMail: ietf@stpeter.im
        

Avshalom Houri IBM Rorberg Building, Pekris 3 Rehovot 76123 Israel

以色列雷霍沃特佩克里斯3号Avshalom Houri IBM Rorberg大楼76123

   EMail: avshalom@il.ibm.com
        
   EMail: avshalom@il.ibm.com
        

Joe Hildebrand Cisco Systems, Inc. 1899 Wynkoop Street, Suite 600 Denver, CO 80202 USA

Joe Hildebrand Cisco Systems,Inc.美国科罗拉多州丹佛市温库普街1899号600室,邮编:80202

   EMail: jhildebr@cisco.com
        
   EMail: jhildebr@cisco.com