-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdraft-ietf-stox-7248bis.xml
1146 lines (1104 loc) · 82 KB
/
draft-ietf-stox-7248bis.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc compact="yes"?>
<?rfc sortrefs="no"?>
<?rfc strict="yes"?>
<?rfc symrefs="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="3"?>
<rfc obsoletes='7248' category='std' docName='draft-ietf-stox-7248bis-14' ipr='trust200902'>
<front>
<title abbrev="SIP-XMPP Interworking: Presence">Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Presence</title>
<author initials="P." surname="Saint-Andre" fullname="Peter Saint-Andre">
<organization>Filament</organization>
<address>
<uri>https://filament.com/</uri>
</address>
</author>
<date/>
<area>RAI</area>
<keyword>Extensible Messaging and Presence Protocol</keyword>
<keyword>XMPP</keyword>
<keyword>Jabber</keyword>
<keyword>Session Initiation Protocol</keyword>
<keyword>SIP</keyword>
<keyword>SIMPLE</keyword>
<keyword>presence</keyword>
<keyword>availability</keyword>
<abstract>
<t>This document defines a bidirectional protocol mapping for the exchange of presence information between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP). This document obsoletes RFC 7248.</t>
</abstract>
</front>
<middle>
<section title="Introduction" anchor="intro">
<t>Presence is information about the availability of an entity (such as network availability or availability for communication). Presence features in both SIP and XMPP involve several aspects:</t>
<t>
<list style='symbols'>
<t>A long-lived authorization for a user to receive notifications about a contact's presence across presence and notification sessions; such an authorization is formally requested by the user, approved (or not) by the contact, and often associated with a record in an address list or "buddy list".</t>
<t>An ephemeral presence session, during which the contact is online (i.e., available for interaction) and after which the contact is offline again.</t>
<t>An ephemeral notification session, during which the user requests presence notifications from the contact (these are implicit in XMPP, but explicit in SIP where they are managed by means of notification dialogs).</t>
<t>Notifications that are sent from the contact to the user for the life of either the contact's presence session or the user's notification session.</t>
</list>
</t>
<t>Although specifications for both SIP and XMPP use the term "subscription", they do so in different ways. In SIP, a "subscription" is the specific mechanism whereby a subscriber (or an entity acting on the subscriber's behalf, such as a server) requests presence notifications from the contact over a relatively short period of time, renewed as necessary to keep receiving presence notifications during a presence session. By contrast, in XMPP a "subscription" is essentially shorthand for a long-lived presence authorization. To prevent confusion, this document uses the term "notification dialog" for a SIP subscription and the term "presence authorization" for an XMPP subscription.</t>
<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>
<t>
<list style='symbols'>
<t>Various extensions to the Session Initiation Protocol (<xref target="RFC3261"/>) for presence, in particular <xref target='RFC3856'/><vspace blankLines='1'/></t>
<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>
</list>
</t>
<t>One approach to helping ensure interworking between these protocols is to map each protocol to the abstract semantics described in <xref target="RFC3860"/>; however, apparently that approach has never been implemented. The approach taken in this document is to directly map semantics from one protocol to another (i.e., from SIP/SIMPLE (SIP for Instant Messaging and Presence Leveraging Extensions) to XMPP and vice versa), because that is how existing systems solve the interworking problem.</t>
<t>The architectural assumptions underlying such direct mappings are provided in <xref target='RFC7247'/>, including mapping of addresses and error conditions. The mappings specified in this document cover basic presence functionality. Mapping of more advanced functionality (e.g., so-called "rich presence") is out of scope for this document.</t>
<t>This document obsoletes RFC 7248.</t>
</section>
<section title="Intended Audience" anchor="audience">
<t>The documents in this series (which include <xref target='RFC7247'/>, <xref target='RFC7572'/>, <xref target='RFC7573'/>, and <xref target='RFC7702'/>) 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='RFC7247'/>, and with the following presence-related specifications:</t>
<t>
<list style='symbols'>
<t>"A Presence Event Package for the Session Initiation Protocol" <xref target='RFC3856'/></t>
<t>"Presence Information Data Format (PIDF)" <xref target='RFC3863'/></t>
<t>"Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence" <xref target='RFC6121'/></t>
<t>"SIP-Specific Event Notification" <xref target='RFC6665'/></t>
</list>
</t>
</section>
<section title="Terminology" anchor="terms">
<t>A number of terms used here (user, contact, notification, etc.) are explained in <xref target='RFC3261'/>, <xref target='RFC3856'/>, <xref target='RFC3857'/>, <xref target='RFC6120'/>, and <xref target='RFC6121'/>. This document uses some, but not all, of the presence-related terms defined in the Model for Presence and Instant Messaging <xref target='RFC2778'/>. In particular, the term "presence session" is used as described in <xref target='RFC6121'/> to mean a delimited time period in which an endpoint is online and available for communications.</t>
<t>In flow diagrams, SIP traffic is shown using arrows such as "***>", whereas XMPP traffic is shown using arrows such as "...>". As in <xref target='RFC7247'/>, the terms "SIP to XMPP Gateway" and "XMPP to SIP Gateway" are abbreviated as "S2X GW" and "X2S GW", respectively.</t>
<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>
</section>
<section title="Architectural Assumptions" anchor="arch">
<t>The fundamental architectural assumptions underlying SIP-XMPP interworking are described in <xref target='RFC7247'/>.</t>
<t>Note that, in SIP, there are two ways that presence services can be deployed on the server side:</t>
<t>
<list style='numbers'>
<t>Under this model, described most fully in <xref target='RFC3857'/>, a dedicated SIP Presence Server handles events related to the presence event package. Instead of forwarding a SUBSCRIBE message to the SIP user, the Presence Server would inform the user of subscription activity using the 'presence.winfo' event package. The SIP User Agent would then authorize the subscribing contact through some interaction with the Presence Server (for instance using XCAP <xref target='RFC4825'/>). Therefore, presence updates from the SIP User Agent would not be sent as NOTIFY messages to the XMPP user but as PUBLISH messages to the Presence Server, which would then generate NOTIFY messages to all active subscribers.</t>
<t>Under this model, a SIP Presence Server acts in proxy mode and merely passes through the SUBSCRIBE and NOTIFY messages to the SIP User Agent.</t>
</list>
</t>
<t>Because the behavior of the XMPP-to-SIP gateway is not changed by the SIP architectural model that is used, the diagrams and protocol flows in this document cover both options by labeling the end entity a "SIP User Agent or Presence Server".</t>
</section>
<section title="Presence Authorizations" anchor="auth">
<section title="Overview" anchor="auth-over">
<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 is specified in <xref target="RFC6121"/>. Presence using a SIP event package is specified in <xref target="RFC3856"/>.</t>
<t>As described in <xref target="RFC6121"/>, XMPP presence authorizations are managed using XMPP <presence/> stanzas of type "subscribe", "subscribed", "unsubscribe", and "unsubscribed". The main states are:</t>
<t>
<list style='symbols'>
<t>"none" (neither the user nor the contact is subscribed to the other's presence information)</t>
<t>"from" (the contact will receive presence notifications from the user)</t>
<t>"to" (the contact will send presence notifications to the user)</t>
<t>"both" (both user and contact will receive each other's presence notifications)</t>
</list>
</t>
<t>As described in <xref target="RFC3856"/>, in SIP the subscriber does not explicitly request the creation or removal of presence authorizations. Rather, the authorizations are triggered by subscription activity. When a SIP user receives an initial SIP SUBSCRIBE event from a contact, the recipient’s SIP User Agent or presence server notifies the user to make an authorization policy decision. This decision is recorded in the User Agent or in a Presence Server, so that in the future any notification dialogs from the contact are automatically approved. (Note that addresses for SIP users and contacts are most generally referenced by a Presence URI of the form <pres:user@domain> but might be referenced by a SIP or SIPS (Session Initiation Protocol Secure) URI of the form <sip:user@domain> or <sips:user@domain>; because in practice 'pres' URIs are rarely used, the examples in this document use 'sip' URIs.)</t>
<t>In both SIP and XMPP, presence authorizations are long-lived (indeed permanent if not explicitly cancelled). In SIP, by default a notification session is typically short-lived unless explicitly extended (the default time-to-live of a SIP notification dialog is 3600 seconds, as specified in Section 6.4 of <xref target="RFC3856"/>, so that a notification dialog needs to be explicitly refreshed in order for a user's notification session to last as long as the contact's presence session). In XMPP, a user's notification session with a contact is almost always automatically handled by the user's server based on the user's presence state (see <xref target="RFC6121"/> for details).</t>
</section>
<section title="XMPP to SIP" anchor="sub-xmpp">
<section title="Requesting a Presence Authorization" anchor="auth-xmpp-establish">
<t>The following diagram illustrates the protocol flow necessary to establish an authorization for an XMPP user to a receive presence notifications from a SIP contact, as further explained in the text and examples after the diagram.</t>
<figure>
<artwork><![CDATA[
XMPP XMPP SIP SIP UA or
Client Server Proxy Presence Server
| + X2S GW | |
| | | |
| (F1) XMPP | | |
| subscribe | | |
|...........>| | |
| | (F2) SIP | |
| | SUBSCRIBE | |
| |***********>| |
| | | (F3) SIP |
| | | SUBSCRIBE |
| | |***********>|
| | | (F4) SIP |
| | | 200 OK |
| | |<***********|
| | (F5) SIP | |
| | 200 OK | |
| |<***********| |
| | | (F6) SIP |
| | | NOTIFY |
| | | (pending) |
| | |<***********|
| | (F7) SIP | |
| | NOTIFY | |
| |<***********| |
| | (F8) SIP | |
| | 200 OK | |
| |***********>| |
| | | (F9) SIP |
| | | 200 OK |
| | |***********>|
| | | (F10) SIP |
| | | NOTIFY |
| | | (active) |
| | |<***********|
| | (F11) SIP | |
| | NOTIFY | |
| |<***********| |
| | (F12) SIP | |
| | 200 OK | |
| |***********>| |
| | | (F13) SIP |
| | | 200 OK |
| | |***********>|
| (F14) XMPP | | |
| subscribed | | |
|<...........| | |
| (F15) XMPP | | |
| presence | | |
|<...........| | |
| | | |
]]></artwork>
</figure>
<t>An XMPP user (e.g., [email protected]) asks for a presence authorization by sending a request to a SIP contact (e.g., [email protected]), and the contact either accepts or declines the request. If the SIP contact accepts the request, the XMPP user will have a long-lived authorization to receive the SIP contact's presence information until (1) the XMPP user unsubscribes or (2) the SIP contact cancels the authorization. The request is encapsulated in a <presence/> stanza of type "subscribe":</t>
<figure>
<preamble>Example 1: XMPP User Subscribes to SIP Contact (F1)</preamble>
<artwork><![CDATA[
| <presence from='[email protected]'
| to='[email protected]'
| type='subscribe'/>
]]></artwork>
</figure>
<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='RFC7247'/>. If the domain is a SIP domain, the XMPP server will hand off the <presence/> stanza to an associated XMPP-to-SIP gateway or connection manager that natively communicates with presence-aware SIP proxies.</t>
<t>The XMPP-to-SIP gateway is then responsible for translating the XMPP request into a SIP SUBSCRIBE request addressed from the XMPP user to the SIP contact:</t>
<figure>
<preamble>Example 2: SIP Transformation of XMPP Presence Authorization Request (F2)</preamble>
<artwork><![CDATA[
| SUBSCRIBE sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=j89d
| Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
| Event: presence
| Max-Forwards: 70
| CSeq: 1 SUBSCRIBE
| Contact: <sip:[email protected]>;gr=yn0cl4bnw0yr3vym
| Accept: application/pidf+xml
| Expires: 3600
| Content-Length: 0
]]></artwork>
</figure>
<t>Once the SIP proxy has delivered the SIP SUBSCRIBE to the SIP User Agent or Presence Server (F3, no example shown), the SIP User Agent then would send a response indicating acceptance of the request:</t>
<figure>
<preamble>Example 3: SIP User Accepts Presence Authorization Request (F4)</preamble>
<artwork><![CDATA[
| SIP/2.0 200 OK
| Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=j89d
| To: <sip:[email protected]>;tag=ffd2
| Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
| CSeq: 1 SUBSCRIBE
| Contact: <sip:[email protected]>;gr=dr4hcr0st3lup4c
| Expires: 3600
| Content-Length: 0
]]></artwork>
</figure>
<t>In accordance with Section 6.7 of <xref target='RFC3856'/>, the XMPP-to-SIP gateway needs to consider the state to be "neutral" until it receives a NOTIFY message with a Subscription-State header <xref target='RFC6665'/> whose value is "active". Therefore, the SIP User Agent or Presence Server SHOULD immediately send such a NOTIFY message (see <xref target="pres"/> below). In case the XMPP-to-SIP gateway initially receives one or more NOTIFY messages with Subscription-State header whose value is "pending" (F6), it MUST respond to them on the SIP side but not generate any presence stanzas towards the XMPP User.</t>
<figure>
<preamble>Example 4: SIP User Agent or Presence Server Sends Presence Notification (F10)</preamble>
<artwork><![CDATA[
| NOTIFY sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=j89d
| To: <sip:[email protected]>;tag=ffd2
| Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
| Event: presence
| Subscription-State: active;expires=499
| Max-Forwards: 70
| CSeq: 2 NOTIFY
| Content-Type: application/pidf+xml
| Content-Length: 193
|
| <?xml version='1.0' encoding='UTF-8'?>
| <presence xmlns='urn:ietf:params:xml:ns:pidf'
| entity='pres:[email protected]'>
| <tuple id='ID-dr4hcr0st3lup4c'>
| <status>
| <basic>open</basic>
| <show xmlns='jabber:client'>away</show>
| </status>
| </tuple>
| </presence>
]]></artwork>
</figure>
<t>Upon receiving the first NOTIFY with a state of active, the XMPP-to-SIP gateway returns a 200 OK to the SIP User Agent or Presence Server (F12, no example shown).</t>
<t>The XMPP-to-SIP gateway also generates a <presence/> stanza of type "subscribed":</t>
<figure>
<preamble>Example 5: XMPP User Receives Acknowledgement from SIP Contact (F14)</preamble>
<artwork><![CDATA[
| <presence from='[email protected]'
| to='[email protected]'
| type='subscribed'/>
]]></artwork>
</figure>
<t>As described in <xref target="pres"/>, if this first NOTIFY in the notification session contains a body then the XMPP-to-SIP gateway also generates a presence notification addressed to the XMPP user (if the NOTIFY does not contain a body then the gateway would interpret it as unknown or "closed"):</t>
<figure>
<preamble>Example 6: XMPP User Receives Presence Notification from SIP Contact (F15)</preamble>
<artwork><![CDATA[
| <presence from='[email protected]/dr4hcr0st3lup4c'
| to='[email protected]'/>
]]></artwork>
</figure>
</section>
<section title="Refreshing a Notification Dialog" anchor="auth-xmpp-refresh">
<t>It is the responsibility of the XMPP-to-SIP gateway to set the value of the Expires header and to periodically renew the notification dialog on the SIMPLE side of the gateway. For example, the XMPP-to-SIP gateway SHOULD send a new SUBSCRIBE request to the SIP contact whenever the XMPP user initiates a presence session with the XMPP server by sending initial presence to its XMPP server (this is functionally equivalent to sending an XMPP presence probe). The XMPP-to-SIP gateway also SHOULD send a new SUBSCRIBE request to the SIP contact sufficiently in advance of when the SIP notification dialog is scheduled to expire during the XMPP user's active presence session.</t>
<t>The rules regarding SIP SUBSCRIBE requests for the purpose of establishing and refreshing a notification dialog are provided in <xref target='RFC6665'/>. Those rules also apply to XMPP-to-SIP gateways. Furthermore, an XMPP-to-SIP gateway MUST consider the XMPP presence authorization 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 honor the long-lived XMPP presence authorization. <xref target='RFC6665'/> explains more detailed considerations about the handling of SIP responses in relation to notification dialogs and refreshes.</t>
<t>Finally, see the security considerations section (<xref target='sec'/>) of this document for important information and requirements regarding the security implications of notification refreshes.</t>
</section>
<section title="Cancelling a Presence Authorization" anchor="auth-xmpp-cancel">
<t>The following diagram illustrates the protocol flow by which an XMPP user cancels her outbound presence authorization with a SIP contact (i.e., indicates that she no longer wishes to be authorized to see the SIP contact's presence). As can be seen, SIMPLE itself does not have a construct that enables a user to cancel her outbound presence authorization (however, in many SIP/SIMPLE implementations she could use a technology such as XCAP <xref target='RFC4825'/> to remove the contact from her address list); therefore, this flow instead results in cancellation of the user's notification dialog (with the implication on the XMPP side that the user will not request a subsequent notification dialog). Additional details are explained in the text and examples after the diagram.</t>
<figure>
<artwork><![CDATA[
XMPP XMPP SIP SIP UA or
Client Server Proxy Presence Server
| + X2S GW | |
| | | |
| (F16) XMPP | | |
|unsubscribe | | |
|...........>| | |
| | (F17) SIP | |
| | SUBSCRIBE | |
| | Expires: 0 | |
| |***********>| |
| | | (F18) SIP |
| | | SUBSCRIBE |
| | | Expires: 0 |
| | |***********>|
| | | (F19) SIP |
| | | 200 OK |
| | |<***********|
| | (F20) SIP | |
| | 200 OK | |
| |<***********| |
| (F21) XMPP | | |
|unsubscribed| | |
|<...........| | |
| | (F22) SIP | |
| | NOTIFY | |
| | terminated | |
| |***********>| |
| | | (F23) SIP |
| | | NOTIFY |
| | | terminated |
| | |***********>|
| | | (F24) SIP |
| | | 200 OK |
| | |<***********|
| | (F25) SIP | |
| | 200 OK | |
| |<***********| |
| | | |
]]></artwork>
</figure>
<t>At any time after subscribing, the XMPP user can indicate that she no longer wishes to be authorized to receive presence notifications from the contact. This is done by sending a <presence/> stanza of type "unsubscribe":</t>
<figure>
<preamble>Example 7: XMPP User Unsubscribes from SIP Contact (F16)</preamble>
<artwork><![CDATA[
| <presence from='[email protected]'
| to='[email protected]'
| type='unsubscribe'/>
]]></artwork>
</figure>
<t>The XMPP-to-SIP gateway is responsible for translating the XMPP unsubscribe command into a SIP SUBSCRIBE request with the Expires header set to a value of zero:</t>
<figure>
<preamble>Example 8: SIP Transformation of XMPP Unsubscribe (F17)</preamble>
<artwork><![CDATA[
| SUBSCRIBE sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=j89d
| To: <sip:[email protected]>;tag=ffd2
| Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
| Event: presence
| Max-Forwards: 70
| CSeq: 42 SUBSCRIBE
| Contact: <sip:[email protected]>;gr=yn0cl4bnw0yr3vym
| Accept: application/pidf+xml
| Expires: 0
| Content-Length: 0
]]></artwork>
</figure>
<t>Upon receiving the SIP 200 OK acknowleding the cancellation, the XMPP-to-SIP gateway SHOULD send a <presence/> stanza of type "unsubscribed" addressed to the XMPP user:</t>
<figure>
<preamble>Example 9: XMPP User Receives Unsubscribed Notification (F21)</preamble>
<artwork><![CDATA[
| <presence from='[email protected]'
| to='[email protected]'
| type='unsubscribed'/>
]]></artwork>
</figure>
<t>In accordance with Section 4.4.1 of <xref target='RFC6665'/>, the XMPP-to-SIP gateway is then responsible for sending a NOTIFY with a "Subscription-State" of "terminated" in order to formally end the XMPP user's outbound presence authorization and the associated SIP dialog.</t>
<figure>
<preamble>Example 10: XMPP-to-SIP Gateway Sends Presence Notification to Terminate Authorization (F25)</preamble>
<artwork><![CDATA[
| NOTIFY sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=j89d
| To: <sip:[email protected]>;tag=ffd2
| Call-ID: 5BCF940D-793D-43F8-8972-218F7F4EAA8C
| Event: presence
| Subscription-State: terminated
| Max-Forwards: 70
| CSeq: 43 NOTIFY
| Content-Length: 0
]]></artwork>
</figure>
<t>Note: When the XMPP user cancels her outbound presence authorization to the SIP user, any inbound authorization that she might have approved (thus enabling the SIP user to see her presence) remains unchanged.</t>
</section>
</section>
<section title="SIP to XMPP" anchor="auth-sip">
<section title="Requesting a Presence Authorization" anchor="auth-sip-establish">
<t>The following diagram illustrates the protocol flow for establishing an authorization for a SIP user to receive presence notifications from an XMPP contact, as further explained in the text and examples after the diagram.</t>
<figure>
<artwork><![CDATA[
SIP SIP XMPP XMPP
UA Proxy Server Client
| + S2X GW | |
| | | |
| (F26) SIP | | |
| SUBSCRIBE | | |
|**********>| | |
| (F27) SIP | | |
| 200 OK | | |
|<**********| | |
| | (F28) XMPP | |
| | subscribe | |
| |...........>| |
| | | (F29) XMPP|
| | | subscribe |
| | |..........>|
| | | (F30) XMPP|
| | | subscribed|
| | |<..........|
| | (F31) XMPP | |
| | subscribed | |
| |<...........| |
| (F32) SIP | | |
| NOTIFY | | |
| (active) | | |
|<**********| | |
| (F33) SIP | | |
| 200 OK | | |
|**********>| | |
| | | |
]]></artwork>
</figure>
<t>A SIP User Agent initiates a presence authorization to an XMPP contact's presence information by sending a SIP SUBSCRIBE request to the contact. The following is an example of such a request:</t>
<figure>
<preamble>Example 11: SIP User Subscribes to XMPP Contact (F26)</preamble>
<artwork><![CDATA[
| SUBSCRIBE sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=xfg9
| To: <sip:[email protected]>
| Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
| Event: presence
| Max-Forwards: 70
| CSeq: 1 SUBSCRIBE
| Contact: <sip:[email protected]>;gr=dr4hcr0st3lup4c
| Accept: application/pidf+xml
| Content-Length: 0
]]></artwork>
</figure>
<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>
<t>Upon receiving the SUBSCRIBE, the SIP proxy needs to determine the identity of the domain portion of the Request-URI, which it does by following the procedures explained in Section 5 of <xref target='RFC7247'/>. If the domain is an XMPP domain, the SIP proxy will hand off the SUBSCRIBE to an associated SIP-to-XMPP gateway or connection manager that natively communicates with XMPP servers.</t>
<t>The SIP-to-XMPP gateway is then responsible for translating the SUBSCRIBE into an XMPP authorization request addressed from the SIP user to the XMPP contact:</t>
<figure>
<preamble>Example 12: XMPP Transformation of SIP SUBSCRIBE (F28)</preamble>
<artwork><![CDATA[
| <presence from='[email protected]'
| to='[email protected]'
| type='subscribe'/>
]]></artwork>
</figure>
<t>In accordance with <xref target='RFC6121'/>, the XMPP user's server delivers the presence authorization request to the XMPP user (or, if an authorization already exists in the XMPP user's roster, the XMPP server SHOULD auto-reply with a <presence/> stanza of type 'subscribed').</t>
<t>The "happy path" is for the XMPP user to approve the presence authorization request by generating a <presence/> stanza of type "subscribed" (F30). The XMPP server then stamps that presence stanza with the 'from' address of the XMPP contact and sends it to the SIP user (F31). Upon receiving the stanza, the SIP-to-XMPP gateway generates an empty SIP NOTIFY message with a Subscription-State header <xref target='RFC6665'/> of "active", which serves to inform the SIP user that the presence authorization request has been approved (F32).</t>
<figure>
<preamble>Example 13: XMPP User Approves Presence Authorization Request (F31)</preamble>
<artwork><![CDATA[
| <presence from='[email protected]'
| to='[email protected]'
| type='subscribed'/>
]]></artwork>
</figure>
<figure>
<preamble>Example 14: Presence Authorization Request Approved (F32)</preamble>
<artwork><![CDATA[
| NOTIFY sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=xfg9
| To: <sip:[email protected]>;tag=ur93
| Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
| Event: presence
| Subscription-State: active
| Max-Forwards: 70
| CSeq: 2 NOTIFY
| Content-Length: 0
]]></artwork>
</figure>
<t>As an alternative to the "happy path", the XMPP user could decline the presence authorization request by generating a <presence/> stanza of type "unsubscribed". The XMPP server would stamp that presence stanza with the 'from' address of the XMPP contact and would send it to the SIP user. The SIP-to-XMPP gateway then transforms that stanza into an empty SIP NOTIFY message with a Subscription-State header <xref target='RFC6665'/> of "terminated" and a reason of "rejected":</t>
<figure>
<preamble>Example 15: XMPP User Rejects Presence Authorization Request</preamble>
<artwork><![CDATA[
| <presence from='[email protected]'
| to='[email protected]'
| type='unsubscribed'/>
]]></artwork>
</figure>
<figure>
<preamble>Example 16: Presence Authorization Request Rejected</preamble>
<artwork><![CDATA[
| NOTIFY sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP s2x.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=xfg9
| To: <sip:[email protected]>;tag=ur93
| Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
| Event: presence
| Subscription-State: terminated;reason=rejected
| Max-Forwards: 70
| CSeq: 2 NOTIFY
| Content-Length: 0
]]></artwork>
</figure>
</section>
<section title="Refreshing a Notification Dialog" anchor="auth-sip-refresh">
<t>For as long as a SIP user is online and wishes to maintain a notification session (i.e., receive presence notifications from the XMPP contact), the user's SIP User Agent is responsible for periodically refreshing the notification dialog by sending an updated SUBSCRIBE request with an appropriate value for the Expires header. In response, the presence-aware SIP-to-XMPP gateway sends a SIP NOTIFY to the user agent (per <xref target='RFC6665'/>); if the SIP-to-XMPP gateway has meaningful information about the availability state of the XMPP user (e.g., obtained from the core presence session in the XMPP server or learned by sending a presence probe as described under <xref target='req'/>) then the NOTIFY communicates that information (e.g., by including a PIDF body <xref target='RFC3863'/> with the relevant data), whereas if the SIP-to-XMPP 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>
</section>
<section title="Cancelling a Presence Authorization" anchor="auth-sip-cancel">
<t>SIP does not directly have a construct for cancelling an outbound presence authorization. Instead, the SIP user would terminate his outbound notification dialog by sending a SUBSCRIBE message whose Expires header is set to a value of zero ("0"), and then never renew it:</t>
<figure>
<preamble>Example 17: SIP User Terminates Notification Dialog</preamble>
<artwork><![CDATA[
| SUBSCRIBE sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=xfg9
| To: <sip:[email protected]>;tag=ur93
| Call-ID: AA5A8BE5-CBB7-42B9-8181-6230012B1E11
| Event: presence
| Max-Forwards: 70
| CSeq: 66 SUBSCRIBE
| Contact: <sip:[email protected]>;gr=dr4hcr0st3lup4c
| Expires: 0
| Content-Length: 0
]]></artwork>
</figure>
<t>A presence-aware SIP-to-XMPP gateway is then responsible for sending a SIP NOTIFY request to the SIP User Agent containing a PIDF document specifying that the XMPP contact now has a basic status of "closed", including a Subscription-State header <xref target='RFC6665'/> of "terminated" with a reason of "timeout"; and sending an XMPP <presence/> stanza of type "unavailable" to the XMPP contact</t>
<t>Note: When the SIP user cancels his outbound presence authorization to the XMPP user, any inbound authorization that he might have approved (enabling the XMPP user to see his presence) remains unchanged.</t>
</section>
</section>
</section>
<section title="Notifications of Presence Information" anchor="pres">
<section title="Overview" anchor="pres-over">
<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). This document focuses 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>
<t>The XMPP instant messaging and presence specification <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>
<t>As described in <xref target="RFC6121"/>, XMPP presence information about an entity is communicated by means of an XML <presence/> stanza sent over an XML stream. This document assumes 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>
<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 a Presence URI of the form <pres:user@domain> but who might be referenced by a SIP or SIPS URI of the form <sip:user@domain> or <sips:user@domain>.</t>
<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>
</section>
<section title="XMPP to SIP" anchor="pres-xmpp">
<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 <presence/> stanza. The syntax of the <presence/> stanza, including required and optional elements and attributes, is defined in <xref target="RFC6121"/>. The following is an example of such a stanza:</t>
<figure>
<preamble>Example 18: XMPP User Sends Presence Notification</preamble>
<artwork><![CDATA[
| <presence from='[email protected]/yn0cl4bnw0yr3vym'/>
]]></artwork>
</figure>
<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 and who have indicated a current interest in receiving notifications (this is similar to the SIP NOTIFY method). For each subscriber, broadcasting the presence notification involves adding the 'to' address of the subscriber and then either delivering the notification 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. If the notification is bound for an address at a foreign domain, 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='RFC7247'/>. If the domain is a SIP domain, the XMPP server will hand off the <presence/> stanza to an associated XMPP-to-SIP gateway or connection manager that natively communicates with presence-aware SIP proxy (no example shown).</t>
<t>The XMPP-to-SIP gateway is then responsible for translating the XMPP <presence/> stanza into a SIP NOTIFY request and included PIDF document from the XMPP user to the SIP contact.</t>
<figure>
<preamble>Example 19: SIP Transformation of XMPP Presence Notification</preamble>
<artwork><![CDATA[
| NOTIFY sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=gh19
| To: <sip:[email protected]>
| Contact: <sip:[email protected]>;gr=yn0cl4bnw0yr3vym
| Call-ID: 2B44E147-3B53-45E4-9D48-C051F3216D14
| Event: presence
| Subscription-State: active;expires=599
| Max-Forwards: 70
| CSeq: 2 NOTIFY
| Content-Type: application/pidf+xml
| Content-Length: 192
|
| <?xml version='1.0' encoding='UTF-8'?>
| <presence xmlns='urn:ietf:params:xml:ns:pidf'
| entity='pres:[email protected]'>
| <tuple id='ID-yn0cl4bnw0yr3vym'>
| <status>
| <basic>open</basic>
| <show xmlns='jabber:client'>away</show>
| </status>
| </tuple>
| </presence>
]]></artwork>
</figure>
<t>The mapping of XMPP syntax elements to SIP syntax elements MUST be as shown in the following table. (Mappings for elements not mentioned are undefined.)</t>
<figure>
<artwork><![CDATA[
+-----------------------------+---------------------------+
| XMPP Element or Attribute | SIP Header or PIDF Data |
+-----------------------------+---------------------------+
| <presence/> stanza | "Event: presence" (1) |
+-----------------------------+---------------------------+
| XMPP resource identifier | tuple 'id' attribute (2) |
+-----------------------------+---------------------------+
| from | From |
+-----------------------------+---------------------------+
| id | no mapping (3) |
+-----------------------------+---------------------------+
| to | To |
+-----------------------------+---------------------------+
| type | basic status (4) (5) |
+-----------------------------+---------------------------+
| xml:lang | Content-Language |
+-----------------------------+---------------------------+
| <priority/> | priority for tuple (6) |
+-----------------------------+---------------------------+
| <show/> | no mapping (7) |
+-----------------------------+---------------------------+
| <status/> | <note/> |
+-----------------------------+---------------------------+
]]></artwork>
<postamble>Table 1: Presence Syntax Mapping from XMPP to SIP</postamble>
</figure>
<t>Note the following regarding these mappings:</t>
<t>
<list style='numbers'>
<t>Only an XMPP <presence/> stanza that lacks a 'type' attribute or whose 'type' attribute has a value of "unavailable" MUST be mapped by an XMPP-to-SIP gateway to a SIP NOTIFY request, because those are the only <presence/> stanzas that represent notifications.</t>
<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>
<t>In practice, XMPP <presence/> stanzas often do not include the 'id' attribute.</t>
<t>Because the lack of a 'type' attribute indicates that an XMPP entity is available for communications, the XMPP-to-SIP gateway MUST map that information to a PIDF basic status of "open". Because a 'type' attribute with a value of "unavailable" indicates that an XMPP entity is not available communications, the XMPP-to-SIP gateway MUST map that information to a PIDF <basic/> status of "closed".</t>
<t>When the XMPP-to-SIP gateway receives XMPP presence of type "unavailable" from the XMPP contact, it sends a SIP NOTIFY request from the XMPP contact to the SIP User Agent containing a PIDF document specifying that the XMPP contact now has a basic status of "closed".</t>
<t>The value of the XMPP <priority/> element is an integer between -128 and +127, whereas the value of the PIDF <contact/> element's 'priority' attribute is a decimal number from zero to one inclusive, with a maximum of three decimal places. If the value of the XMPP <priority/> element is negative, an XMPP-to-SIP gateway MUST NOT map the value. If an XMPP-to-SIP gateway maps positive values, it SHOULD treat XMPP priority 0 as PIDF priority 0 and XMPP priority 127 as PIDF priority 1, mapping intermediate values appropriately so that they are unique (e.g., XMPP priority 1 to PIDF priority 0.007, XMPP priority 2 to PIDF priority 0.015, and so on up through mapping XMPP priority 126 to PIDF priority 0.992; note that this is an example only and that the exact mapping is up to the implementation).</t>
<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, because PIDF is already extensible and thus the <show/> element (qualified by the 'jabber:client' namespace) can be included directly in the PIDF XML. The examples in this document illustrate this usage, which is RECOMMENDED. The most useful values are likely "away" and "dnd", although note that the latter value merely means "busy" and does not imply that a server or client ought to block incoming traffic while the user is in that state. Naturally, an XMPP-to-SIP gateway can choose to translate a custom extension into an established value of the <show/> element <xref target='RFC6121'/> or translate a <show/> element into a custom extension that the XMPP-to-SIP 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, an XMPP-to-SIP gateway ought to include both the <show/> element and the custom extension if it cannot suitably translate the custom value into a <show/> value. However, there is no guarantee that the SIP receiver will render a standard XMPP <show/> value or custom extension.</t>
</list>
</t>
<t>In XMPP, a user can connect with multiple devices at the same time <xref target='RFC6120'/>; for presence notification purposes <xref target='RFC6121'/>, each device is associated with a distinct resourcepart <xref target='RFC7622'/> and a contact's user agent will receive a separate presence notification from each of the user's devices. Although the interpretation of multiple presence notifications from a single user is a matter of implementation by the contact's user agent, typically the user agent will show the "most available" status for the contact (e.g., if the user is online with three devices, one of which is away, one of which is in do not disturb mode, and one of which is available with no qualifications, then the status shown will simply be available. In SIP, it is reasonable for a user agent to model multiple presence notifications from an XMPP user in the same way that it would handle multiple tuples from a SIP user.</t>
</section>
<section title="SIP to XMPP" anchor="pres-sip">
<t>When Romeo changes his presence, his SIP User Agent generates a SIP NOTIFY request for any contacts that have presence authorizations and notification sessions. The syntax of the NOTIFY request is defined in <xref target="RFC3856"/>. The following is an example of such a request:</t>
<figure>
<preamble>Example 20: SIP User Sends Presence Notification</preamble>
<artwork><![CDATA[
| NOTIFY sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=yt66
| To: <sip:[email protected]>;tag=bi54
| Contact: <sip:[email protected]>;gr=dr4hcr0st3lup4c
| Call-ID: C33C6C9D-0F4A-42F9-B95C-7CE86B526B5B
| Event: presence
| Subscription-State: active;expires=499
| Max-Forwards: 70
| CSeq: 8 NOTIFY
| Content-Type: application/pidf+xml
| Content-Length: 193
|
| <?xml version='1.0' encoding='UTF-8'?>
| <presence xmlns='urn:ietf:params:xml:ns:pidf'
| entity='pres:[email protected]'>
| <tuple id='ID-dr4hcr0st3lup4c'>
| <status>
| <basic>closed</basic>
| </status>
| </tuple>
| </presence>
]]></artwork>
</figure>
<t>Upon receiving the NOTIFY, the SIP proxy needs to determine the identity of the domain portion of the Request-URI, which it does by following the procedures discussed in <xref target='RFC7247'/>. If the domain is an XMPP domain, the SIP proxy will hand off the NOTIFY to an associated SIP-to-XMPP gateway or connection manager that natively communicates with XMPP servers.</t>
<t>The SIP-to-XMPP gateway is then responsible for translating the NOTIFY into an XMPP <presence/> stanza addressed from the SIP user to the XMPP contact:</t>
<figure>
<preamble>Example 21: XMPP Transformation of SIP Presence Notification</preamble>
<artwork><![CDATA[
| <presence from='[email protected]'
| to='[email protected]/yn0cl4bnw0yr3vym'
| type='unavailable'/>
]]></artwork>
</figure>
<t>The mapping of SIP syntax elements to XMPP syntax elements MUST be as shown in the following table. (Mappings for elements not mentioned are undefined.)</t>
<figure>
<artwork><![CDATA[
+---------------------------+-----------------------------+
| SIP Header or PIDF Data | XMPP Element or Attribute |
+---------------------------+-----------------------------+
| basic status | type (1) |
+---------------------------+-----------------------------+
| Content-Language | xml:lang |
+---------------------------+-----------------------------+
| From | from |
+---------------------------+-----------------------------+
| priority for tuple | <priority/> (2) |
+---------------------------+-----------------------------+
| To | to |
+---------------------------+-----------------------------+
| <note/> | <status/> |
+---------------------------+-----------------------------+
| <show/> | <show/> (3) |
+---------------------------+-----------------------------+
]]></artwork>
<postamble>Table 2: Presence Syntax Mapping from SIP to XMPP</postamble>
</figure>
<t>Note the following regarding these mappings:</t>
<t><list style='numbers'>
<t>A PIDF basic status of "open" MUST be mapped to no 'type' attribute, and a PIDF basic status of "closed" MUST be mapped to a 'type' attribute whose value is "unavailable".</t>
<t>See the notes following Table 1 of this document regarding mapping of presence priority.</t>
<t>If a SIP implementation supports the <show/> element (qualified by the 'jabber:client' namespace) as a PIDF extension for availability status as described in the notes following Table 1 of this document, the SIP-to-XMPP gateway is responsible for including that element in the XMPP presence notification.</t>
</list></t>
</section>
</section>
<section title="Polling for Presence Information" anchor="req">
<t>Both SIP and XMPP provide methods for explicitly requesting one-time information about the current presence status of another entity. These are "polling" methods as opposed to the subscribing methods described in the rest of this document.</t>
<section title="XMPP to SIP" anchor="req-xmpp">
<t>In XMPP, an explicit request for information about current presence status is completed by sending a <presence/> stanza of type "probe":</t>
<figure>
<preamble>Example 22: XMPP Server Sends Presence Probe on Behalf of XMPP User</preamble>
<artwork><![CDATA[
| <presence from='[email protected]/chamber'
| to='[email protected]'
| type='probe'/>
]]></artwork>
</figure>
<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, because retrieving presence is a service that servers provide automatically.</t>
<t>A SIP-to-XMPP gateway would transform the presence probe into its SIP equivalent, which is a SUBSCRIBE request with an Expires header value of zero in a new dialog:</t>
<figure>
<preamble>Example 23: SIP Transformation of XMPP Presence Probe</preamble>
<artwork><![CDATA[
| SUBSCRIBE sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP x2s.example.com;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=j89d
| Call-ID: 2398B737-566F-4CBB-A21A-1F8EEF7AF423
| Event: presence
| Max-Forwards: 70
| CSeq: 1 SUBSCRIBE
| Contact: <sip:[email protected]>;gr=yn0cl4bnw0yr3vym
| Accept: application/pidf+xml
| Expires: 0
| Content-Length: 0
]]></artwork>
</figure>
<t>As described in <xref target='RFC3856'/>, this 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 <xref target='pres-xmpp'/> of this document).</t>
</section>
<section title="SIP to XMPP" anchor="req-sip">
<t>In SIP, an explicit request for information about current presence status is effectively completed by sending a SUBSCRIBE with an Expires header value of zero:</t>
<figure>
<preamble>Example 24: SIP User Sends Presence Request</preamble>
<artwork><![CDATA[
| SUBSCRIBE sip:[email protected] SIP/2.0
| Via: SIP/2.0/TCP simple.example.net;branch=z9hG4bKna998sk
| From: <sip:[email protected]>;tag=yt66
| Call-ID: 717B1B84-F080-4F12-9F44-0EC1ADE767B9
| Event: presence
| Max-Forwards: 70
| CSeq: 1 SUBSCRIBE
| Contact: <sip:[email protected]>;gr=dr4hcr0st3lup4c
| Expires: 0
| Content-Length: 0
]]></artwork>
</figure>
<t>A presence-aware SIP-to-XMPP gateway translates such a SIP request into a <presence/> stanza of type "probe" if it does not already have presence information about the contact:</t>
<figure>
<preamble>Example 25: XMPP Transformation of SIP Presence Request</preamble>
<artwork><![CDATA[
| <presence from='[email protected]'
| to='[email protected]'
| type='probe'/>
]]></artwork>
</figure>
</section>
</section>
<section title="IANA Considerations" anchor="iana">
<t>This document makes no requests of IANA.</t>
</section>
<section title='Privacy and Security Considerations' anchor="sec">
<t>Detailed privacy and 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>
<section title='Amplification Attacks' anchor="sec-amp">
<t>There exists the possibility of an amplification attack launched from the XMPP network against a SIP presence server, because each long-lived XMPP presence authorization would typically result in multiple notification dialog refreshes on the SIP side of an XMPP-to-SIP gateway. Therefore, access to an XMPP-to-SIP gateway SHOULD be restricted in various ways; for example:</t>
<t>
<list style='symbols'>
<t>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 an XMPP-to-SIP gateway (e.g., not a service that offers open account registration).</t>
<t>An XMPP-to-SIP gateway ought to be associated only with a single domain or trust realm. For example, an XMPP-to-SIP gateway hosted at simple.example.com ought to allow only users within the example.com domain to access the XMPP-to-SIP gateway, not users within example.org, example.net, or any other domain (unless they are part of the same multi-tenanted environment as example.com). This helps to prevent the gateway equivalent of open relays that are shared across XMPP domains from different trust realms.</t>
</list>
</t>
<t>If a SIP presence server receives communications through an XMPP-to-SIP gateway from users who are not associated with a domain that is so related to the hostname of the XMPP-to-SIP gateway, it SHOULD (based on local service provisioning) refuse to service such users or refuse to receive traffic from the XMPP-to-SIP gateway. As a further check, whenever an XMPP-to-SIP gateway seeks to refresh an XMPP user's long-lived authorization to a SIP user's presence, it first sends an XMPP <presence/> stanza of type "probe" from the address of the XMPP-to-SIP gateway to the "bare JID" ([email protected]) of the XMPP user, to which the user's XMPP server responds in accordance with <xref target='RFC6121'/>; this puts an equal burden on the XMPP server and the SIP proxy.</t>
</section>
<section title='Presence Leaks' anchor="sec-leaks">
<t>Presence notifications can contain sensitive information (e.g., about network availability). In addition, it is possible in both SIP and XMPP for an entity to send different presence notifications to different subscribers. Therefore, a gateway MUST NOT route or deliver a presence notification to any entity other than the intended recipient (as represented by the 'to' address for XMPP and by the Request-URI for SIP), because it does not possess information about authorization to receive presence notifications for such entities - that information resides at the user's home service, not at the receiving gateway).</t>
</section>
</section>
</middle>
<back>
<references title="Normative References">
<reference anchor='RFC2119'>
<front>
<title abbrev='RFC Key Words'>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='Scott Bradner'>
<organization>Harvard University</organization>
<address>
<postal>
<street>1350 Mass. Ave.</street>
<street>Cambridge</street>
<street>MA 02138</street>
</postal>
<phone>- +1 617 495 3864</phone>
<email>-</email>
</address>
</author>
<date month='March' year='1997'></date>
<area>General</area>
<keyword>keyword</keyword>
<abstract>
<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:
<list>
<t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.</t>
</list>
</t>
<t>Note that the force of these words is modified by the requirement level of the document in which they are used.</t>
</abstract>
</front>
<seriesInfo name='BCP' value='14' />
<seriesInfo name='RFC' value='2119' />
</reference>
<reference anchor='RFC3261'>
<front>
<title>SIP: Session Initiation Protocol</title>
<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
<organization /></author>
<author initials='H.' surname='Schulzrinne' fullname='H. Schulzrinne'>
<organization /></author>
<author initials='G.' surname='Camarillo' fullname='G. Camarillo'>
<organization /></author>
<author initials='A.' surname='Johnston' fullname='A. Johnston'>
<organization /></author>
<author initials='J.' surname='Peterson' fullname='J. Peterson'>
<organization /></author>
<author initials='R.' surname='Sparks' fullname='R. Sparks'>
<organization /></author>
<author initials='M.' surname='Handley' fullname='M. Handley'>
<organization /></author>
<author initials='E.' surname='Schooler' fullname='E. Schooler'>
<organization /></author>
<date month='June' year='2002' /></front>
<seriesInfo name='RFC' value='3261' />
<format type='TXT' octets='647976' target='ftp://ftp.isi.edu/in-notes/rfc3261.txt' />
</reference>
<reference anchor="RFC3856">
<front>
<title>A Presence Event Package for the Session Initiation Protocol (SIP)</title>
<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
<organization /></author>
<date year='2004' month='August' /></front>
<seriesInfo name='RFC' value='3856' />
<format type='TXT' octets='62956' target='ftp://ftp.isi.edu/in-notes/rfc3856.txt' />
</reference>
<reference anchor='RFC3857'>
<front>
<title>A Watcher Information Event Template-Package for the Session Initiation Protocol (SIP)</title>
<author initials='J.' surname='Rosenberg' fullname='J. Rosenberg'>
<organization /></author>
<date year='2004' month='August' />
<abstract>
<t>This document defines the watcher information template-package for the Session Initiation Protocol (SIP) event framework. Watcher information refers to the set of users subscribed to a particular resource within a particular event package. Watcher information changes dynamically as users subscribe, unsubscribe, are approved, or are rejected. A user can subscribe to this information, and therefore learn about changes to it. This event package is a template-package because it can be applied to any event package, including itself. [STANDARDS-TRACK]</t></abstract></front>
<seriesInfo name='RFC' value='3857' />
<format type='TXT' octets='46221' target='http://www.rfc-editor.org/rfc/rfc3857.txt' />
</reference>
<reference anchor='RFC3863'>
<front>
<title>Presence Information Data Format (PIDF)</title>
<author initials='H.' surname='Sugano' fullname='H. Sugano'>
<organization /></author>
<author initials='S.' surname='Fujimoto' fullname='S. Fujimoto'>
<organization /></author>
<author initials='G.' surname='Klyne' fullname='G. Klyne'>
<organization /></author>
<author initials='A.' surname='Bateman' fullname='A. Bateman'>
<organization /></author>
<author initials='W.' surname='Carr' fullname='W. Carr'>
<organization /></author>
<author initials='J.' surname='Peterson' fullname='J. Peterson'>
<organization /></author>
<date year='2004' month='August' />
<abstract>
<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>
<seriesInfo name='RFC' value='3863' />
<format type='TXT' octets='56956' target='http://www.rfc-editor.org/rfc/rfc3863.txt' />
</reference>
<reference anchor='RFC6120'>
<front>
<title>Extensible Messaging and Presence Protocol (XMPP): Core</title>
<author initials='P.' surname='Saint-Andre' fullname='P. Saint-Andre'>
<organization /></author>
<date year='2011' month='March' />
<abstract>
<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>
<seriesInfo name='RFC' value='6120' />
<format type='TXT' octets='451942' target='http://www.rfc-editor.org/rfc/rfc6120.txt' />
</reference>
<reference anchor='RFC6121'>
<front>
<title>Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence</title>
<author initials='P.' surname='Saint-Andre' fullname='P. Saint-Andre'>
<organization /></author>
<date year='2011' month='March' />
<abstract>
<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>
<seriesInfo name='RFC' value='6121' />
<format type='TXT' octets='244800' target='http://www.rfc-editor.org/rfc/rfc6121.txt' />
</reference>
<reference anchor='RFC6665'>
<front>
<title>SIP-Specific Event Notification</title>
<author initials='A.B.' surname='Roach' fullname='A.B. Roach'>
<organization /></author>
<date year='2012' month='July' />
<abstract>
<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.</t><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.</t><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>
<seriesInfo name='RFC' value='6665' />
<format type='TXT' octets='125556' target='http://www.rfc-editor.org/rfc/rfc6665.txt' />
</reference>
<reference anchor='RFC7247'>
<front>
<title>Interworking between the Session Initiation Protocol (SIP) and the Extensible Messaging and Presence Protocol (XMPP): Architecture, Addresses, and Error Handling</title>
<author initials='P.' surname='Saint-Andre' fullname='P. Saint-Andre'>
<organization /></author>
<author initials='A.' surname='Houri' fullname='A. Houri'>
<organization /></author>
<author initials='J.' surname='Hildebrand' fullname='J. Hildebrand'>
<organization /></author>
<date year='2014' month='May' />
<abstract>
<t>As a foundation for the definition of bidirectional 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></front>
<seriesInfo name='RFC' value='7247' />
<format type='TXT' octets='57218' target='http://www.rfc-editor.org/rfc/rfc7247.txt' />
</reference>
<reference anchor='RFC7622' target='http://www.rfc-editor.org/info/rfc7622'>
<front>
<title>Extensible Messaging and Presence Protocol (XMPP): Address Format</title>
<author initials='P.' surname='Saint-Andre' fullname='P. Saint-Andre'><organization /></author>
<date year='2015' month='September' />
<abstract><t>This document defines the address format for the Extensible Messaging and Presence Protocol (XMPP), including support for code points outside the ASCII range. This document obsoletes RFC 6122.</t></abstract>
</front>
<seriesInfo name='RFC' value='7622'/>
<seriesInfo name='DOI' value='10.17487/RFC7622'/>
</reference>
</references>
<references title="Informative References">
<reference anchor='RFC2778'>
<front>
<title>A Model for Presence and Instant Messaging</title>
<author initials='M.' surname='Day' fullname='Mark Day'>
<organization>SightPath, Inc.</organization>
<address>
<postal>
<street>135 Beaver Street</street>
<city>Waltham</city>
<region>MA</region>
<code>02452</code>
<country>US</country></postal>
<author initials='J.' surname='Rosenberg' fullname='Jonathan Rosenberg'>
<organization>dynamicsoft</organization>
<address>
<postal>
<street>200 Executive Drive</street>
<street>Suite 120</street>
<city>West Orange</city>
<region>NJ</region>
<code>07046</code>
<country>US</country></postal>
<author initials='H.' surname='Sugano' fullname='Hiroyasu Sugano'>
<organization>Fujitsu Laboratories Ltd.</organization>
<address>
<postal>
<street>64 Nishiwaki</street>
<street>Ohkubo-cho</street>
<city>Akashi</city>
<region />
<code>674-8555</code>
<country>JP</country></postal>
<date year='2000' month='February' />
<abstract>
<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>
<seriesInfo name='RFC' value='2778' />
<format type='TXT' octets='35153' target='http://www.rfc-editor.org/rfc/rfc2778.txt' />
</reference>
<reference anchor="RFC2779">
<front>
<title abbrev='Instant Messaging/Presence Protocol'>Instant Messaging / Presence Protocol Requirements</title>
<author initials='M.' surname='Day' fullname='Mark Day'>
<organization>SightPath, Inc.</organization>
<address>
<postal>
<street>135 Beaver Street</street>
<city>Waltham</city>
<region>MA</region>
<code>02452</code>
<country>US</country></postal>
<author initials='S.' surname='Aggarwal' fullname='Sonu Aggarwal'>
<organization>Microsoft Corporation</organization>
<address>
<postal>
<street>One Microsoft Way</street>
<city>Redmond</city>
<region>WA</region>
<code>98052</code>
<country>US</country></postal>
<author initials='J.' surname='Vincent' fullname='Jesse Vincent'>
<organization>Into Networks, Inc.</organization>
<address>
<postal>
<street>150 Cambridgepark Drive</street>
<city>Cambridge</city>
<region>MA</region>
<code>02140</code>
<country>US</country></postal>
<date month='February' year='2000' />
<abstract>
<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>
<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>
<seriesInfo name='RFC' value='2779' />
<format type='TXT' octets='47420' target='ftp://ftp.isi.edu/in-notes/rfc2779.txt' />
</reference>
<reference anchor="RFC3860">
<front>
<title>Common Profile for Instant Messaging (CPIM)</title>