source: draft-ietf-stox-presence.xml

Last change on this file was 75, checked in by stpeter@…, 9 years ago

fixes awaiting approval

  • Property svn:mime-type set to text/plain
File size: 71.3 KB
Line 
1<?xml version="1.0"?>
2<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
3<?rfc compact="yes"?>
4<?rfc sortrefs="no"?>
5<?rfc strict="yes"?>
6<?rfc symrefs="yes"?>
7<?rfc toc="yes"?>
8<?rfc tocdepth="3"?>
9<rfc category='std' docName='draft-ietf-stox-presence-09' ipr='trust200902'>
10
11  <front>
12    <title abbrev="SIP-XMPP Interworking: Presence">Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Presence</title>
13    <author initials="P." surname="Saint-Andre" fullname="Peter Saint-Andre">
14      <organization>&amp;yet</organization>
15      <address>
16        <postal>
17          <street>P.O. Box 787</street>
18          <city>Parker</city>
19          <region>CO</region>
20          <code>80134</code>
21          <country>USA</country>
22        </postal>
23        <email>ietf@stpeter.im</email>
24      </address>
25    </author>
26    <author initials="A." surname="Houri" fullname="Avshalom Houri">
27      <organization>IBM</organization>
28      <address>
29        <postal>
30          <street>Rorberg Building, Pekris 3</street>
31          <city>Rehovot</city>
32          <code>76123</code>
33          <country>Israel</country>
34        </postal>
35        <email>avshalom@il.ibm.com</email>
36      </address>
37    </author>
38    <author initials="J." surname="Hildebrand" fullname="Joe Hildebrand">
39      <organization>Cisco Systems, Inc.</organization>
40      <address>
41        <postal>
42          <street>1899 Wynkoop Street, Suite 600</street>
43          <city>Denver</city>
44          <region>CO</region>
45          <code>80202</code>
46          <country>USA</country>
47        </postal>
48        <email>jhildebr@cisco.com</email>
49      </address>
50    </author>
51    <date/>
52    <area>RAI</area>
53    <keyword>XMPP</keyword>
54    <keyword>Jabber</keyword>
55    <keyword>SIP</keyword>
56    <keyword>SIMPLE</keyword>
57    <keyword>IM</keyword>
58    <keyword>Instant Messaging</keyword>
59    <keyword>Presence</keyword>
60    <abstract>
61      <t>This document defines a bi-directional protocol mapping for the exchange of presence information between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP).</t>
62    </abstract>
63  </front>
64
65  <middle>
66
67    <section title="Introduction" anchor="intro">
68      <t>In order to help ensure interworking between presence systems that conform to the instant message / presence requirements <xref target="RFC2779"/>, it is important to clearly define protocol mappings between such systems.  Within the IETF, work has proceeded on two presence technologies:</t>
69      <t>
70        <list style='symbols'>
71          <t>Various extensions to the Session Initiation Protocol (<xref target="RFC3261"/>) for presence, in particular <xref target='RFC3856'/><vspace blankLines='1'/></t>
72          <t>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 <xref target='RFC6120'/> for the XML streaming layer and <xref target='RFC6121'/> for basic presence and instant messaging extensions</t>
73        </list>
74      </t>
75      <t>One approach to helping ensure interworking between these protocols is to map each protocol to the abstract semantics described in <xref target="RFC3860"/>; although that is the approach taken by both <xref target="RFC3922"/> and <xref target="I-D.ietf-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 to XMPP and vice-versa), since that is how existing systems solve the interworking problem.</t>
76      <t>The architectural assumptions underlying such direct mappings are provided in <xref target='I-D.ietf-stox-core'/>, 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.</t>
77    </section>
78
79    <section title="Intended Audience" anchor="audience">
80      <t>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 <xref target='RFC3261'/> and XMPP <xref target='RFC6120'/>, with the base document for this series <xref target='I-D.ietf-stox-core'/>, and with the following presence-related specifications:</t>
81      <t>
82        <list style='symbols'>
83          <t>A Presence Event Package for the Session Initiation Protocol <xref target='RFC3856'/></t>
84          <t>Presence Information Data Format (PIDF) <xref target='RFC3863'/></t>
85          <t>Extensible Messaging and Presence Protocol: Instant Messaging and Presence <xref target='RFC6121'/></t>
86          <t>SIP-Specific Event Notification <xref target='RFC6665'/></t>
87        </list>
88      </t>
89    </section>
90
91    <section title="Terminology" anchor="terms">
92      <t>A number of terms used here (user, contact, subscription, notification, etc.) are explained in <xref target='RFC3261'/>, <xref target='RFC3856'/>, <xref target='RFC6120'/>, and <xref target='RFC6121'/>.  This document uses some, but not all, of the terms defined in the Model for Presence and Instant Messaging <xref target='RFC2778'/>.</t>
93      <t>In flow diagrams, SIP traffic is shown using arrows such as "***&gt;" whereas XMPP traffic is shown using arrows such as "...&gt;".</t>
94      <t>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 <xref target='RFC2119'/>.</t>
95    </section>
96
97    <section title="Subscriptions to Presence Information" anchor="sub">
98      <section title="Overview" anchor="sub-over">
99        <t>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 <xref target="RFC6121"/>.  Presence subscriptions using a SIP event package for presence are specified in <xref target="RFC3856"/>.</t>
100        <t>As described in <xref target="RFC6121"/>, XMPP presence subscriptions are managed using XMPP presence stanzas of type "subscribe", "subscribed", "unsubscribe", and "unsubscribed".  The main subscription states are:</t>
101        <t>
102          <list style='symbols'>
103            <t>"none" (neither the user nor the contact is subscribed to the other's presence information)</t>
104            <t>"from" (the user has a subscription from the contact)</t>
105            <t>"to" (the user has a subscription to the contact's presence information)</t>
106            <t>"both" (both user and contact are subscribed to each other's presence information)</t>
107          </list>
108        </t>
109        <t>As described in <xref target="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 &lt;pres:user@domain&gt; but who might be referenced by a SIP or SIPS URI of the form &lt;sip:user@domain&gt; or &lt;sips:user@domain&gt;.  In practice, 'pres' URIs are rarely used, which is the examples in this document use 'sip' URIs.</t>
110        <t>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 <xref target="RFC3856"/>, so that a subscription needs to be explicitly refreshed if it will have the appearance of being permanent or even of lasting as for 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.</t>
111      </section>
112      <section title="XMPP to SIP" anchor="sub-xmpp">
113        <section title="Establishing a Presence Subscription" anchor="sub-xmpp-establish">
114          <t>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.</t>
115          <figure>
116            <artwork><![CDATA[
117XMPP       XMPP      XMPP-to-SIP    SIP-to-XMPP     SIP          SIP
118User      Server      Gateway        Gateway       Server        User
119 |           |            |              |            |           |
120 | (F1) XMPP |            |              |            |           |
121 | subscribe |            |              |            |           |
122 |..........>|            |              |            |           |
123 |           | (F2) XMPP  |              |            |           |
124 |           | subscribe  |              |            |           |
125 |           |...........>|              |            |           |
126 |           |            | (F3) SIP SUBSCRIBE        |           |
127 |           |            | SUBSCRIBE    |            |           |
128 |           |            |**************************>|           |
129 |           |            |              |            | (F4) SIP  |
130 |           |            |              |            | SUBSCRIBE |
131 |           |            |              |            |**********>|
132 |           |            |              |            | (F5) SIP  |
133 |           |            |              |            | 200 OK    |
134 |           |            |              | (F6) SIP   |<**********|
135 |           |            |              | 200 OK     | (F7) SIP  |
136 |           |            |              |<***********| NOTIFY    |
137 |           |            |              |            |<**********|
138 |           |            |              | (F8) SIP   |           |
139 |           |            |              | NOTIFY     |           |
140 |           |            |              |<***********|           |
141 |           |            |              | (F9) SIP   |           |
142 |           |            |              | 200 OK     |           |
143 |           |            |              |***********>|           |
144 |           |            |              |            | (F10) SIP |
145 |           |    (F11) XMPP subscribed  |            | 200 OK    |
146 |           |<..........................|            |**********>|
147 |           |    (F12) XMPP presence    |            |           |
148 |           |<..........................|            |           |
149 | (F13) XMPP|            |              |            |           |
150 | subscribed|            |              |            |           |
151 |<..........|            |              |            |           |
152 | (F14) XMPP|            |              |            |           |
153 | presence  |            |              |            |           |
154 |<..........|            |              |            |           |
155 |           |            |              |            |           |
156            ]]></artwork>
157          </figure>
158            <t>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":</t>
159          <figure>
160            <preamble>Example 1: XMPP user subscribes to SIP contact (F1)</preamble>
161            <artwork><![CDATA[
162|  <presence from='juliet@example.com'
163|            to='romeo@example.net'
164|            type='subscribe'/>
165            ]]></artwork>
166          </figure>
167          <t>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 <xref target='I-D.ietf-stox-core'/>.  If the domain is a SIP domain, the XMPP server will hand off the presence stanza to an associated XMPP-SIP gateway or connection manager that natively communicates with presence-aware SIP servers.</t>
168          <t>The XMPP-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:</t>
169          <figure>
170            <preamble>Example 2: SIP transformation of XMPP subscription request (F3)</preamble>
171            <artwork><![CDATA[
172|  SUBSCRIBE sip:romeo@example.net SIP/2.0
173|  Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
174|  From: <sip:juliet@example.com>;tag=ffd2
175|  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
176|  Event: presence
177|  Max-Forwards: 70
178|  CSeq: 123 SUBSCRIBE
179|  Contact: <sip:x2s.example.com;transport=tcp>
180|  Accept: application/pidf+xml
181|  Expires: 3600
182|  Content-Length: 0
183            ]]></artwork>
184          </figure>
185          <t>Once the SIP-XMPP gateway has passed the SIP SUBSCRIBE off to the SIP server and the SIP server has delivered the SIP SUBSCRIBE to the SIP user (F4 and F5, no examples shown), the SIP user then would send a response indicating acceptance of the subscription request:</t>
186          <figure>
187            <preamble>Example 3: SIP user accepts subscription request (F5)</preamble>
188            <artwork><![CDATA[
189|  SIP/2.0 200 OK
190|  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
191|  From: <sip:romeo@example.net>;tag=ffd2
192|  To: <sip:juliet@example.com>;tag=j89d
193|  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
194|  CSeq: 234 SUBSCRIBE
195|  Contact: <sip:simple.example.net;transport=tcp>
196|  Expires: 3600
197|  Content-Length: 0
198            ]]></artwork>
199          </figure>
200          <t>In accordance with <xref target='RFC6665'/>, the XMPP-SIP gateway SHOULD consider the subscription state to be "neutral" until it receives a NOTIFY message.  Therefore the SIP user or SIP-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 <xref target="pres"/>).</t>
201          <figure>
202            <preamble>Example 4: SIP user sends presence notification (F7)</preamble>
203            <artwork><![CDATA[
204|  NOTIFY sip:192.0.2.1 SIP/2.0
205|  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
206|  From: <sip:romeo@example.net>;tag=yt66
207|  To: <sip:juliet@example.com>;tag=bi54
208|  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
209|  Event: presence
210|  Subscription-State: active;expires=499
211|  Max-Forwards: 70
212|  CSeq: 8775 NOTIFY
213|  Contact: <sip:simple.example.net;transport=tcp>
214|  Content-Type: application/pidf+xml
215|  Content-Length: 193
216|
217|  <?xml version='1.0' encoding='UTF-8'?>
218|  <presence xmlns='urn:ietf:params:xml:ns:pidf'
219|            entity='pres:romeo@example.net'>
220|    <tuple id='ID-orchard'>
221|      <status>
222|        <basic>open</basic>
223|        <show xmlns='jabber:client'>away</show>
224|      </status>
225|    </tuple>
226|  </presence>
227            ]]></artwork>
228          </figure>
229          <t>In response, the presence-aware SIP-XMPP gateway would send a 200 OK to the SIP user (not shown here since it is not translated into an XMPP stanza).</t>
230          <t>Upon receiving the first NOTIFY with a subscription state of active, the XMPP-SIP gateway MUST generate a presence stanza of type "subscribed":</t>
231          <figure>
232            <preamble>Example 5: XMPP user receives acknowledgement from SIP contact (F13)</preamble>
233            <artwork><![CDATA[
234|  <presence from='romeo@example.net'
235|            to='juliet@example.com'
236|            type='subscribed'/>
237            ]]></artwork>
238          </figure>
239          <t>As described under <xref target="pres"/>, the gateway MUST also generate a presence notification addressed to the XMPP user:</t>
240          <figure>
241            <preamble>Example 6: XMPP user receives presence notification from SIP contact (F14)</preamble>
242            <artwork><![CDATA[
243|  <presence from='romeo@example.net/orchard'
244|            to='juliet@example.com'/>
245            ]]></artwork>
246          </figure>
247        </section>
248        <section title="Refreshing a Presence Subscription" anchor="sub-xmpp-refresh">
249          <t>It is the responsibility of the XMPP-SIP gateway to set the value of the "Expires" header and to periodically renew the subscription on the SIMPLE side of the gateway so that the subscription appears to be permanent to the XMPP user.  For example, the XMPP-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-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.</t>
250          <t>The rules regarding SIP SUBSCRIBE requests for the purpose of establishing and refreshing a presence subscription are provided in <xref target='RFC6665'/>.  Those rules also apply to XMPP-SIP gateways.  Furthermore, an XMPP-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.  <xref target='RFC6665'/> explains more detailed considerations about the handing of SIP responses in relation to subscription requests and refreshes.</t>
251          <t>Finally, see the <xref target='sec'>Security Considerations</xref> of this document for important information and requirements regarding the security implications of subscription refreshes.</t>
252        </section>
253        <section title="Cancelling a Presence Subscription" anchor="sub-xmpp-cancel">
254          <t>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.</t>
255          <figure>
256            <artwork><![CDATA[
257XMPP       XMPP      XMPP-to-SIP    SIP-to-XMPP     SIP          SIP
258User      Server      Gateway        Gateway       Server        User
259 |           |            |              |            |           |
260 | (F15) XMPP|            |              |            |           |
261 |unsubscribe|            |              |            |           |
262 |..........>|            |              |            |           |
263 |           | (F16) XMPP |              |            |           |
264 |           | unsubscribe|              |            |           |
265 |           |...........>|              |            |           |
266 |           |            | (F17) SIP SUBSCRIBE       |           |
267 |           |            | Expires: 0   |            |           |
268 |           |            |**************************>|           |
269 |           |            |              |            | (F18) SIP |
270 |           |            |              |            | SUBSCRIBE |
271 |           |            |              |            | Expires: 0|
272 |           |            |              |            |**********>|
273 |           |            |              |            | (F19) SIP |
274 |           |            |              |            | 200 OK    |
275 |           |            |              |            |<**********|
276 |           |            |              | (F20) SIP  |           |
277 |           |            |              | 200 OK     |           |
278 |           |            |              |<***********|           |
279 |           |  (F21) XMPP unsubscribed  |            |           |
280 |           |<..........................|            |           |
281 | (F22) XMPP|            |              |            |           |
282 | unsub'd   |            |              |            |           |
283 |<..........|            |              |            |           |
284 |           |            |              |            |           |
285            ]]></artwork>
286          </figure>
287          <t>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":</t>
288          <figure>
289            <preamble>Example 7: XMPP user unsubscribes from SIP contact (F15)</preamble>
290            <artwork><![CDATA[
291|  <presence from='juliet@example.com'
292|            to='romeo@example.net'
293|            type='unsubscribe'/>
294            ]]></artwork>
295          </figure>
296          <t>The XMPP-SIP gateway is responsible for translating the unsubscribe command into a SIP SUBSCRIBE request with the "Expires" header set to a value of zero:</t>
297          <figure>
298            <preamble>Example 8: SIP transformation of XMPP unsubscribe (F17)</preamble>
299            <artwork><![CDATA[
300|  SUBSCRIBE sip:romeo@example.net SIP/2.0
301|  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
302|  From: <sip:juliet@example.com>;tag=j89d
303|  Call-ID: 9D9F00DF-FCA9-4E7E-B970-80B638D5218A
304|  Event: presence
305|  Max-Forwards: 70
306|  CSeq: 789 SUBSCRIBE
307|  Contact: <sip:x2s.example.com;transport=tcp>
308|  Accept: application/pidf+xml
309|  Expires: 0
310|  Content-Length: 0
311            ]]></artwork>
312          </figure>
313          <t>Upon sending the transformed unsubscribe, the XMPP-SIP gateway SHOULD send a presence stanza of type "unsubscribed" addressed to the XMPP user:</t>
314          <figure>
315            <preamble>Example 9: XMPP user receives unsubscribed notification (F22)</preamble>
316            <artwork><![CDATA[
317|  <presence from='romeo@example.net'
318|            to='juliet@example.com'
319|            type='unsubscribed'/>
320            ]]></artwork>
321          </figure>
322        </section>
323      </section>
324      <section title="SIP to XMPP" anchor="sub-sip">
325        <section title="Establishing a Presence Subscription" anchor="sub-sip-establish">
326          <t>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.</t>
327          <figure>
328            <artwork><![CDATA[
329SIP        SIP      SIP-to-XMPP    XMPP-to-SIP      XMPP         XMPP
330User      Server      Gateway        Gateway       Server        User
331 |           |            |              |            |           |
332 | (F23) SIP |            |              |            |           |
333 | SUBSCRIBE |            |              |            |           |
334 |**********>|            |              |            |           |
335 |           | (F24) SIP  |              |            |           |
336 |           | SUBSCRIBE  |              |            |           |
337 |           |***********>|              |            |           |
338 |           |            | (F25) XMPP subscribe      |           |
339 |           |            |..........................>|           |
340 |           |            |              |            | (F26) XMPP|
341 |           |            |              |            | subscribe |
342 |           |            |              |            |..........>|
343 |           |            |              |            | (F27) XMPP|
344 |           |            |              |            | subscribed|
345 |           |            |              |            |<..........|
346 |           |            |              | (F28) XMPP |           |
347 |           |            |              | subscribed |           |
348 |           |            |              |<...........|           |
349 |           | (F29) SIP 200 OK          |            |           |
350 |           |<**************************|            |           |
351 | (F30) SIP |            |              |            |           |
352 | 200 OK    |            |              |            |           |
353 |<**********|            |              |            |           |
354 |           |            |              |            |           |
355
356            ]]></artwork>
357          </figure>
358          <t>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:</t>
359          <figure>
360            <preamble>Example 10: SIP user subscribes to XMPP contact (F23)</preamble>
361            <artwork><![CDATA[
362|  SUBSCRIBE sip:juliet@example.com SIP/2.0
363|  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
364|  From: <sip:romeo@example.net>;tag=xfg9
365|  Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
366|  Event: presence
367|  Max-Forwards: 70
368|  CSeq: 263 SUBSCRIBE
369|  Contact: <sip:simple.example.net;transport=tcp>
370|  Accept: application/pidf+xml
371|  Content-Length: 0
372            ]]></artwork>
373          </figure>
374          <t>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.</t>
375          <t>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 <xref target='I-D.ietf-stox-core'/>.  If the domain is an XMPP domain, the SIP server will hand off the SUBSCRIBE to an associated SIP-XMPP gateway or connection manager that natively communicates with XMPP servers.</t>
376          <t>The SIP-XMPP gateway is then responsible for translating the SUBSCRIBE into an XMPP subscription request addressed from the SIP user to the XMPP user:</t>
377          <figure>
378            <preamble>Example 11: XMPP transformation of SIP SUBSCRIBE (F25)</preamble>
379            <artwork><![CDATA[
380|  <presence from='romeo@example.net'
381|            to='juliet@example.com'
382|            type='subscribe'/>
383            ]]></artwork>
384          </figure>
385          <t>In accordance with <xref target='RFC6121'/>, once it receives the stanza from the XMPP-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').</t>
386          <t>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-SIP gateway is responsible for translating the presence stanza of type "subscribed" into a SIP 200 OK response.</t>
387          <t>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-SIP gateway MUST transform that stanza into an empty SIP NOTIFY message with a Subscription-State of "terminated" and a reason of "rejected":</t>
388          <figure>
389            <preamble>Example 12: Subscription request rejected</preamble>
390            <artwork><![CDATA[
391|  NOTIFY sip:192.0.2.2 SIP/2.0
392|  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
393|  From: <sip:juliet@example.com>;tag=ur93
394|  To: <sip:romeo@example.net>;tag=pq72
395|  Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
396|  Event: presence
397|  Subscription-State: terminated;reason=rejected
398|  Max-Forwards: 70
399|  CSeq: 232 NOTIFY
400|  Contact: <sip:x2s.example.com;transport=tcp>
401|  Content-Type: application/pidf+xml
402|  Content-Length: 0
403            ]]></artwork>
404          </figure>
405        </section>
406        <section title="Refreshing a Presence Subscription" anchor="sub-sip-refresh">
407          <t>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-XMPP gateway MUST send a SIP NOTIFY to the user agent (per <xref target='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 <xref target='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 <xref target='RFC6665'/>.</t>
408          <t>Once the SIP user ends its presence session, it is the responsibility of the presence-aware SIP-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:</t>
409          <t><list style='symbols'>
410            <t>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).</t>
411            <t>Maintain the subscription (i.e., treat it as long-lived) and (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" and (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.</t>
412          </list></t>
413          <t>Which of these options a presence-aware SIP-XMPP gateway chooses is up to the implementation.</t>
414          <t>If the implementation chooses the first option, the protocol generated would be as follows:</t>
415          <figure>
416            <preamble>Example 13: XMPP handling of temporary subscription expiry</preamble>
417            <artwork><![CDATA[
418|  <presence from='romeo@example.net'
419|            to='juliet@example.com'
420|            type='unsubscribe'/>
421            ]]></artwork>
422          </figure>
423          <t>If the implementation chooses the second option, the protocol generated would be as follows:</t>
424          <figure>
425            <preamble>Example 14: SIP handling of long-lived subscription expiry</preamble>
426            <artwork><![CDATA[
427|  NOTIFY sip:192.0.2.2 SIP/2.0
428|  Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
429|  From: <sip:juliet@example.com>;tag=ur93
430|  To: <sip:romeo@example.net>;tag=pq72
431|  Call-ID: 2B44E147-3B53-45E4-9D48-C051F3216D14
432|  Event: presence
433|  Subscription-State: terminated;reason=timeout
434|  Max-Forwards: 70
435|  CSeq: 232 NOTIFY
436|  Contact: <sip:x2s.example.com;transport=tcp>
437|  Content-Type: application/pidf+xml
438|  Content-Length: 194
439|
440|  <?xml version='1.0' encoding='UTF-8'?>
441|  <presence xmlns='urn:ietf:params:xml:ns:pidf'
442|            entity='pres:juliet@example.com'>
443|    <tuple id='ID-balcony'>
444|      <status>
445|        <basic>closed</basic>
446|      </status>
447|    </tuple>
448|  </presence>
449            ]]></artwork>
450          </figure>
451          <figure>
452            <preamble>Example 15: XMPP handling of long-lived subscription expiry</preamble>
453            <artwork><![CDATA[
454|  <presence from='romeo@example.net'
455|            to='juliet@example.com'
456|            type='unavailable'/>
457            ]]></artwork>
458          </figure>
459        </section>
460        <section title="Cancelling a Presence Subscription" anchor="sub-sip-cancel">
461          <t>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"):</t>
462          <figure>
463            <preamble>Example 16: SIP user cancels subscription</preamble>
464            <artwork><![CDATA[
465|  SUBSCRIBE sip:juliet@example.com SIP/2.0
466|  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
467|  From: <sip:romeo@example.net>;tag=yt66
468|  Call-ID: 717B1B84-F080-4F12-9F44-0EC1ADE767B9
469|  Event: presence
470|  Max-Forwards: 70
471|  CSeq: 8775 SUBSCRIBE
472|  Contact: <sip:simple.example.net;transport=tcp>
473|  Expires: 0
474|  Content-Length: 0
475            ]]></artwork>
476          </figure>
477          <t>As above, upon receiving such a request, a presence-aware SIP-XMPP gateway is responsible for doing one of the following:</t>
478          <t><list style='symbols'>
479            <t>Cancel the subscription (i.e., treat it as temporary) and send an XMPP presence stanza of type "unsubscribe" to the XMPP contact.</t>
480            <t>Maintain the subscription (i.e., treat it as long-lived) and (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", (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, and (3) send an XMPP presence stanza of type "unavailable" to the XMPP contact.</t>
481          </list></t>
482        </section>
483      </section>
484    </section>
485
486    <section title="Notifications of Presence Information" anchor="pres">
487      <section title="Overview" anchor="pres-over">
488        <t>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 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.</t>
489        <t><xref target="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 <xref target="RFC3856"/>.</t>
490        <t>As described in <xref target="RFC6121"/>, XMPP presence information about an entity is communicated by means of an XML &lt;presence/&gt; 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.</t>
491        <t>As described in <xref target="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 an Presence URI of the form &lt;pres:user@domain&gt; but who might be referenced by a SIP or SIPS URI of the form &lt;sip:user@domain&gt; or &lt;sips:user@domain&gt;.</t>
492        <t>This document addresses basic presence or network availability only, not the various extensions to SIP and XMPP for "rich presence", such as <xref target='RFC4480'/>, <xref target='XEP-0107'/>, and <xref target='XEP-0108'/>.</t>
493      </section>
494      <section title="XMPP to SIP" anchor="pres-xmpp">
495        <t>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 &lt;presence/&gt; stanza.  The syntax of the &lt;presence/&gt; stanza, including required and optional elements and attributes, is defined in <xref target="RFC6121"/>.  The following is an example of such a stanza:</t>
496        <figure>
497          <preamble>Example 17: XMPP user sends presence notification</preamble>
498          <artwork><![CDATA[
499|  <presence from='juliet@example.com/balcony'/>
500          ]]></artwork>
501        </figure>
502        <t>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 <xref target='I-D.ietf-stox-core'/>.  If the domain is a SIP domain, the XMPP server will hand off the presence stanza to an associated XMPP-SIP gateway or connection manager that natively communicates with presence-aware SIP servers (F2, no example shown).</t>
503        <t>The XMPP-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.</t>
504        <figure>
505          <preamble>Example 18: SIP transformation of XMPP presence notification</preamble>
506          <artwork><![CDATA[
507|  NOTIFY sip:192.0.2.2 SIP/2.0
508|  Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
509|  From: <sip:juliet@example.com>;tag=gh19
510|  To: <sip:romeo@example.net>;tag=yt66
511|  Contact: <sip:juliet@example.com>;gr=balcony
512|  Call-ID: 2B44E147-3B53-45E4-9D48-C051F3216D14
513|  Event: presence
514|  Subscription-State: active;expires=599
515|  Max-Forwards: 70
516|  CSeq: 157 NOTIFY
517|  Contact: <sip:x2s.example.com;transport=tcp>
518|  Content-Type: application/pidf+xml
519|  Content-Length: 192
520|
521|  <?xml version='1.0' encoding='UTF-8'?>
522|  <presence xmlns='urn:ietf:params:xml:ns:pidf'
523|            entity='pres:juliet@example.com'>
524|    <tuple id='ID-balcony'>
525|      <status>
526|        <basic>open</basic>
527|        <show xmlns='jabber:client'>away</show>
528|      </status>
529|    </tuple>
530|  </presence>
531          ]]></artwork>
532        </figure>
533        <t>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.)</t>
534        <figure>
535          <preamble>Table 1: Presence syntax mapping from XMPP to SIP</preamble>
536          <artwork><![CDATA[
537   +-----------------------------+---------------------------+
538   |  XMPP Element or Attribute  |  SIP Header or PIDF Data  |
539   +-----------------------------+---------------------------+
540   |  <presence/> stanza         |  "Event: presence" (1)    |
541   +-----------------------------+---------------------------+
542   |  XMPP resource identifer    |  tuple 'id' attribute (2) |
543   +-----------------------------+---------------------------+
544   |  from                       |  From                     |
545   +-----------------------------+---------------------------+
546   |  id                         |  CSeq (3)                 |
547   +-----------------------------+---------------------------+
548   |  to                         |  To                       |
549   +-----------------------------+---------------------------+
550   |  type                       |  basic status (4) (5)     |
551   +-----------------------------+---------------------------+
552   |  xml:lang                   |  Content-Language         |
553   +-----------------------------+---------------------------+
554   |  <priority/>                |  priority for tuple (6)   |
555   +-----------------------------+---------------------------+
556   |  <show/>                    |  no mapping (7)           |
557   +-----------------------------+---------------------------+
558   |  <status/>                  |  <note/>                  |
559   +-----------------------------+---------------------------+
560          ]]></artwork>
561        </figure>
562        <t>Note the following regarding these mappings:</t>
563        <t>
564          <list style='numbers'>
565            <t>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-SIP gateway to a SIP NOTIFY request, since those are the only presence stanzas that represent notifications.</t>
566            <t>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), it is RECOMMENDED to prepend the resourcepart with "ID-" or some other alphabetic string when mapping from XMPP to SIP.</t>
567            <t>In practice, often XMPP presence stanzas do not include the 'id' attribute.</t>
568            <t>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 &lt;basic/&gt; status of "open".  Because a 'type' attribute with a value of "unavailable" indicates that an XMPP entity is not available communications, the gateway SHOULD map that information to a PIDF &lt;basic/&gt; status of "closed".</t>
569            <t>When the XMPP-SIP gateway receives XMPP presence of type "unavailable" from the XMPP contact, it SHOULD (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" and (2) send a SIP SUBSCRIBE request to the SIP user with an "Expires" header set to a value of "0" (zero).</t>
570            <t>The value of the XMPP &lt;priority/&gt; element is an integer between -128 and +127, whereas the the value of the PIDF &lt;contact/&gt; 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 &lt;priority/&gt; element is negative, an XMPP-SIP gateway MUST NOT map the value.  If an XMPP-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).</t>
571            <t>Some implementations support custom extensions to encapsulate this information; however, there is no need to standardize a PIDF extension for this purpose, since PIDF is already extensible and thus the &lt;show/&gt; element can be included directly, qualified by the 'jabber:client' namespace 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 is in that state.</t>
572            <t>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 &lt;show/&gt; 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 is in that state.  Naturally, a gateway can choose to translate a custom extension into an established value of the &lt;show/&gt; element <xref target='RFC6121'/>, or translate a &lt;show/&gt; 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 &lt;show/&gt; element and the custom extension if the gateway cannot suitably translate the custom value into a &lt;show/&gt; value.</t>
573          </list>
574        </t>
575      </section>
576      <section title="SIP to XMPP" anchor="pres-sip">
577        <t>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 <xref target="RFC3856"/>.  The following is an example of such a request:</t>
578        <figure>
579          <preamble>Example 19: SIP user sends presence notification</preamble>
580          <artwork><![CDATA[
581|  NOTIFY sip:192.0.2.1 SIP/2.0
582|  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
583|  From: <sip:romeo@example.net>;tag=yt66
584|  To: <sip:juliet@example.com>;tag=bi54
585|  Contact: <sip:romeo@example.net>;gr=orchard
586|  Call-ID: C33C6C9D-0F4A-42F9-B95C-7CE86B526B5B
587|  Event: presence
588|  Subscription-State: active;expires=499
589|  Max-Forwards: 70
590|  CSeq: 8775 NOTIFY
591|  Contact: <sip:simple.example.net;transport=tcp>
592|  Content-Type: application/pidf+xml
593|  Content-Length: 193
594|
595|  <?xml version='1.0' encoding='UTF-8'?>
596|  <presence xmlns='urn:ietf:params:xml:ns:pidf'
597|            entity='pres:romeo@example.net'>
598|    <tuple id='ID-orchard'>
599|      <status>
600|        <basic>closed</basic>
601|      </status>
602|    </tuple>
603|  </presence>
604          ]]></artwork>
605        </figure>
606        <t>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 <xref target='I-D.ietf-stox-core'/>.  If the domain is an XMPP domain, the SIP server will hand off the NOTIFY to an associated SIP-XMPP gateway or connection manager that natively communicates with XMPP servers.</t>
607        <t>The SIP-XMPP gateway is then responsible for translating the NOTIFY into an XMPP presence stanza addressed from the SIP user to the XMPP user:</t>
608        <figure>
609          <preamble>Example 20: XMPP transformation of SIP presence notification</preamble>
610          <artwork><![CDATA[
611|  <presence from='romeo@example.net'
612|            to='juliet@example.com/balcony'
613|            type='unavailable'/>
614          ]]></artwork>
615        </figure>
616        <t>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.)</t>
617        <figure>
618          <preamble>Table 2: Presence syntax mapping from SIP to XMPP</preamble>
619          <artwork><![CDATA[
620   +---------------------------+-----------------------------+
621   |  SIP Header or PIDF Data  |  XMPP Element or Attribute  |
622   +---------------------------+-----------------------------+
623   |  basic status             |  type (1)                   |
624   +---------------------------+-----------------------------+
625   |  Content-Language         |  xml:lang                   |
626   +---------------------------+-----------------------------+
627   |  CSeq                     |  id (2)                     |
628   +---------------------------+-----------------------------+
629   |  From                     |  from                       |
630   +---------------------------+-----------------------------+
631   |  priority for tuple       |  <priority/> (3)            |
632   +---------------------------+-----------------------------+
633   |  To                       |  to                         |
634   +---------------------------+-----------------------------+
635   |  <note/>                  |  <status/>                  |
636   +---------------------------+-----------------------------+
637   |  <show/>                  |  <show/> (4)                |
638   +---------------------------+-----------------------------+
639          ]]></artwork>
640        </figure>
641        <t>Note the following regarding these mappings:</t>
642        <t><list style='numbers'>
643          <t>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".</t>
644          <t>This mapping is OPTIONAL.</t>
645          <t>See the notes following Table 1 of this document regarding mapping of presence priority.</t>
646          <t>If a SIP implementation supports the &lt;show/&gt; 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-XMPP gateway is responsible for including that element in the XMPP presence notification.</t>
647        </list></t>
648      </section>
649    </section>
650
651    <section title="Requests for Presence Information" anchor="req">
652      <t>Both SIP and XMPP provide methods for requesting presence information about another entity.</t>
653      <section title="XMPP to SIP" anchor="req-xmpp">
654        <t>In XMPP, a request for presence information is completed by sending a presence stanza of type "probe":</t>
655        <figure>
656          <preamble>Example 21: XMPP server sends presence probe on behalf of XMPP user</preamble>
657          <artwork><![CDATA[
658|  <presence from='juliet@example.com/chamber'
659|            to='romeo@example.net'
660|            type='probe'/>
661          ]]></artwork>
662        </figure>
663        <t>Note: As described in <xref target='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.</t>
664        <t>An XMPP-SIP gateway would transform the presence probe into its SIP equivalent, which is a SUBSCRIBE request with an Expires header value of zero:</t>
665        <figure>
666          <preamble>Example 22: SIP transformation of XMPP presence probe</preamble>
667          <artwork><![CDATA[
668|  SUBSCRIBE sip:romeo@example.net SIP/2.0
669|  Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
670|  From: <sip:juliet@example.com>;tag=ffd2
671|  Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
672|  Event: presence
673|  Max-Forwards: 70
674|  CSeq: 123 SUBSCRIBE
675|  Contact: <sip:x2s.example.com;transport=tcp>
676|  Accept: application/pidf+xml
677|  Expires: 0
678|  Content-Length: 0
679          ]]></artwork>
680        </figure>
681        <t>As described in <xref target='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 this document).</t>
682      </section>
683      <section title="SIP to XMPP" anchor="req-sip">
684        <t>In SIP, a request for presence information is effectively completed by sending a SUBSCRIBE with an Expires header value of zero:</t>
685        <figure>
686          <preamble>Example 23: SIP user sends presence request</preamble>
687          <artwork><![CDATA[
688|  SUBSCRIBE sip:juliet@example.com SIP/2.0
689|  Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
690|  From: <sip:romeo@example.net>;tag=yt66
691|  Call-ID: 717B1B84-F080-4F12-9F44-0EC1ADE767B9
692|  Event: presence
693|  Max-Forwards: 70
694|  CSeq: 8775 SUBSCRIBE
695|  Contact: <sip:simple.example.net;transport=tcp>
696|  Expires: 0
697|  Content-Length: 0
698          ]]></artwork>
699        </figure>
700        <t>When honoring the long-lived semantics of an XMPP presence subscription, a presence-aware SIP-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 subscribee:</t>
701        <figure>
702          <preamble>Example 24: XMPP transformation of SIP presence request</preamble>
703          <artwork><![CDATA[
704|  <presence from='romeo@example.net'
705|            to='juliet@example.com'
706|            type='probe'/>
707          ]]></artwork>
708        </figure>
709      </section>
710    </section>
711
712    <section title="IANA Considerations" anchor="iana">
713      <t>This document makes no requests of IANA.</t>
714    </section>
715
716    <section title='Security Considerations' anchor="sec">
717      <t>Detailed security considerations for presence protocols are given in <xref target='RFC2779'/>, for SIP-based presence in <xref target="RFC3856"/> (see also <xref target="RFC3261"/>), and for XMPP-based presence in <xref target="RFC6121"/> (see also <xref target="RFC6120"/>).</t>
718      <t>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-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-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 with the gateway.  As a futher check, whenever an XMPP-SIP gateway seeks to refresh an XMPP user's long-lived subscription to a SIP user's presence, it MUST first send an XMPP &lt;presence/&gt; stanza of type "probe" from the address of the gateway to the "bare JID" (user@domain.tld) of the XMPP user, to which the user's XMPP server MUST respond in accordance with <xref target='RFC6121'/>; this puts an equal burden on the XMPP server as on the SIP server.</t>
719    </section>
720
721  </middle>
722
723  <back>
724
725    <references title="Normative References">
726
727<reference anchor='I-D.ietf-stox-core'>
728<front>
729<title>Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Core</title>
730<author initials='P' surname='Saint-Andre' fullname='Peter Saint-Andre'>
731    <organization />
732</author>
733<author initials='A' surname='Houri' fullname='Avshalom Houri'>
734    <organization />
735</author>
736<author initials='J' surname='Hildebrand' fullname='Joe Hildebrand'>
737    <organization />
738</author>
739<date month='February' day='11' year='2014' />
740<abstract><t>As a foundation for the definition of application-specific, bi-directional protocol mappings between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP), this document specifies the architectural assumptions underlying such mappings as well as the mapping of addresses and error conditions.</t></abstract>
741</front>
742<seriesInfo name='Internet-Draft' value='draft-ietf-stox-core-11' />
743<format type='TXT'
744        target='http://www.ietf.org/internet-drafts/draft-ietf-stox-core-11.txt' />
745</reference>
746
747<reference anchor='RFC2119'>
748  <front>
749    <title abbrev='RFC Key Words'>Key words for use in RFCs to Indicate Requirement Levels</title>
750    <author initials='S.' surname='Bradner' fullname='Scott Bradner'>
751      <organization>Harvard University</organization>
752      <address>
753        <postal>
754          <street>1350 Mass. Ave.</street>
755          <street>Cambridge</street>
756          <street>MA 02138</street>
757        </postal>
758        <phone>- +1 617 495 3864</phone>
759        <email>-</email>
760      </address>
761    </author>
762    <date month='March' year='1997'></date>
763    <area>General</area>
764    <keyword>keyword</keyword>
765    <abstract>
766      <t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized.  This document defines these words as they should be interpreted in IETF documents.  Authors who follow these guidelines should incorporate this phrase near the beginning of their document:
767        <list>
768          <t>The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.</t>
769        </list>
770      </t>
771      <t>Note that the force of these words is modified by the requirement level of the document in which they are used.</t>
772    </abstract>
773  </front>
774  <seriesInfo name='BCP' value='14' />
775  <seriesInfo name='RFC' value='2119' />
776</reference>
777
778<reference anchor='RFC3261'>
779<front>
780<title>SIP: Session Initiation Protocol</title>
781<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
782<organization /></author>
783<author initials='H.' surname='Schulzrinne' fullname='H. Schulzrinne'>
784<organization /></author>
785<author initials='G.' surname='Camarillo' fullname='G. Camarillo'>
786<organization /></author>
787<author initials='A.' surname='Johnston' fullname='A. Johnston'>
788<organization /></author>
789<author initials='J.' surname='Peterson' fullname='J. Peterson'>
790<organization /></author>
791<author initials='R.' surname='Sparks' fullname='R. Sparks'>
792<organization /></author>
793<author initials='M.' surname='Handley' fullname='M. Handley'>
794<organization /></author>
795<author initials='E.' surname='Schooler' fullname='E. Schooler'>
796<organization /></author>
797<date month='June' year='2002' /></front>
798<seriesInfo name='RFC' value='3261' />
799<format type='TXT' octets='647976' target='ftp://ftp.isi.edu/in-notes/rfc3261.txt' />
800</reference>
801
802<reference anchor="RFC3856">
803<front>
804<title>A Presence Event Package for the Session Initiation Protocol (SIP)</title>
805<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
806<organization /></author>
807<date year='2004' month='August' /></front>
808<seriesInfo name='RFC' value='3856' />
809<format type='TXT' octets='62956' target='ftp://ftp.isi.edu/in-notes/rfc3856.txt' />
810</reference>
811
812<reference anchor='RFC3863'>
813<front>
814<title>Presence Information Data Format (PIDF)</title>
815<author initials='H.' surname='Sugano' fullname='H. Sugano'>
816<organization /></author>
817<author initials='S.' surname='Fujimoto' fullname='S. Fujimoto'>
818<organization /></author>
819<author initials='G.' surname='Klyne' fullname='G. Klyne'>
820<organization /></author>
821<author initials='A.' surname='Bateman' fullname='A. Bateman'>
822<organization /></author>
823<author initials='W.' surname='Carr' fullname='W. Carr'>
824<organization /></author>
825<author initials='J.' surname='Peterson' fullname='J. Peterson'>
826<organization /></author>
827<date year='2004' month='August' />
828<abstract>
829<t>This memo specifies the Common Profile for Presence (CPP) Presence Information Data Format (PIDF) as a common presence data format for CPP-compliant Presence protocols, and also defines a new media type "application/pidf+xml" to represent the XML MIME entity for PIDF. [STANDARDS-TRACK]</t></abstract></front>
830<seriesInfo name='RFC' value='3863' />
831<format type='TXT' octets='56956' target='http://www.rfc-editor.org/rfc/rfc3863.txt' />
832</reference>
833
834<reference anchor='RFC6120'>
835<front>
836<title>Extensible Messaging and Presence Protocol (XMPP): Core</title>
837<author initials='P.' surname='Saint-Andre' fullname='P. Saint-Andre'>
838<organization /></author>
839<date year='2011' month='March' />
840<abstract>
841<t>The Extensible Messaging and Presence Protocol (XMPP) is an application profile of the Extensible Markup Language (XML) that enables the near-real-time exchange of structured yet extensible data between any two or more network entities.  This document defines XMPP's core protocol methods: setup and teardown of XML streams, channel encryption, authentication, error handling, and communication primitives for messaging, network availability ("presence"), and request-response interactions.  This document obsoletes RFC 3920. [STANDARDS-TRACK]</t></abstract></front>
842<seriesInfo name='RFC' value='6120' />
843<format type='TXT' octets='451942' target='http://www.rfc-editor.org/rfc/rfc6120.txt' />
844</reference>
845
846<reference anchor='RFC6121'>
847<front>
848<title>Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence</title>
849<author initials='P.' surname='Saint-Andre' fullname='P. Saint-Andre'>
850<organization /></author>
851<date year='2011' month='March' />
852<abstract>
853<t>This document defines extensions to core features of the Extensible Messaging and Presence Protocol (XMPP) that provide basic instant messaging (IM) and presence functionality in conformance with the requirements in RFC 2779.  This document obsoletes RFC 3921. [STANDARDS-TRACK]</t></abstract></front>
854<seriesInfo name='RFC' value='6121' />
855<format type='TXT' octets='244800' target='http://www.rfc-editor.org/rfc/rfc6121.txt' />
856</reference>
857
858<reference anchor='RFC6665'>
859<front>
860<title>SIP-Specific Event Notification</title>
861<author initials='A.B.' surname='Roach' fullname='A.B. Roach'>
862<organization /></author>
863<date year='2012' month='July' />
864<abstract>
865<t>This document describes an extension to the Session Initiation Protocol (SIP) defined by RFC 3261. The purpose of this extension is to provide an extensible framework by which SIP nodes can request notification from remote nodes indicating that certain events have occurred.&lt;/t>&lt;t> Note that the event notification mechanisms defined herein are NOT intended to be a general-purpose infrastructure for all classes of event subscription and notification.&lt;/t>&lt;t> This document represents a backwards-compatible improvement on the original mechanism described by RFC 3265, taking into account several years of implementation experience. Accordingly, this document obsoletes RFC 3265. This document also updates RFC 4660 slightly to accommodate some small changes to the mechanism that were discussed in that document. [STANDARDS-TRACK]</t></abstract></front>
866<seriesInfo name='RFC' value='6665' />
867<format type='TXT' octets='125556' target='http://www.rfc-editor.org/rfc/rfc6665.txt' />
868</reference>
869
870    </references>
871
872    <references title="Informative References">
873
874<reference anchor="I-D.ietf-simple-cpim-mapping">
875<front>
876<title>CPIM Mapping of SIMPLE Presence and Instant Messaging</title>
877<author initials="J" surname="Rosenberg" fullname="Jonathan  Rosenberg">
878    <organization />
879</author>
880<author initials="B" surname="Campbell" fullname="Ben Campbell">
881    <organization />
882</author>
883<date month="June" day="26" year="2002" />
884</front>
885<seriesInfo name="Internet-Draft" value="draft-ietf-simple-cpim-mapping-01" />
886<format type="TXT"
887        target="http://www.ietf.org/internet-drafts/draft-ietf-simple-cpim-mapping-01.txt" />
888</reference>
889
890<reference anchor='RFC2778'>
891<front>
892<title>A Model for Presence and Instant Messaging</title>
893<author initials='M.' surname='Day' fullname='Mark Day'>
894<organization>SightPath, Inc.</organization>
895<address>
896<postal>
897<street>135 Beaver Street</street>
898<city>Waltham</city>
899<region>MA</region>
900<code>02452</code>
901<country>US</country></postal>
902<email>mday@alum.mit.edu</email></address></author>
903<author initials='J.' surname='Rosenberg' fullname='Jonathan Rosenberg'>
904<organization>dynamicsoft</organization>
905<address>
906<postal>
907<street>200 Executive Drive</street>
908<street>Suite 120</street>
909<city>West Orange</city>
910<region>NJ</region>
911<code>07046</code>
912<country>US</country></postal>
913<email>jdrosen@dynamicsoft.com</email></address></author>
914<author initials='H.' surname='Sugano' fullname='Hiroyasu Sugano'>
915<organization>Fujitsu Laboratories Ltd.</organization>
916<address>
917<postal>
918<street>64 Nishiwaki</street>
919<street>Ohkubo-cho</street>
920<city>Akashi</city>
921<region />
922<code>674-8555</code>
923<country>JP</country></postal>
924<email>suga@flab.fujitsu.co.jp</email></address></author>
925<date year='2000' month='February' />
926<abstract>
927<t>This document defines an abstract model for a presence and instant messaging system. It defines the various entities involved, defines terminology, and outlines the services provided by the system. The goal is to provide a common vocabulary for further work on requirements for protocols and markup for presence and instant messaging.</t></abstract></front>
928<seriesInfo name='RFC' value='2778' />
929<format type='TXT' octets='35153' target='http://www.rfc-editor.org/rfc/rfc2778.txt' />
930</reference>
931
932<reference anchor="RFC2779">
933<front>
934<title abbrev='Instant Messaging/Presence Protocol'>Instant Messaging / Presence Protocol Requirements</title>
935<author initials='M.' surname='Day' fullname='Mark Day'>
936<organization>SightPath, Inc.</organization>
937<address>
938<postal>
939<street>135 Beaver Street</street>
940<city>Waltham</city>
941<region>MA</region>
942<code>02452</code>
943<country>US</country></postal>
944<email>mday@alum.mit.edu</email></address></author>
945<author initials='S.' surname='Aggarwal' fullname='Sonu Aggarwal'>
946<organization>Microsoft Corporation</organization>
947<address>
948<postal>
949<street>One Microsoft Way</street>
950<city>Redmond</city>
951<region>WA</region>
952<code>98052</code>
953<country>US</country></postal>
954<email>sonuag@microsoft.com</email></address></author>
955<author initials='J.' surname='Vincent' fullname='Jesse Vincent'>
956<organization>Into Networks, Inc.</organization>
957<address>
958<postal>
959<street>150 Cambridgepark Drive</street>
960<city>Cambridge</city>
961<region>MA</region>
962<code>02140</code>
963<country>US</country></postal>
964<email>jesse@intonet.com</email></address></author>
965<date month='February' year='2000' />
966<abstract>
967<t>Presence and Instant Messaging have recently emerged as a new medium of communications over the Internet.  Presence is a means for finding, retrieving, and subscribing to changes in the presence information (e.g.  "online" or "offline") of other users.  Instant messaging is a means for sending small, simple messages that are delivered immediately to online users.</t>
968<t>Applications of presence and instant messaging currently use independent, non-standard and non-interoperable protocols developed by various vendors.  The goal of the Instant Messaging and Presence Protocol (IMPP) Working Group is to define a standard protocol so that independently developed applications of instant messaging and/or   presence can interoperate across the Internet.  This document defines a minimal set of requirements that IMPP must meet.</t></abstract></front>
969<seriesInfo name='RFC' value='2779' />
970<format type='TXT' octets='47420' target='ftp://ftp.isi.edu/in-notes/rfc2779.txt' />
971</reference>
972
973<reference anchor="RFC3860">
974<front>
975<title>Common Profile for Instant Messaging (CPIM)</title>
976<author initials='J.' surname='Peterson' fullname='J. Peterson'>
977<organization /></author>
978<date year='2004' month='August' /></front>
979<seriesInfo name='RFC' value='3860' />
980<format type='TXT' octets='26486' target='ftp://ftp.isi.edu/in-notes/rfc3860.txt' />
981</reference>
982
983<reference anchor="RFC3922">
984  <front>
985    <title>Mapping the Extensible Messaging and Presence Protocol (XMPP) to Common Presence and Instant Messaging (CPIM)</title>
986    <author initials='P.' surname='Saint-Andre' fullname='P. Saint-Andre'>
987      <organization>Jabber Software Foundation</organization>
988    </author>
989    <date year='2004' month='October' />
990  </front>
991  <seriesInfo name='RFC' value='3922' />
992  <format type='TXT' octets='70790' target='ftp://ftp.isi.edu/in-notes/rfc3922.txt' />
993</reference>
994
995<reference anchor='RFC4480'>
996<front>
997<title>RPID: Rich Presence Extensions to the Presence Information Data Format (PIDF)</title>
998<author initials='H.' surname='Schulzrinne' fullname='H. Schulzrinne'>
999<organization /></author>
1000<author initials='V.' surname='Gurbani' fullname='V. Gurbani'>
1001<organization /></author>
1002<author initials='P.' surname='Kyzivat' fullname='P. Kyzivat'>
1003<organization /></author>
1004<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
1005<organization /></author>
1006<date year='2006' month='July' />
1007<abstract>
1008<t>The Presence Information Data Format (PIDF) defines a basic format for representing presence information for a presentity. This format defines a textual note, an indication of availability (open or closed) and a Uniform Resource Identifier (URI) for communication. The Rich Presence Information Data format (RPID) described here is an extension that adds optional elements to the Presence Information Data Format (PIDF). These extensions provide additional information about the presentity and its contacts. The information is designed so that much of it can be derived automatically, e.g., from calendar files or user activity.&lt;/t>&lt;t> This extension includes information about what the person is doing, a grouping identifier for a tuple, when a service or device was last used, the type of place a person is in, what media communications might remain private, the relationship of a service tuple to another presentity, the person's mood, the time zone it is located in, the type of service it offers, an icon reflecting the presentity's status, and the overall role of the presentity.&lt;/t>&lt;t> These extensions include presence information for persons, services (tuples), and devices. [STANDARDS-TRACK]</t></abstract></front>
1009<seriesInfo name='RFC' value='4480' />
1010<format type='TXT' octets='74026' target='http://www.rfc-editor.org/rfc/rfc4480.txt' />
1011</reference>
1012
1013<reference anchor="XEP-0107">
1014  <front>
1015    <title>User Mood</title>
1016    <author initials="P." surname="Saint-Andre" fullname="Peter Saint-Andre">
1017      <organization/>
1018      <address>
1019        <email>stpeter@jabber.org</email>
1020      </address>
1021    </author>
1022    <author initials="R." surname="Meijer" fullname="Ralph Meijer">
1023      <organization/>
1024      <address>
1025        <email>ralphm@ik.nu</email>
1026      </address>
1027    </author>
1028    <date day="29" month="October" year="2008"/>
1029  </front>
1030  <seriesInfo name="XSF XEP" value="0107"/>
1031  <format type="HTML" target="http://xmpp.org/extensions/xep-0107.html"/>
1032</reference>
1033
1034<reference anchor="XEP-0108">
1035  <front>
1036    <title>User Activity</title>
1037    <author initials="R." surname="Meijer" fullname="Ralph Meijer">
1038      <organization/>
1039      <address>
1040        <email>ralphm@ik.nu</email>
1041      </address>
1042    </author>
1043    <author initials="P." surname="Saint-Andre" fullname="Peter Saint-Andre">
1044      <organization/>
1045      <address>
1046        <email>stpeter@jabber.org</email>
1047      </address>
1048    </author>
1049    <date day="29" month="October" year="2008"/>
1050  </front>
1051  <seriesInfo name="XSF XEP" value="0108"/>
1052  <format type="HTML" target="http://xmpp.org/extensions/xep-0108.html"/>
1053</reference>
1054
1055    </references>
1056
1057    <section title="Acknowledgements" anchor="ack">
1058      <t>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.</t>
1059      <t>Dave Crocker provided helpful and detailed feedback on behalf of the Applications Area Directorate.</t>
1060      <t>Ben Laurie performed a review on behalf of the Security Directorate, resulting in improvements to the security considerations.</t>
1061      <t>During IESG review, Pete Resnick caught several oversights in the document with regard to interoperability.</t>
1062      <t>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.</t>
1063      <t>Some text in this document was borrowed from <xref target='RFC3922'/>.</t>
1064      <t>Peter Saint-Andre wishes to acknowledge Cisco Systems, Inc., for employing him during his work on earlier versions of this document.</t>
1065    </section>
1066
1067  </back>
1068
1069</rfc>
Note: See TracBrowser for help on using the repository browser.