idnits 2.17.1 draft-saintandre-stox-7248bis-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (February 18, 2015) is 3354 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) No issues found here. Summary: 0 errors (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group P. Saint-Andre 3 Internet-Draft &yet 4 Obsoletes: 7248 (if approved) February 18, 2015 5 Intended status: Standards Track 6 Expires: August 22, 2015 8 Interworking between the Session Initiation Protocol (SIP) and the 9 Extensible Messaging and Presence Protocol (XMPP): Presence 10 draft-saintandre-stox-7248bis-01 12 Abstract 14 This document defines a bi-directional protocol mapping for the 15 exchange of presence information between the Session Initiation 16 Protocol (SIP) and the Extensible Messaging and Presence Protocol 17 (XMPP). This document obsoletes RFC 7248. 19 Status of This Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at http://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on August 22, 2015. 36 Copyright Notice 38 Copyright (c) 2015 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (http://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. Code Components extracted from this document must 47 include Simplified BSD License text as described in Section 4.e of 48 the Trust Legal Provisions and are provided without warranty as 49 described in the Simplified BSD License. 51 Table of Contents 53 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 54 2. Intended Audience . . . . . . . . . . . . . . . . . . . . . . 3 55 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 56 4. Subscriptions to Presence Information . . . . . . . . . . . . 4 57 4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 4 58 4.2. XMPP to SIP . . . . . . . . . . . . . . . . . . . . . . . 5 59 4.2.1. Establishing a Presence Subscription . . . . . . . . 5 60 4.2.2. Refreshing a Presence Subscription . . . . . . . . . 9 61 4.2.3. Cancelling a Presence Subscription . . . . . . . . . 9 62 4.3. SIP to XMPP . . . . . . . . . . . . . . . . . . . . . . . 11 63 4.3.1. Establishing a Presence Subscription . . . . . . . . 11 64 4.3.2. Refreshing a Presence Subscription . . . . . . . . . 14 65 4.3.3. Cancelling a Presence Subscription . . . . . . . . . 15 66 5. Notifications of Presence Information . . . . . . . . . . . . 16 67 5.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 16 68 5.2. XMPP to SIP . . . . . . . . . . . . . . . . . . . . . . . 17 69 5.3. SIP to XMPP . . . . . . . . . . . . . . . . . . . . . . . 21 70 6. Requests for Presence Information . . . . . . . . . . . . . . 23 71 6.1. XMPP to SIP . . . . . . . . . . . . . . . . . . . . . . . 23 72 6.2. SIP to XMPP . . . . . . . . . . . . . . . . . . . . . . . 24 73 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 24 74 8. Security Considerations . . . . . . . . . . . . . . . . . . . 24 75 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 25 76 9.1. Normative References . . . . . . . . . . . . . . . . . . 25 77 9.2. Informative References . . . . . . . . . . . . . . . . . 26 78 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 26 79 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 27 81 1. Introduction 83 In order to help ensure interworking between presence systems that 84 conform to the instant message / presence requirements [RFC2779], it 85 is important to clearly define protocol mappings between such 86 systems. Within the IETF, work has proceeded on two presence 87 technologies: 89 o Various extensions to the Session Initiation Protocol ([RFC3261]) 90 for presence, in particular [RFC3856] 92 o The Extensible Messaging and Presence Protocol (XMPP), which 93 consists of a formalization of the core XML streaming protocols 94 developed originally by the Jabber open-source community; the 95 relevant specifications are [RFC6120] for the XML streaming layer 96 and [RFC6121] for basic presence and instant messaging extensions 98 One approach to helping ensure interworking between these protocols 99 is to map each protocol to the abstract semantics described in 100 [RFC3860]; although that is the approach taken by both [RFC3922] and 101 [I-D.ietf-simple-cpim-mapping], to the best of our knowledge that 102 approach has never been implemented. The approach taken in this 103 document is to directly map semantics from one protocol to another 104 (i.e., from SIP/SIMPLE to XMPP and vice-versa), since that is how 105 existing systems solve the interworking problem. 107 The architectural assumptions underlying such direct mappings are 108 provided in [RFC7247], including mapping of addresses and error 109 conditions. The mappings specified in this document cover basic 110 presence functionality. Mapping of more advanced functionality 111 (e.g., so-called "rich presence") is out of scope for this document. 113 This document obsoletes RFC 7248. 115 2. Intended Audience 117 The documents in this series are intended for use by software 118 developers who have an existing system based on one of these 119 technologies (e.g., SIP), and would like to enable communication from 120 that existing system to systems based on the other technology (e.g., 121 XMPP). We assume that readers are familiar with the core 122 specifications for both SIP [RFC3261] and XMPP [RFC6120], with the 123 base document for this series [RFC7247], and with the following 124 presence-related specifications: 126 o A Presence Event Package for the Session Initiation Protocol 127 [RFC3856] 129 o Presence Information Data Format (PIDF) [RFC3863] 131 o Extensible Messaging and Presence Protocol: Instant Messaging and 132 Presence [RFC6121] 134 o SIP-Specific Event Notification [RFC6665] 136 3. Terminology 138 A number of terms used here (user, contact, subscription, 139 notification, etc.) are explained in [RFC3261], [RFC3856], [RFC6120], 140 and [RFC6121]. This document uses some, but not all, of the terms 141 defined in the Model for Presence and Instant Messaging [RFC2778]. 143 In flow diagrams, SIP traffic is shown using arrows such as "***>" 144 whereas XMPP traffic is shown using arrows such as "...>". 146 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 147 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 148 "OPTIONAL" in this document are to be interpreted as described in 149 [RFC2119]. 151 4. Subscriptions to Presence Information 153 4.1. Overview 155 Both XMPP and presence-aware SIP systems enable entities (often but 156 not necessarily human users) to subscribe to the presence of other 157 entities. XMPP presence subscriptions are specified in [RFC6121]. 158 Presence subscriptions using a SIP event package for presence are 159 specified in [RFC3856]. 161 As described in [RFC6121], XMPP presence subscriptions are managed 162 using XMPP presence stanzas of type "subscribe", "subscribed", 163 "unsubscribe", and "unsubscribed". The main subscription states are: 165 o "none" (neither the user nor the contact is subscribed to the 166 other's presence information) 168 o "from" (the user has a subscription from the contact) 170 o "to" (the user has a subscription to the contact's presence 171 information) 173 o "both" (both user and contact are subscribed to each other's 174 presence information) 176 As described in [RFC3856], SIP presence subscriptions are managed 177 through the use of SIP SUBSCRIBE events sent from a SIP user agent to 178 an intended recipient who is most generally referenced by a Presence 179 URI of the form but who might be referenced by a 180 SIP or SIPS URI of the form or . 181 In practice, 'pres' URIs are rarely used, which is the examples in 182 this document use 'sip' URIs. 184 The subscription models underlying XMPP and SIP differ mainly in the 185 fact that XMPP presence subscriptions are long-lived (indeed 186 permanent if not explicitly cancelled, so that a subscription need 187 never be refreshed during any given presence "session"), whereas SIP 188 presence subscriptions are short-lived (the default time-to-live of a 189 SIP presence subscription is 3600 seconds, as specified in 190 Section 6.4 of [RFC3856], so that a subscription needs to be 191 explicitly refreshed if it will have the appearance of being 192 permanent or even of lasting as for the duration of a presence 193 "session"). This disparity has implications for the handling of 194 subscription cancellations in either direction and, from the SIP 195 side, subscription refreshes. 197 4.2. XMPP to SIP 199 4.2.1. Establishing a Presence Subscription 201 The following diagram illustrates the protocol flow for establishing 202 a presence subscription from an XMPP user to a SIP user, as further 203 explained in the text and examples after the diagram. 205 XMPP XMPP SIP SIP 206 User Server Server User 207 | + X2S GW + S2X GW | 208 | | | | 209 | (F1) XMPP | | | 210 | subscribe | | | 211 |...........>| | | 212 | | (F2) SIP | | 213 | | SUBSCRIBE | | 214 | |***********>| | 215 | | | (F3) SIP | 216 | | | SUBSCRIBE | 217 | | |***********>| 218 | | | (F4) SIP | 219 | | | 200 OK | 220 | | |<***********| 221 | | | (F5) SIP | 222 | | | NOTIFY | 223 | | |<***********| 224 | | | (F6) SIP | 225 | | | 200 OK | 226 | | |***********>| 227 | | (F7) XMPP | | 228 | | subscribed | | 229 | |<...........| | 230 | | (F8) XMPP | | 231 | | presence | | 232 | |<...........| | 233 | (F9) XMPP | | | 234 | subscribed | | | 235 |<...........| | | 236 | (F10) XMPP | | | 237 | presence | | | 238 |<...........| | | 239 | | | | 241 An XMPP user (e.g., juliet@example.com) initiates a subscription by 242 sending a subscription request to a contact (e.g., 243 romeo@example.net), and the contact either accepts or declines the 244 request. If the contact accepts the request, the user will have a 245 subscription to the contact's presence information until (1) the user 246 unsubscribes or (2) the contact cancels the subscription. The 247 subscription request is encapsulated in a presence stanza of type 248 "subscribe": 250 Example 1: XMPP user subscribes to SIP contact (F1) 252 | 256 Upon receiving such a presence stanza, the XMPP server to which 257 Juliet has connected needs to determine the identity of the 258 domainpart in the 'to' address, which it does by following the 259 procedures explained in Section 5 of [RFC7247]. If the domain is a 260 SIP domain, the XMPP server will hand off the presence stanza to an 261 associated XMPP-SIP gateway or connection manager that natively 262 communicates with presence-aware SIP servers. 264 The XMPP-SIP gateway is then responsible for translating the XMPP 265 subscription request into a SIP SUBSCRIBE request addressed from the 266 XMPP user to the SIP user: 268 Example 2: SIP transformation of XMPP subscription request (F2) 270 | SUBSCRIBE sip:romeo@example.net SIP/2.0 271 | Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk 272 | From: ;tag=ffd2 273 | Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C 274 | Event: presence 275 | Max-Forwards: 70 276 | CSeq: 1 SUBSCRIBE 277 | Contact: 278 | Accept: application/pidf+xml 279 | Expires: 3600 280 | Content-Length: 0 282 Once the SIP-XMPP gateway has passed the SIP SUBSCRIBE off to the SIP 283 server and the SIP server has delivered the SIP SUBSCRIBE to the SIP 284 user (F3, no example shown), the SIP user then would send a response 285 indicating acceptance of the subscription request: 287 Example 3: SIP user accepts subscription request (F4) 289 | SIP/2.0 200 OK 290 | Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk 291 | From: ;tag=ffd2 292 | To: ;tag=j89d 293 | Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C 294 | CSeq: 1 SUBSCRIBE 295 | Contact: 296 | Expires: 3600 297 | Content-Length: 0 298 In accordance with [RFC6665], the XMPP-SIP gateway SHOULD consider 299 the subscription state to be "neutral" until it receives a NOTIFY 300 message. Therefore the SIP user or SIP-XMPP gateway at the SIP 301 user's domain SHOULD immediately send a NOTIFY message containing a 302 "Subscription-State" header whose value contains the string "active" 303 (see Section 5). 305 Example 4: SIP user sends presence notification (F5) 307 | NOTIFY sip:192.0.2.1 SIP/2.0 308 | Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk 309 | From: ;tag=yt66 310 | To: ;tag=bi54 311 | Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C 312 | Event: presence 313 | Subscription-State: active;expires=499 314 | Max-Forwards: 70 315 | CSeq: 2 NOTIFY 316 | Contact: 317 | Content-Type: application/pidf+xml 318 | Content-Length: 193 319 | 320 | 321 | 323 | 324 | 325 | open 326 | away 327 | 328 | 329 | 331 In response, the presence-aware SIP-XMPP gateway would send a 200 OK 332 to the SIP user (not shown here since it is not translated into an 333 XMPP stanza). 335 Upon receiving the first NOTIFY with a subscription state of active, 336 the XMPP-SIP gateway MUST generate a presence stanza of type 337 "subscribed": 339 Example 5: XMPP user receives acknowledgement from SIP contact (F9) 341 | 344 As described under Section 5, the gateway MUST also generate a 345 presence notification addressed to the XMPP user: 347 Example 6: XMPP user receives presence notification from SIP contact 348 (F10) 350 | 353 4.2.2. Refreshing a Presence Subscription 355 It is the responsibility of the XMPP-SIP gateway to set the value of 356 the "Expires" header and to periodically renew the subscription on 357 the SIMPLE side of the gateway so that the subscription appears to be 358 permanent to the XMPP user. For example, the XMPP-SIP gateway SHOULD 359 send a new SUBSCRIBE request to the SIP user whenever the XMPP user 360 initiates a presence session with the XMPP server by sending initial 361 presence to its XMPP server. The XMPP-SIP gateway also SHOULD send a 362 new SUBSCRIBE request to the SIP user whenever the SIP presence 363 subscription is scheduled to expire during the XMPP user's active 364 presence session. 366 The rules regarding SIP SUBSCRIBE requests for the purpose of 367 establishing and refreshing a presence subscription are provided in 368 [RFC6665]. Those rules also apply to XMPP-SIP gateways. 369 Furthermore, an XMPP-SIP gateway MUST consider the XMPP subscription 370 to be permanently cancelled (and so inform the XMPP user) if it 371 receives a SIP response of 403, 489, or 603. By contrast, it is 372 appropriate to consider a SIP response of 423 or 481 to be a 373 transient error, and to maintain the long-lived XMPP presence 374 subscription. [RFC6665] explains more detailed considerations about 375 the handing of SIP responses in relation to subscription requests and 376 refreshes. 378 Finally, see the Security Considerations (Section 8) of this document 379 for important information and requirements regarding the security 380 implications of subscription refreshes. 382 4.2.3. Cancelling a Presence Subscription 384 The following diagram illustrates the protocol flow for cancelling an 385 XMPP user's presence subscription to a SIP user, as further explained 386 in the text and examples after the diagram. 388 XMPP XMPP SIP SIP 389 User Server Server User 390 | + X2S GW + S2X GW | 391 | | | | 392 | (F11) XMPP | | | 393 |unsubscribe | | | 394 |...........>| | | 395 | | (F12) SIP | | 396 | | SUBSCRIBE | | 397 | | Expires: 0 | | 398 | |***********>| | 399 | | | (F13) SIP | 400 | | | SUBSCRIBE | 401 | | | Expires: 0 | 402 | | |***********>| 403 | | | (F14) SIP | 404 | | | 200 OK | 405 | | |<***********| 406 | | (F15) XMPP | | 407 | | unsub'd | | 408 | |<...........| | 409 | (F16) XMPP | | | 410 | unsub'd | | | 411 |<...........| | | 412 | | | | 414 At any time after subscribing, the XMPP user can unsubscribe from the 415 contact's presence. This is done by sending a presence stanza of 416 type "unsubscribe": 418 Example 7: XMPP user unsubscribes from SIP contact (F11) 420 | 424 The XMPP-SIP gateway is responsible for translating the unsubscribe 425 command into a SIP SUBSCRIBE request with the "Expires" header set to 426 a value of zero: 428 Example 8: SIP transformation of XMPP unsubscribe (F12) 430 | SUBSCRIBE sip:romeo@example.net SIP/2.0 431 | Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk 432 | From: ;tag=j89d 433 | Call-ID: 9D9F00DF-FCA9-4E7E-B970-80B638D5218A 434 | Event: presence 435 | Max-Forwards: 70 436 | CSeq: 1 SUBSCRIBE 437 | Contact: 438 | Accept: application/pidf+xml 439 | Expires: 0 440 | Content-Length: 0 442 Upon sending the transformed unsubscribe, the XMPP-SIP gateway SHOULD 443 send a presence stanza of type "unsubscribed" addressed to the XMPP 444 user: 446 Example 9: XMPP user receives unsubscribed notification (F16) 448 | 452 4.3. SIP to XMPP 454 4.3.1. Establishing a Presence Subscription 456 The following diagram illustrates the protocol flow for establishing 457 a presence subscription from a SIP user to an XMPP user, as further 458 explained in the text and examples after the diagram. 460 SIP SIP XMPP XMPP 461 User Server Server User 462 | + S2X GW + S2X GW | 463 | | | | 464 | (F17) SIP | | | 465 | SUBSCRIBE | | | 466 |**********>| | | 467 | | (F18) XMPP | | 468 | | subscribe | | 469 | |...........>| | 470 | | | (F19) XMPP| 471 | | | subscribe | 472 | | |..........>| 473 | | | (F20) XMPP| 474 | | | subscribed| 475 | | |<..........| 476 | | (F21) SIP | | 477 | | 200 OK | | 478 | |<***********| | 479 | (F22) SIP | | | 480 | 200 OK | | | 481 |<**********| | | 482 | | | | 484 A SIP user initiates a subscription to a contact's presence 485 information by sending a SIP SUBSCRIBE request to the contact. The 486 following is an example of such a request: 488 Example 10: SIP user subscribes to XMPP contact (F17) 490 | SUBSCRIBE sip:juliet@example.com SIP/2.0 491 | Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk 492 | From: ;tag=xfg9 493 | Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11 494 | Event: presence 495 | Max-Forwards: 70 496 | CSeq: 1 SUBSCRIBE 497 | Contact: 498 | Accept: application/pidf+xml 499 | Content-Length: 0 501 Notice that the "Expires" header was not included in the SUBSCRIBE 502 request; this means that the default value of 3600 (i.e., 3600 503 seconds = 1 hour) applies. 505 Upon receiving the SUBSCRIBE, the SIP server needs to determine the 506 identity of the domain portion of the Request-URI or To header, which 507 it does by following the procedures explained in Section 5 of 508 [RFC7247]. If the domain is an XMPP domain, the SIP server will hand 509 off the SUBSCRIBE to an associated SIP-XMPP gateway or connection 510 manager that natively communicates with XMPP servers. 512 The SIP-XMPP gateway is then responsible for translating the 513 SUBSCRIBE into an XMPP subscription request addressed from the SIP 514 user to the XMPP user: 516 Example 11: XMPP transformation of SIP SUBSCRIBE (F18) 518 | 522 In accordance with [RFC6121], once it receives the stanza from the 523 XMPP-SIP gateway, the XMPP user's server MUST deliver the presence 524 subscription request to the XMPP user (or, if a subscription already 525 exists in the XMPP user's roster, the XMPP server SHOULD auto-reply 526 with a presence stanza of type 'subscribed'). 528 If the XMPP user approves the subscription request, the XMPP server 529 then MUST return a presence stanza of type "subscribed" addressed 530 from the XMPP user to the SIP user. The XMPP-SIP gateway is 531 responsible for translating the presence stanza of type "subscribed" 532 into a SIP 200 OK response. 534 If the XMPP user declines the subscription request, the XMPP server 535 then MUST return a presence stanza of type "unsubscribed" addressed 536 from the XMPP user to the SIP user and the XMPP-SIP gateway MUST 537 transform that stanza into an empty SIP NOTIFY message with a 538 Subscription-State of "terminated" and a reason of "rejected": 540 Example 12: Subscription request rejected 542 | NOTIFY sip:192.0.2.2 SIP/2.0 543 | Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk 544 | From: ;tag=ur93 545 | To: ;tag=pq72 546 | Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11 547 | Event: presence 548 | Subscription-State: terminated;reason=rejected 549 | Max-Forwards: 70 550 | CSeq: 2 NOTIFY 551 | Contact: 552 | Content-Type: application/pidf+xml 553 | Content-Length: 0 555 4.3.2. Refreshing a Presence Subscription 557 For as long as a SIP user is online and interested in receiving 558 presence notifications from the XMPP contact, the user's SIP user 559 agent is responsible for periodically refreshing the subscription by 560 sending an updated SUBSCRIBE request with an appropriate value for 561 the Expires header. In response, the presence-aware SIP-XMPP gateway 562 MUST send a SIP NOTIFY to the user agent (per [RFC6665]); if the 563 gateway has meaningful information about the availability state of 564 the XMPP user (e.g., obtained from the core presence session in the 565 XMPP server) then the NOTIFY MUST communicate that information (e.g., 566 by including a PIDF body [RFC3863] with the relevant data), whereas 567 if the gateway does not have meaningful information about the 568 availability state of the XMPP user then the NOTIFY MUST be empty as 569 allowed by [RFC6665]. 571 Once the SIP user ends its presence session, it is the responsibility 572 of the presence-aware SIP-XMPP gateway to properly handle the 573 difference between short-lived SIP presence subscriptions and long- 574 lived XMPP presence subscriptions. The gateway has two options when 575 the SIP user's subscription expires: 577 o Cancel the subscription (i.e., treat it as temporary) and send an 578 XMPP presence stanza of type "unsubscribe" to the XMPP contact; 579 this honors the SIP semantic but will seem strange to the XMPP 580 contact (since it will appear that the SIP user has cancelled a 581 long-lived subscription). 583 o Maintain the subscription (i.e., treat it as long-lived) and (1) 584 send a SIP NOTIFY request to the SIP user containing a PIDF 585 document specifying that the XMPP contact now has a basic status 586 of "closed", including a Subscription-State of "terminated" with a 587 reason of "timeout" and (2) send an XMPP presence stanza of type 588 "unavailable" to the XMPP contact; this violates the letter of the 589 SIP semantic but will seem more natural to the XMPP contact. 591 Which of these options a presence-aware SIP-XMPP gateway chooses is 592 up to the implementation. 594 If the implementation chooses the first option, the protocol 595 generated would be as follows: 597 Example 13: XMPP handling of temporary subscription expiry 599 | 602 If the implementation chooses the second option, the protocol 603 generated would be as follows: 605 Example 14: SIP handling of long-lived subscription expiry 607 | NOTIFY sip:192.0.2.2 SIP/2.0 608 | Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk 609 | From: ;tag=ur93 610 | To: ;tag=pq72 611 | Call-ID: 2B44E147-3B53-45E4-9D48-C051F3216D14 612 | Event: presence 613 | Subscription-State: terminated;reason=timeout 614 | Max-Forwards: 70 615 | CSeq: 6 NOTIFY 616 | Contact: 617 | Content-Type: application/pidf+xml 618 | Content-Length: 194 619 | 620 | 621 | 623 | 624 | 625 | closed 626 | 627 | 628 | 630 Example 15: XMPP handling of long-lived subscription expiry 632 | 636 4.3.3. Cancelling a Presence Subscription 638 At any time, the SIP user can cancel the subscription by sending a 639 SUBSCRIBE message whose "Expires" header is set to a value of zero 640 ("0"): 642 Example 16: SIP user cancels subscription 644 | SUBSCRIBE sip:juliet@example.com SIP/2.0 645 | Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk 646 | From: ;tag=yt66 647 | Call-ID: 717B1B84-F080-4F12-9F44-0EC1ADE767B9 648 | Event: presence 649 | Max-Forwards: 70 650 | CSeq: 1 SUBSCRIBE 651 | Contact: 652 | Expires: 0 653 | Content-Length: 0 655 As above, upon receiving such a request, a presence-aware SIP-XMPP 656 gateway is responsible for doing one of the following: 658 o Cancel the subscription (i.e., treat it as temporary) and send an 659 XMPP presence stanza of type "unsubscribe" to the XMPP contact. 661 o Maintain the subscription (i.e., treat it as long-lived) and (1) 662 send a SIP NOTIFY request to the SIP user containing a PIDF 663 document specifying that the XMPP contact now has a basic status 664 of "closed", (2) send a SIP SUBSCRIBE request to the SIP user with 665 an "Expires" header set to a value of "0" (zero) when it receives 666 XMPP presence of type "unavailable" from the XMPP contact, and (3) 667 send an XMPP presence stanza of type "unavailable" to the XMPP 668 contact. 670 5. Notifications of Presence Information 672 5.1. Overview 674 Both XMPP and presence-aware SIP systems enable entities (often but 675 not necessarily human users) to send presence notifications to other 676 entities. At its most basic, the term "presence" refers to 677 information about an entity's "on/off" availability for communication 678 on a network. Often, this basic concept is supplemented by 679 information that further specifies the entity's context or status 680 while available for communication; these availability states commonly 681 include "away" and "do not disturb". Some systems and protocols 682 extend the concepts of presence and availability even further and 683 refer to any relatively ephemeral information about an entity as a 684 kind of presence; categories of such "extended presence" include 685 geographical location (e.g., GPS coordinates), user mood (e.g., 686 grumpy), user activity (e.g., walking), and ambient environment 687 (e.g., noisy). In this document, we focus on the "least common 688 denominator" of network availability only, although future documents 689 might address broader notions of presence, including availability 690 states and extended presence. 692 [RFC6121] defines how XMPP presence stanzas can indicate availability 693 (via absence of a 'type' attribute) or lack of availability (via a 694 'type' attribute with a value of "unavailable"). SIP presence using 695 a SIP event package for presence is specified in [RFC3856]. 697 As described in [RFC6121], XMPP presence information about an entity 698 is communicated by means of an XML stanza sent over an 699 XML stream. In this document we will assume that such a presence 700 stanza is sent from an XMPP client to an XMPP server over an XML 701 stream negotiated between the client and the server, and that the 702 client is controlled by a human user. In general, XMPP presence is 703 sent by the user to the user's server and then broadcast to all 704 entities who are subscribed to the user's presence information. 706 As described in [RFC3856], presence information about an entity is 707 communicated by means of a SIP NOTIFY event sent from a SIP user 708 agent to an intended recipient who is most generally referenced by an 709 Presence URI of the form but who might be 710 referenced by a SIP or SIPS URI of the form or 711 . 713 This document addresses basic presence or network availability only, 714 not the various extensions to SIP and XMPP for "rich presence", such 715 as [RFC4480], [XEP-0107], and [XEP-0108]. 717 5.2. XMPP to SIP 719 When Juliet interacts with her XMPP client to modify her presence 720 information (or when her client automatically updates her presence 721 information, e.g. via an "auto-away" feature), her client generates 722 an XMPP stanza. The syntax of the stanza, 723 including required and optional elements and attributes, is defined 724 in [RFC6121]. The following is an example of such a stanza: 726 Example 17: XMPP user sends presence notification 728 | 730 Upon receiving such a stanza, the XMPP server to which Juliet has 731 connected broadcasts it to all subscribers who are authorized to 732 receive presence notifications from Juliet (this is similar to the 733 SIP NOTIFY method). For each subscriber, broadcasting the presence 734 notification involves either delivering it to a local recipient (if 735 the hostname in the subscriber's address matches one of the hostnames 736 serviced by the XMPP server) or attempting to route it to the foreign 737 domain that services the hostname in the subscriber's address. Thus 738 the XMPP server needs to determine the identity of the domainpart in 739 the 'to' address, which it does by following the procedures discussed 740 in [RFC7247]. If the domain is a SIP domain, the XMPP server will 741 hand off the presence stanza to an associated XMPP-SIP gateway or 742 connection manager that natively communicates with presence-aware SIP 743 servers. 745 The XMPP-SIP gateway is then responsible for translating the XMPP 746 presence stanza into a SIP NOTIFY request and included PIDF document 747 from the XMPP user to the SIP user. 749 Example 18: SIP transformation of XMPP presence notification 751 | NOTIFY sip:192.0.2.2 SIP/2.0 752 | Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk 753 | From: ;tag=gh19 754 | To: ;tag=yt66 755 | Contact: ;gr=balcony 756 | Call-ID: 2B44E147-3B53-45E4-9D48-C051F3216D14 757 | Event: presence 758 | Subscription-State: active;expires=599 759 | Max-Forwards: 70 760 | CSeq: 2 NOTIFY 761 | Contact: 762 | Content-Type: application/pidf+xml 763 | Content-Length: 192 764 | 765 | 766 | 768 | 769 | 770 | open 771 | away 772 | 773 | 774 | 776 The mapping of XMPP syntax elements to SIP syntax elements MUST be as 777 shown in the following table. (Mappings for elements not mentioned 778 are undefined.) 779 Table 1: Presence syntax mapping from XMPP to SIP 781 +-----------------------------+---------------------------+ 782 | XMPP Element or Attribute | SIP Header or PIDF Data | 783 +-----------------------------+---------------------------+ 784 | stanza | "Event: presence" (1) | 785 +-----------------------------+---------------------------+ 786 | XMPP resource identifer | tuple 'id' attribute (2) | 787 +-----------------------------+---------------------------+ 788 | from | From | 789 +-----------------------------+---------------------------+ 790 | id | CSeq (3) | 791 +-----------------------------+---------------------------+ 792 | to | To | 793 +-----------------------------+---------------------------+ 794 | type | basic status (4) (5) | 795 +-----------------------------+---------------------------+ 796 | xml:lang | Content-Language | 797 +-----------------------------+---------------------------+ 798 | | priority for tuple (6) | 799 +-----------------------------+---------------------------+ 800 | | no mapping (7) | 801 +-----------------------------+---------------------------+ 802 | | | 803 +-----------------------------+---------------------------+ 805 Note the following regarding these mappings: 807 1. Only an XMPP presence stanza that lacks a 'type' attribute or 808 whose 'type' attribute has a value of "unavailable" MUST be 809 mapped by an XMPP-SIP gateway to a SIP NOTIFY request, since 810 those are the only presence stanzas that represent notifications. 812 2. The PIDF schema defines the tuple 'id' attribute as having a 813 datatype of "xs:ID"; because this datatype is more restrictive 814 than the "xs:string" datatype for XMPP resourceparts (in 815 particular, a number is not allowed as the first character of an 816 ID), it is RECOMMENDED to prepend the resourcepart with "ID-" or 817 some other alphabetic string when mapping from XMPP to SIP. 819 3. In practice, often XMPP presence stanzas do not include the 'id' 820 attribute. 822 4. Because the lack of a 'type' attribute indicates that an XMPP 823 entity is available for communications, the gateway MUST map that 824 information to a PIDF status of "open". Because a 825 'type' attribute with a value of "unavailable" indicates that an 826 XMPP entity is not available communications, the gateway MUST map 827 that information to a PIDF status of "closed". 829 5. When the XMPP-SIP gateway receives XMPP presence of type 830 "unavailable" from the XMPP contact, it MUST (1) send a SIP 831 NOTIFY request to the SIP user containing a PIDF document 832 specifying that the XMPP contact now has a basic status of 833 "closed" and (2) send a SIP SUBSCRIBE request to the SIP user 834 with an "Expires" header set to a value of "0" (zero). 836 6. The value of the XMPP element is an integer between 837 -128 and +127, whereas the the value of the PIDF 838 element's 'priority' attribute is a decimal number from zero to 839 one inclusive, with a maximum of three decimal places. If the 840 value of the XMPP element is negative, an XMPP-SIP 841 gateway MUST NOT map the value. If an XMPP-SIP gateway maps 842 positive values, it SHOULD treat XMPP priority 0 as PIDF priority 843 0 and XMPP priority 127 as PIDF priority 1, mapping intermediate 844 values appropriately so that they are unique (e.g., XMPP priority 845 1 to PIDF priority 0.007, XMPP priority 2 to PIDF priority 0.015, 846 and so on up through mapping XMPP priority 126 to PIDF priority 847 0.992; note that this is an example only, and that the exact 848 mapping is up to the implementation). 850 7. Some implementations support custom extensions to encapsulate 851 this information; however, there is no need to standardize a PIDF 852 extension for this purpose, since PIDF is already extensible and 853 thus the element can be included directly, qualified by 854 the 'jabber:client' namespace in the PIDF XML. The examples in 855 this document illustrate this usage, which is RECOMMENDED. The 856 most useful values are likely "away" and "dnd", although note 857 that the latter value merely means "busy" and does not imply that 858 a server or client ought to block incoming traffic while the user 859 is in that state. 861 8. Some implementations support custom extensions to encapsulate 862 detailed information about availability; however, there is no 863 need to standardize a PIDF extension for this purpose, since PIDF 864 is already extensible and thus the element (qualified by 865 the 'jabber:client' namespace) can be included directly in the 866 PIDF XML. The examples in this document illustrate this usage, 867 which is RECOMMENDED. The most useful values are likely "away" 868 and "dnd", although note that the latter value merely means 869 "busy" and does not imply that a server or client ought to block 870 incoming traffic while the user is in that state. Naturally, a 871 gateway can choose to translate a custom extension into an 872 established value of the element [RFC6121], or translate 873 a element into a custom extension that the gateway knows 874 is supported by the user agent of the intended recipient. 875 Unfortunately, this behavior does not guarantee that information 876 will not be lost; to help prevent information loss, a gateway 877 ought to include both the element and the custom 878 extension if the gateway cannot suitably translate the custom 879 value into a value. 881 5.3. SIP to XMPP 883 When Romeo changes his presence, his SIP user agent generates a SIP 884 NOTIFY request for any active subscriptions. The syntax of the 885 NOTIFY request is defined in [RFC3856]. The following is an example 886 of such a request: 888 Example 19: SIP user sends presence notification 890 | NOTIFY sip:192.0.2.1 SIP/2.0 891 | Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk 892 | From: ;tag=yt66 893 | To: ;tag=bi54 894 | Contact: ;gr=orchard 895 | Call-ID: C33C6C9D-0F4A-42F9-B95C-7CE86B526B5B 896 | Event: presence 897 | Subscription-State: active;expires=499 898 | Max-Forwards: 70 899 | CSeq: 8 NOTIFY 900 | Contact: 901 | Content-Type: application/pidf+xml 902 | Content-Length: 193 903 | 904 | 905 | 907 | 908 | 909 | closed 910 | 911 | 912 | 914 Upon receiving the NOTIFY, the SIP server needs to determine the 915 identity of the domain portion of the Request-URI or To header, which 916 it does by following the procedures discussed in [RFC7247]. If the 917 domain is an XMPP domain, the SIP server will hand off the NOTIFY to 918 an associated SIP-XMPP gateway or connection manager that natively 919 communicates with XMPP servers. 921 The SIP-XMPP gateway is then responsible for translating the NOTIFY 922 into an XMPP presence stanza addressed from the SIP user to the XMPP 923 user: 925 Example 20: XMPP transformation of SIP presence notification 927 | 931 The mapping of SIP syntax elements to XMPP syntax elements MUST be as 932 shown in the following table. (Mappings for elements not mentioned 933 are undefined.) 935 Table 2: Presence syntax mapping from SIP to XMPP 937 +---------------------------+-----------------------------+ 938 | SIP Header or PIDF Data | XMPP Element or Attribute | 939 +---------------------------+-----------------------------+ 940 | basic status | type (1) | 941 +---------------------------+-----------------------------+ 942 | Content-Language | xml:lang | 943 +---------------------------+-----------------------------+ 944 | CSeq | id (2) | 945 +---------------------------+-----------------------------+ 946 | From | from | 947 +---------------------------+-----------------------------+ 948 | priority for tuple | (3) | 949 +---------------------------+-----------------------------+ 950 | To | to | 951 +---------------------------+-----------------------------+ 952 | | | 953 +---------------------------+-----------------------------+ 954 | | (4) | 955 +---------------------------+-----------------------------+ 957 Note the following regarding these mappings: 959 1. A PIDF basic status of "open" MUST be mapped to no 'type' 960 attribute, and a PIDF basic status of "closed" MUST be mapped to 961 a 'type' attribute whose value is "unavailable". 963 2. This mapping is OPTIONAL. 965 3. See the notes following Table 1 of this document regarding 966 mapping of presence priority. 968 4. If a SIP implementation supports the element (qualified 969 by the 'jabber:client' namespace) as a PIDF extension for 970 availability status as described in the notes following Table 1 971 of this document, the SIP-XMPP gateway is responsible for 972 including that element in the XMPP presence notification. 974 6. Requests for Presence Information 976 Both SIP and XMPP provide methods for requesting presence information 977 about another entity. 979 6.1. XMPP to SIP 981 In XMPP, a request for presence information is completed by sending a 982 presence stanza of type "probe": 984 Example 21: XMPP server sends presence probe on behalf of XMPP user 986 | 990 Note: As described in [RFC6121], presence probes are used by XMPP 991 servers to request presence on behalf of XMPP users; XMPP clients are 992 discouraged from sending presence probes since retrieving presence is 993 a service that servers provide. 995 An XMPP-SIP gateway would transform the presence probe into its SIP 996 equivalent, which is a SUBSCRIBE request with an Expires header value 997 of zero: 999 Example 22: SIP transformation of XMPP presence probe 1001 | SUBSCRIBE sip:romeo@example.net SIP/2.0 1002 | Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk 1003 | From: ;tag=ffd2 1004 | Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C 1005 | Event: presence 1006 | Max-Forwards: 70 1007 | CSeq: 3 SUBSCRIBE 1008 | Contact: 1009 | Accept: application/pidf+xml 1010 | Expires: 0 1011 | Content-Length: 0 1013 As described in [RFC3856], this cancels any subscription but causes a 1014 NOTIFY to be sent to the subscriber, just as a presence probe does 1015 (the transformation rules for presence notifications have been 1016 previously described in this document). 1018 6.2. SIP to XMPP 1020 In SIP, a request for presence information is effectively completed 1021 by sending a SUBSCRIBE with an Expires header value of zero: 1023 Example 23: SIP user sends presence request 1025 | SUBSCRIBE sip:juliet@example.com SIP/2.0 1026 | Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk 1027 | From: ;tag=yt66 1028 | Call-ID: 717B1B84-F080-4F12-9F44-0EC1ADE767B9 1029 | Event: presence 1030 | Max-Forwards: 70 1031 | CSeq: 2 SUBSCRIBE 1032 | Contact: 1033 | Expires: 0 1034 | Content-Length: 0 1036 When honoring the long-lived semantics of an XMPP presence 1037 subscription, a presence-aware SIP-XMPP gateway MUST translate such a 1038 SIP request into a presence stanza of type 'probe' if it does not 1039 already have presence information about the subscribee: 1041 Example 24: XMPP transformation of SIP presence request 1043 | 1047 7. IANA Considerations 1049 This document makes no requests of IANA. 1051 8. Security Considerations 1053 Detailed security considerations for presence protocols are given in 1054 [RFC2779], for SIP-based presence in [RFC3856] (see also [RFC3261]), 1055 and for XMPP-based presence in [RFC6121] (see also [RFC6120]). 1057 The mismatch between long-lived XMPP presence subscriptions and 1058 short-lived SIP presence subscriptions introduces the possibility of 1059 an amplification attack launched from the XMPP network against a SIP 1060 presence server (since each long-lived XMPP presence subscription 1061 would typically result in multiple subscription refresh requests on 1062 the SIP side of a gateway). Therefore, access to an XMPP-SIP gateway 1063 SHOULD be restricted in various ways; among other things, only an 1064 XMPP service that carefully controls account provisioning and 1065 provides effective methods for the administrators to control the 1066 behavior of registered users ought to host such a gateway (e.g., not 1067 a service that offers open account registration) and a gateway ought 1068 to be associated only with a single domain or trust realm (e.g., a 1069 gateway hosted at simple.example.com ought to allow only users within 1070 the example.com domain to access the gateway, not users within 1071 example.org, example.net, or any other domain). If a SIP presence 1072 server receives communications through an XMPP-SIP gateway from users 1073 who are not associated with a domain that is so related to the 1074 hostname of the gateway, it SHOULD (based on local service 1075 provisioning) refuse to service such users or refuse to receive 1076 traffic from with the gateway. As a futher check, whenever an XMPP- 1077 SIP gateway seeks to refresh an XMPP user's long-lived subscription 1078 to a SIP user's presence, it MUST first send an XMPP 1079 stanza of type "probe" from the address of the gateway to the "bare 1080 JID" (user@domain.tld) of the XMPP user, to which the user's XMPP 1081 server MUST respond in accordance with [RFC6121]; this puts an equal 1082 burden on the XMPP server as on the SIP server. 1084 9. References 1086 9.1. Normative References 1088 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1089 Requirement Levels", BCP 14, RFC 2119, March 1997. 1091 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 1092 A., Peterson, J., Sparks, R., Handley, M., and E. 1093 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 1094 June 2002. 1096 [RFC3856] Rosenberg, J., "A Presence Event Package for the Session 1097 Initiation Protocol (SIP)", RFC 3856, August 2004. 1099 [RFC3863] Sugano, H., Fujimoto, S., Klyne, G., Bateman, A., Carr, 1100 W., and J. Peterson, "Presence Information Data Format 1101 (PIDF)", RFC 3863, August 2004. 1103 [RFC6120] Saint-Andre, P., "Extensible Messaging and Presence 1104 Protocol (XMPP): Core", RFC 6120, March 2011. 1106 [RFC6121] Saint-Andre, P., "Extensible Messaging and Presence 1107 Protocol (XMPP): Instant Messaging and Presence", RFC 1108 6121, March 2011. 1110 [RFC6665] Roach, A., "SIP-Specific Event Notification", RFC 6665, 1111 July 2012. 1113 [RFC7247] Saint-Andre, P., Houri, A., and J. Hildebrand, 1114 "Interworking between the Session Initiation Protocol 1115 (SIP) and the Extensible Messaging and Presence Protocol 1116 (XMPP): Architecture, Addresses, and Error Handling", RFC 1117 7247, May 2014. 1119 9.2. Informative References 1121 [I-D.ietf-simple-cpim-mapping] 1122 Rosenberg, J. and B. Campbell, "CPIM Mapping of SIMPLE 1123 Presence and Instant Messaging", draft-ietf-simple-cpim- 1124 mapping-01 (work in progress), June 2002. 1126 [RFC2778] Day, M., Rosenberg, J., and H. Sugano, "A Model for 1127 Presence and Instant Messaging", RFC 2778, February 2000. 1129 [RFC2779] Day, M., Aggarwal, S., and J. Vincent, "Instant Messaging 1130 / Presence Protocol Requirements", RFC 2779, February 1131 2000. 1133 [RFC3860] Peterson, J., "Common Profile for Instant Messaging 1134 (CPIM)", RFC 3860, August 2004. 1136 [RFC3922] Saint-Andre, P., "Mapping the Extensible Messaging and 1137 Presence Protocol (XMPP) to Common Presence and Instant 1138 Messaging (CPIM)", RFC 3922, October 2004. 1140 [RFC4480] Schulzrinne, H., Gurbani, V., Kyzivat, P., and J. 1141 Rosenberg, "RPID: Rich Presence Extensions to the Presence 1142 Information Data Format (PIDF)", RFC 4480, July 2006. 1144 [XEP-0107] 1145 Saint-Andre, P. and R. Meijer, "User Mood", XSF XEP 0107, 1146 October 2008. 1148 [XEP-0108] 1149 Meijer, R. and P. Saint-Andre, "User Activity", XSF XEP 1150 0108, October 2008. 1152 Appendix A. Acknowledgements 1154 Thanks to the authors, contributors, and other individuals 1155 acknowledged in RFC 7248. 1157 Special thanks to Ben Campbell for identifying the discrepancy that 1158 resulted in the need to obsolete RFC 7248. 1160 Thanks also to Markus Isomaki and Yana Stamcheva as the working group 1161 chairs and Alissa Cooper as the sponsoring Area Director. 1163 Some text in this document was borrowed from [RFC3922]. 1165 Author's Address 1167 Peter Saint-Andre 1168 &yet 1170 Email: peter@andyet.com 1171 URI: https://andyet.com/