summaryrefslogtreecommitdiff
path: root/doc/rfc/rfc7702.txt
blob: ea3cbf334fd649890ca932d48c05db95ffc988bf (plain) (blame)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
Internet Engineering Task Force (IETF)                    P. Saint-Andre
Request for Comments: 7702                                          &yet
Category: Standards Track                                      S. Ibarra
ISSN: 2070-1721                                              AG Projects
                                                               S. Loreto
                                                                Ericsson
                                                           December 2015


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

Abstract

   This document defines a bidirectional protocol mapping for the
   exchange of instant messages in the context of a multi-party chat
   session among users of the Session Initiation Protocol (SIP) and
   users of the Extensible Messaging and Presence Protocol (XMPP).
   Specifically, this document defines a mapping between the SIP-based
   Message Session Relay Protocol (MSRP) and the XMPP Multi-User Chat
   (MUC) extension.

Status of This Memo

   This is an Internet Standards Track document.

   This document is a product of the Internet Engineering Task Force
   (IETF).  It represents the consensus of the IETF community.  It has
   received public review and has been approved for publication by the
   Internet Engineering Steering Group (IESG).  Further information on
   Internet Standards is available in Section 2 of RFC 5741.

   Information about the current status of this document, any errata,
   and how to provide feedback on it may be obtained at
   http://www.rfc-editor.org/info/rfc7702.
















Saint-Andre, et al.          Standards Track                    [Page 1]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


Copyright Notice

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

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.





































Saint-Andre, et al.          Standards Track                    [Page 2]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


Table of Contents

   1. Introduction ....................................................4
   2. Intended Audience ...............................................4
   3. Terminology .....................................................5
   4. Architectural Assumptions .......................................5
   5. Multi-party Messaging Session from XMPP MUC to MSRP .............8
      5.1. Enter Room ................................................11
      5.2. Set Nickname ..............................................14
      5.3. Conference Subscription ...................................14
      5.4. Presence Broadcast ........................................15
      5.5. Exchange Messages .........................................19
           5.5.1. Send a Message to All Occupants ....................19
           5.5.2. Send a Private Message .............................21
      5.6. Change Nickname ...........................................22
      5.7. Invite Another User to a Room .............................23
      5.8. Exit Room .................................................25
   6. MSRP Multi-party Messaging Session to XMPP MUC .................25
      6.1. Enter Room ................................................28
      6.2. Presence Broadcast ........................................30
      6.3. Exchange Messages .........................................32
           6.3.1. Send a Message to All Occupants ....................32
           6.3.2. Send a Private Message .............................34
      6.4. Change Nickname ...........................................34
      6.5. Invite Another User to a Room .............................35
      6.6. Exit Room .................................................36
   7. Handling of Nicknames and Display Names ........................37
   8. Message Size ...................................................38
   9. Security Considerations ........................................38
   10. References ....................................................39
      10.1. Normative References .....................................39
      10.2. Informative References ...................................40
   Acknowledgements ..................................................42
   Authors' Addresses ................................................43

















Saint-Andre, et al.          Standards Track                    [Page 3]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


1.  Introduction

   Both the Session Initiation Protocol (SIP) [RFC3261] and the
   Extensible Messaging and Presence Protocol (XMPP) [RFC6120] can be
   used for the purpose of multi-party text chat over the Internet.  To
   ensure interworking between these technologies, it is important to
   define bidirectional protocol mappings.

   The architectural assumptions underlying such protocol mappings are
   provided in [RFC7247], including the mapping of addresses and error
   conditions.  This document specifies mappings for multi-party text
   chat sessions (often called "groupchat"); specifically, this document
   defines a mapping between the XMPP Multi-User Chat (MUC) extension
   [XEP-0045] and SIP-based multi-party chat using Message Session Relay
   Protocol (MSRP) [RFC4975] as specified in [RFC7701].

   Both MUC and MSRP contain a large set of features, such as the
   ability to administer rooms, kick out and ban users, reserve a
   nickname within a room, change room subject, enable room moderation,
   and destroy the room.  This document covers only a basic subset of
   groupchat features: joining a room, establishing or changing (but not
   permanently registering) a room nickname, modifying presence
   information within the room, sending a message to all participants,
   sending a private message to a single participant, inviting another
   user to the room, and leaving the room.  Future documents might
   define mappings for additional features beyond this set.

2.  Intended Audience

   The documents in this series are intended for use by software
   developers who have an existing system based on one of these
   technologies (e.g., SIP), and who would like to enable communication
   from that existing system to systems based on the other technology
   (e.g., XMPP).  We assume that readers are familiar with the core
   specifications for both SIP [RFC3261] and XMPP [RFC6120], with the
   base document for this series [RFC7247], and with the following
   groupchat-related specifications:

   o  Multi-party Chat Using MSRP [RFC7701]

   o  Multi-User Chat [XEP-0045]










Saint-Andre, et al.          Standards Track                    [Page 4]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


3.  Terminology

   A number of technical terms used here are defined in [RFC3261],
   [RFC4975], [RFC6120], and [XEP-0045].

   In flow diagrams, MSRP traffic is shown using arrows such as "%%%>",
   SIP traffic is shown using arrows such as "***>", XMPP traffic is
   shown using arrows such as "...>".

   In protocol flows and examples, provisional SIP responses have been
   elided for the sake of brevity.

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
   "OPTIONAL" in this document are to be interpreted as described in
   [RFC2119].

4.  Architectural Assumptions

   XMPP and MSRP differ in their assumptions regarding groupchat
   traffic.  In XMPP, a message of type "groupchat" is just another
   stanza and is handled directly by an XMPP server or routed to an
   associated server component for multi-user chat.  By contrast,
   sessions (including groupchat sessions) in MSRP are considered to be
   a type of media (similar to audio/video sessions): signaling to set
   up, manage, and tear down the session is handled by a "conference
   focus" [RFC4353] (here we assume via SIP), but the session data
   itself is handled by a separate entity called an MSRP switch.  How
   the conference focus and MSRP switch communicate is a matter of
   implementation and deployment.

   An architectural diagram for a possible gateway deployment is shown
   below, where the entities have the following significance:

   o  romeo@example.org -- a SIP user.

   o  romeo@example.org;gr=dr4hcr0st3lup4c -- a particular endpoint
      associated with the SIP user.

   o  example.org -- a SIP proxy with an associated SIP-to-XMPP gateway
      ("S2X GW") to XMPP.

   o  chat.example.org -- a SIP-based conference focus and MSRP switch
      with an associated MSRP-to-SIP gateway ("M2X GW") to XMPP.

   o  montague@chat.example.org -- a conference at an MSRP switch; not
      shown in diagram.




Saint-Andre, et al.          Standards Track                    [Page 5]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   o  juliet@example.com -- an XMPP user.

   o  juliet@example.com/yn0cl4bnw0yr3vym -- a particular endpoint
      associated with the XMPP user.

   o  example.com -- an XMPP server with an associated XMPP-to-SIP
      gateway ("X2S GW") to SIP and an XMPP-to-MSRP gateway ("X2M GW")
      to MSRP.

   o  rooms.example.com -- an XMPP MUC service associated with
      example.com.

   o  capulet@rooms.example.com -- a chat room at an XMPP MUC service;
      not shown in diagram.

   These are logical entities, and several of them might be co-located
   in the same physical entity.  For example, the SIP conference focus
   and MSRP switch and associated gateways, or the XMPP server and MUC
   service and associated gateways, might be part of the same deployed
   code.  In addition, it is likely that an XMPP service would not have
   separate gateways for XMPP-to-SIP translation and XMPP-to-MSRP
   translation, but would instead have a single gateway.





























Saint-Andre, et al.          Standards Track                    [Page 6]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   #####################################################################
   #                                                                   #
   #                  +------------------+                             #
   #  &&&&&&&&&&&&&&&&| chat.example.org |<%%%%%%%%%%%                 #
   #  &           &&&&| (MSRP switch) +-----+        %                 #
   #  &           &   +---------------| M2X |        %                 #
   #  &           &           %       | GW  |        %                 #
   #  &           &           %       +-----+        %                 #
   #  &           &           %        :             %                 #
   #  &           &           %     ///////////////////////////////////#
   #  &           &           %     /  :             %                 #
   #  &           &           %     /  :          +-----+              #
   #  &           &           %     /  :          | X2M |              #
   #  &           &           %     /  :  +-------| GW  |---+          #
   #  &           &           %     /  :.>|       +-----+   |          #
   #  &           &           %     /     |                 |          #
   #  & +------------------+  %     / +-----+               |          #
   #  & | chat.example.org |<*******/*| X2S | example.com   |          #
   #  & | (conference      |  %   **/*| GW  | (XMPP server) |          #
   #  & | focus)     +-----+  %   * / +-----+               |          #
   #  & +------------| S2X |  %   * /     |     +-------------------+  #
   #  &       *      | GW  |......*./....>|     | rooms.example.com |  #
   #  &       *      +-----+  %   * /     +-----| (MUC service)     |  #
   #  &       *               %   * /       ^ : +-------------------+  #
   #  & +---------------+     %   * /       : :                        #
   #  &&| example.org   |<********* /       : :                        #
   #    | (SIP proxy) +-----+ %     /       : :                        #
   #    +-------------| S2X | %     /       : :                        #
   #          *       | GW  |......./........ :                        #
   #          *       +-----+ %     /         :                        #
   #          *               %     /         :                        #
   #          romeo@example.org     /         juliet@example.com       #
   #          ;gr=dr4hcr0st3lup4c   /         /yn0cl4bnw0yr3vym        #
   #                                /                                  #
   #      --SIP/MSRP DOMAIN--       /         --XMPP DOMAIN--          #
   #                                /                                  #
   #####################################################################

      Legend:
          . = XMPP
          % = MSRP
          * = SIP
          & = unstandardized communication paths
          / = separation of administrative domains

                 Figure 1: Logical Deployment Architecture





Saint-Andre, et al.          Standards Track                    [Page 7]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   In SIP, there is no necessity for a SIP user such as
   romeo@example.org to make use of his SIP proxy in order to join a
   chat room on the XMPP network; for example, he could try to directly
   find a SIP service at example.com or independently locate a SIP-to-
   XMPP gateway.  Although, as a simplifying assumption, this document
   shows the more expected path of using one's "home" SIP proxy and
   shows gateways as associated with the sending domain, nothing in this
   document ought to be construed as discouraging other deployment
   architectures or communication paths (e.g., services hosting their
   own inbound gateways).

5.  Multi-party Messaging Session from XMPP MUC to MSRP

   This section describes how to map an XMPP MUC session to an MSRP
   Multi-party Messaging session.  The following diagram outlines the
   overall protocol flow of a sample session, which includes some
   optional exchanges (such as sending messages, changing a nickname,
   and inviting another user).

   XMPP             XMPP               SIP               MSRP
   User            Server           Conference          Switch
    |             + X2S GW            Focus           + M2X GW
    |             & X2M GW          + S2X GW              |
    |                 |                 |                 |
    | (F1) XMPP       |                 |                 |
    | enter room      |                 |                 |
    |................>|                 |                 |
    |                 | (F2) SIP INVITE |                 |
    |                 |****************>|                 |
    |                 |                 | (F3)            |
    |                 |                 | unstandardized  |
    |                 |                 | interaction     |
    |                 |                 |<&&&&&&&&&&&&&&&>|
    |                 | (F4) SIP 200 OK |                 |
    |                 |<****************|                 |
    |                 | (F5) SIP ACK    |                 |
    |                 |****************>|                 |
    |                 | (F6) MSRP SEND (bodiless)         |
    |                 |%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>|
    |                 | (F7) MSRP 200 OK                  |
    |                 |<%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|
    |                 | (F8) MSRP NICKNAME                |
    |                 |%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>|
    |                 | (F9) MSRP 200 OK                  |
    |                 |<%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|






Saint-Andre, et al.          Standards Track                    [Page 8]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


    |                 | (F10) SIP       |                 |
    |                 | SUBSCRIBE       |                 |
    |                 | Event:          |                 |
    |                 | conference      |                 |
    |                 |****************>|                 |
    |                 | (F11) SIP 200 OK|                 |
    |                 |<****************|                 |
    |                 | (F12) SIP NOTIFY|                 |
    |                 |<****************|                 |
    |                 | (F13) SIP 200 OK|                 |
    |                 |****************>|                 |
    | (F14) XMPP      |                 |                 |
    | presence        |                 |                 |
    |<................|                 |                 |
    | (F15) XMPP      |                 |                 |
    | MUC subject     |                 |                 |
    |<................|                 |                 |
    .                 .                 .                 .
    .                 .                 .                 .
    | (F16) XMPP      |                 |                 |
    | groupchat       |                 |                 |
    | message         |                 |                 |
    |................>|                 |                 |
    |                 | (F17) MSRP SEND                   |
    |                 |%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>|
    |                 | (F18) MSRP 200 OK
    |                 |<%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|
    | (F19) XMPP      |                 |                 |
    | groupchat       |                 |                 |
    | message         |                 |                 |
    |<................|                 |                 |
    .                 .                 .                 .
    .                 .                 .                 .
    | (F20) XMPP      |                 |                 |
    | private         |                 |                 |
    | message         |                 |                 |
    |................>|                 |                 |
    |                 | (F21) MSRP SEND                   |
    |                 |%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>|
    |                 | (F22) MSRP 200 OK
    |                 |<%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|
    .                 .                 .                 .
    .                 .                 .                 .
    | (F23) XMPP      |                 |                 |
    | presence:       |                 |                 |
    | change nick     |                 |                 |
    |................>|                 |                 |




Saint-Andre, et al.          Standards Track                    [Page 9]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


    |                 | (F24) MSRP NICKNAME               |
    |                 |%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>|
    |                 | (F25) MSRP 425 Error              |
    |                 |<%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|
    | (F26) XMPP      |                 |                 |
    | presence        |                 |                 |
    | error           |                 |                 |
    |<................|                 |                 |
    .                 .                 .                 .
    .                 .                 .                 .
    | (F27) XMPP      |                 |                 |
    | message:        |                 |                 |
    | invite          |                 |                 |
    |................>|                 |                 |
    |                 | (F28) SIP       |                 |
    |                 | REFER           |                 |
    |                 |****************>|                 |
    |                 | (F29) SIP       |                 |
    |                 | 200 OK          |                 |
    |                 |<****************|                 |
    |                 | (F30) SIP       |                 |
    |                 | NOTIFY          |                 |
    |                 |<****************|                 |
    .                 .                 .                 .
    .                 .                 .                 .
    | (F31) XMPP      |                 |                 |
    | presence:       |                 |                 |
    | exit room       |                 |                 |
    |................>|                 |                 |
    |                 | (F32) SIP BYE   |                 |
    |                 |****************>|                 |
    |                 | (F33) SIP       |                 |
    |                 | 200 OK          |                 |
    |                 |<****************|                 |
    | (F34) XMPP      |                 |                 |
    | presence        |                 |                 |
    | unavailable     |                 |                 |
    |<................|                 |                 |
    |                 |                 |                 |

   Detailed protocol flows and mappings are provided in the following
   sections.









Saint-Andre, et al.          Standards Track                   [Page 10]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


5.1.  Enter Room

   As defined in the XMPP Multi-User Chat (MUC) specification
   [XEP-0045], when an XMPP user (say, "juliet@example.com") wants to
   join a groupchat room (say, "montague@chat.example.org"), she sends a
   directed <presence/> stanza [RFC6121] to that chat room.  In her
   request she also specifies the nickname she wants to use within the
   room (say, "JuliC"); in XMPP this room nickname is the resourcepart
   of an occupant JID (thus "montague@chat.example.org/JuliC").  The
   joining client signals its ability to speak the multi-user chat
   protocol by including in the initial presence stanza an empty <x/>
   element qualified by the 'http://jabber.org/protocol/muc' namespace.

   Example 1: Juliet Enters Room (F1)

   |  <presence from='juliet@example.com/yn0cl4bnw0yr3vym'
   |            to='montague@chat.example.org/JuliC'>
   |    <x xmlns='http://jabber.org/protocol/muc'/>
   |  </presence>

   Upon receiving such a presence stanza, the XMPP server needs to
   determine the identity of the domainpart in the 'to' address, which
   it does by following the procedures discussed in [RFC7247].  Here we
   assume that the XMPP server has determined the domain is serviced by
   a SIP server, that it contains or has available to it an XMPP-to-SIP
   gateway or connection manager (which enables it to speak natively to
   SIP servers), and that it hands off the presence stanza to the
   XMPP-to-SIP gateway.

   Because a multi-user chat service accepts the presence stanza shown
   above as a request to enter a room, the XMPP-to-SIP gateway
   transforms it into a SIP INVITE request.



















Saint-Andre, et al.          Standards Track                   [Page 11]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 2: SIP Mapping of Room Join (F2)

   |  INVITE sip:montague@chat.example.org SIP/2.0
   |  To: <sip:montague@chat.example.org>
   |  From: "Juliet" <sip:juliet@example.com>;tag=786
   |  Contact: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   |  Call-ID: BC466C1C-E01D-4FD1-B766-9AD174BAF2E7
   |  CSeq: 1 INVITE
   |  Content-Type: application/sdp
   |  Content-Length: ...
   |
   |  c=IN IP4 x2s.example.org
   |  m=message 7654 TCP/MSRP *
   |  a=accept-types:text/cpim
   |  a=accept-wrapped-types:text/plain text/html
   |  a=path:msrp://x2m.example.com:7654/jshA7weztas;tcp
   |  a=chatroom:nickname private-messages

   Here the Session Description Protocol (SDP) offer specifies the XMPP-
   to-MSRP gateway on the XMPP side (in the SDP 'path' attribute
   specified in [RFC4975]) as well as other particulars of the session.

      There is no direct mapping for the MSRP URIs.  In fact, an MSRP
      URI identifies a session of instant messages at a particular
      device; it is ephemeral and has no meaning outside the scope of
      that session.  The authority component of the MSRP URI here MUST
      contain the XMPP-to-MSRP gateway hostname or numeric IP address
      (as well as, in accordance with [RFC4975], an explicit port
      number).

   The mapping of XMPP syntax elements to SIP and [RFC4566] syntax
   elements MUST be as shown in the following table.

   Table 1: Message Syntax Mapping from XMPP to SIP/SDP

       +-----------------------------+-----------------------------+
       |  XMPP Element or Attribute  |  SIP Header or SDP Contents |
       +-----------------------------+-----------------------------+
       |  from                       |  From                       |
       |  to (without the /nick)     |  To                         |
       +-----------------------------+-----------------------------+

   As shown in the foregoing example and described in [RFC7247], the
   XMPP-to-SIP gateway MUST map the bare JID ("localpart@domainpart") of
   the XMPP sender to the SIP From header and include the resourcepart
   of the full JID as the Globally Routable User Agent URI (GRUU)





Saint-Andre, et al.          Standards Track                   [Page 12]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   portion [RFC5627] of the SIP URI.  However, note that a SIP response
   uses the same From and To as in the SIP request, whereas an XMPP
   response swaps the from and to attributes.

   Here we assume that the SIP conference focus accepts the session
   establishment.  The Contact header field of the SIP 200 OK response
   includes the 'isfocus' feature tag specified in [RFC4353] along with
   other relevant feature tags.  The conference focus also includes an
   answer session description that acknowledges the choice of media,
   specifies the MSRP URI of the switch (in the 'path' attribute
   specified in [RFC4975]), and contains the extensions specified in
   [RFC7701].

   Example 3: Chat Room Accepts Session Establishment (F4)

   |  SIP/2.0 200 OK
   |  From: "Juliet" <sip:juliet@example.com>;tag=786
   |  To: <sip:montague@chat.example.org>;tag=087js
   |  Call-ID: BC466C1C-E01D-4FD1-B766-9AD174BAF2E7
   |  CSeq: 1 INVITE
   |  Contact: <sip:montague@chat.example.org;transport=tcp>;isfocus
   |  Content-Type: application/sdp
   |  Content-Length: ...
   |
   |  v=0
   |  c=IN IP4 example.org
   |  s=-
   |  m=message 12763 TCP/MSRP *
   |  a=accept-types:message/cpim
   |  a=accept-wrapped-types:text/plain text/html
   |  a=path:msrp://chat.example.org:12763/kjhd37s2s20w2a;tcp
   |  a=chatroom:nickname private-messages

   Upon receiving such a response, the XMPP-to-SIP gateway sends a SIP
   ACK to the conference focus on behalf of the joining user.

   Example 4: Gateway Sends ACK to Conference Focus (F5)

   |  ACK sip:montague@chat.example.org SIP/2.0
   |  To: <sip:montague@chat.example.org>;tag=087js
   |  From: "Juliet" <sip:juliet@example.com>;tag=786
   |  Call-ID: BC466C1C-E01D-4FD1-B766-9AD174BAF2E7
   |  CSeq: 2 ACK

   In accordance with [RFC4975], the gateway sends a bodiless MSRP
   message (F6) to the switch immediately upon establishing the
   connection, and the switch acknowledges that message (F7).




Saint-Andre, et al.          Standards Track                   [Page 13]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


5.2.  Set Nickname

   If the chat room server accepted the session, the XMPP-to-MSRP
   gateway sets up the nickname as received in the presence stanza
   (i.e., the resourcepart of the 'to' address, such as "JuliC" in
   "montague@chat.example.org/JuliC").  This is done using the extension
   specified in [RFC7701].

   Example 5: Gateway Sets Up Nickname (F8)

   |  MSRP a786hjs2 NICKNAME
   |  To-Path: msrp://montague@chat.example.org:12763/kjhd37s2s20w2a;tcp
   |  From-Path: msrp://x2m.example.com:7654/jshA7weztas;tcp
   |  Use-Nickname: "JuliC"
   |  -------a786hjs2

   The MSRP switch analyzes the existing allocation of nicknames,
   accepts the nickname proposal, and answers with a 200 response.

   Example 6: MSRP Switch Accepts Nickname Proposal (F9)

   |  MSRP a786hjs2 200 OK
   |  To-Path: msrp://x2m.example.com:7654/jshA7weztas;tcp
   |  From-Path: msrp://montague@chat.example.org:12763/kjhd37s2s20w2a
   |             ;tcp
   |  -------a786hjs2

   This section assumes that the nickname request is successful.  The
   error flow resulting from a nickname conflict is described under
   Section 5.6.

5.3.  Conference Subscription

   As mentioned in [RFC7701], the joining user will typically also
   subscribe to a conference event package (see [RFC4575] and [RFC6502])
   at the focus.  Although such a subscription is not required by
   [RFC7701] in practice the temporary and context-dependent presence
   subscriptions and room rosters involved in joining an XMPP MUC room
   are best mapped to the conference event package.












Saint-Andre, et al.          Standards Track                   [Page 14]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 7: Gateway Subscribes to the Conference (F10)

   |  SUBSCRIBE sip:montague@chat.example.org SIP/2.0
   |  To: <sip:montague@chat.example.org>;tag=087js
   |  From: "Juliet" <sip:juliet@example.com>;tag=786
   |  Contact: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   |  Call-ID: BC466C1C-E01D-4FD1-B766-9AD174BAF2E7
   |  CSeq: 3 SUBSCRIBE
   |  Event: conference
   |  Expires: 600
   |  Accept: application/conference-info+xml
   |  Allow-Events: conference
   |  Content-Length: 0

   The focus will accept or reject the request based on local policy.

   Example 8: Focus Accepts Subscription Request (F11)

   |  SIP/2.0 200 OK
   |  To: <sip:montague@chat.example.org>;tag=087js
   |  From: "Juliet" <sip:juliet@example.com>;tag=786
   |  Call-ID: BC466C1C-E01D-4FD1-B766-9AD174BAF2E7
   |  CSeq: 3 SUBSCRIBE
   |  Contact: <sip:montague@chat.example.org;transport=tcp>;isfocus
   |  Expires: 600
   |  Content-Length: 0

   If the conference focus accepts the request to enter a room, the XMPP
   user expects to receive back presence information from all the
   existing occupants of the room.  To make this happen, the XMPP-to-SIP
   gateway subscribes to the conference event package [RFC4575] at the
   focus.

5.4.  Presence Broadcast

   When the conference event package subscription is completed, the
   focus sends to the XMPP-to-SIP gateway a NOTIFY request containing
   the presence information of all the existing occupants, represented
   using the format defined in [RFC4575].












Saint-Andre, et al.          Standards Track                   [Page 15]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 9: Conference Focus Sends Presence Information (F12)

   |  NOTIFY sip:montague@chat.example.org SIP/2.0
   |  To: "Juliet" <sip:juliet@example.com>;tag=786
   |  From: <sip:montague@chat.example.org>;tag=087js
   |  Call-ID: BC466C1C-E01D-4FD1-B766-9AD174BAF2E7
   |  CSeq: 4 NOTIFY
   |  Event: conference
   |  Subscription-State: active;expires=3600
   |  Content-Type: application/conference-info+xml
   |  Content-Length: ...
   |
   |  <conference-info version="0" state="full"
   |      entity="sip:3402934234@chat.example.org">
   |    <conference-description>
   |      <subject>Today in Verona</subject>
   |      <conf-uris>
   |        <entry>
   |          <uri>tel:+18882934234</uri>
   |        </entry>
   |      </conf-uris>
   |    </conference-description>
   |    <users>
   |      <user entity="sip:montague@chat.example.org;gr=Romeo"
   |            state="full">
   |        <display-text>Romeo</display-text>
   |        <roles>
   |          <entry>participant</entry>
   |        </roles>
   |        <associated-aors>
   |          <entry>
   |            <uri>xmpp:romeo@example.org/dr4hcr0st3lup4c</uri>
   |          </entry>
   |        </associated-aors>
   |        <endpoint entity="sip:montague@chat.example.org;gr=Romeo"
   |                  state="full">
   |          <status>connected</status>
   |          <joining-info>
   |            <when>2013-12-12T10:01:03.691128+01:00</when>
   |          </joining-info>
   |          <media id="211835820">
   |            <type>message</type>
   |          </media>
   |        </endpoint>
   |      </user>
   |      <user entity="sip:montague@chat.example.org;gr=Ben"
   |            state="full">
   |        <display-text>Ben</display-text>



Saint-Andre, et al.          Standards Track                   [Page 16]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   |        <roles>
   |          <entry>participant</entry>
   |        </roles>
   |        <endpoint entity="sip:montague@chat.example.org;gr=Ben"
   |                  state="full">
   |          <status>connected</status>
   |          <media id="211835821">
   |            <type>message</type>
   |          </media>
   |        </endpoint>
   |      </user>
   |      <user entity="sip:montague@chat.example.org;gr=JuliC"
   |            state="full">
   |        <display-text>JuliC</display-text>
   |        <roles>
   |          <entry>participant</entry>
   |        </roles>
   |         <endpoint entity="sip:montague@chat.example.org;gr=JuliC"
   |                   state="full">
   |           <status>connected</status>
   |           <media id="211835822">
   |             <type>message</type>
   |           </media>
   |         </endpoint>
   |      </user>
   |    </users>
   |  </conference-info>

   The syntax mapping from the RFC 4575 payload to the XMPP participant
   list MUST be as shown in the following table.  (Mappings for elements
   not mentioned are undefined.)

   Table 2: Participant list mapping

       +--------------------------------+-----------------------------+
       |  RFC 4575 Element or Attribute |  XMPP Element or Attribute  |
       +--------------------------------+-----------------------------+
       |  <conference-info/> 'entity'   |  room JID                   |
       |  <subject/>                    |  room subject               |
       |  <user/> 'entity'              |  occupant JID               |
       |  <display-text/>               |  participant nickname       |
       |  <endpoint/> 'entity'          |  occupant JID               |
       |  <user/> 'associated-aors'     |  user full JID (if avail.)  |
       +--------------------------------+-----------------------------+







Saint-Andre, et al.          Standards Track                   [Page 17]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Upon receiving such a response, the XMPP-to-SIP gateway sends a SIP
   200 OK response to the conference focus (example not shown) and
   translates the participant list into a series of XMPP presence
   stanzas.

   Example 10: XMPP Mapping of Chat Room Presence (F14)

   |  <presence from='montague@chat.example.org/Romeo'
   |            to='juliet@example.com/yn0cl4bnw0yr3vym'>
   |    <x xmlns='http://jabber.org/protocol/muc#user'>
   |      <item affiliation='none' role='participant'/>
   |    </x>
   |  </presence>

   |  <presence from='montague@chat.example.org/Ben'
   |            to='juliet@example.com/yn0cl4bnw0yr3vym'>
   |    <x xmlns='http://jabber.org/protocol/muc#user'>
   |      <item affiliation='none' role='participant'/>
   |    </x>
   |  </presence>

   |  <presence from='montague@chat.example.org/JuliC'
   |            to='juliet@example.com/yn0cl4bnw0yr3vym'>
   |    <x xmlns='http://jabber.org/protocol/muc#user'>
   |      <item affiliation='none' role='participant'/>
   |      <status code='110'/>
   |    </x>
   |  </presence>

   If the NOTIFY request included a subject, the gateway converts that
   into a separate XMPP message.

   Example 11: XMPP Mapping of Chat Room Subject (F15)

   |  <message from='montague@chat.example.org/mayor'
   |           to='juliet@example.com/yn0cl4bnw0yr3vym'
   |           id='mbh2vd68'>
   |    <subject>Today in Verona</subject>
   |  </message>

   The mapping of SIP and [RFC4575] payload syntax elements to XMPP
   syntax elements MUST be as shown in the following table.  (Mappings
   for elements not mentioned are undefined.)








Saint-Andre, et al.          Standards Track                   [Page 18]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Table 3: Message Syntax Mapping from SIP to XMPP

       +---------------------------------+-----------------------------+
       | SIP Header or RFC 4575 Contents | XMPP Element or Attribute   |
       +---------------------------------+-----------------------------+
       |  <user/> 'entity'               |  from                       |
       |  To with <display-text>         |  occupant JID               |
       |  <role>participant</role>       |  role='participant'         |
       |  [N/A]                          |  affiliation='none'         |
       +---------------------------------+-----------------------------+

5.5.  Exchange Messages

   Once the user has joined the chat room, the user can exchange an
   unbounded number of messages, both public and private.

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

   Table 4: Message Syntax Mapping from XMPP Message to MSRP

       +-----------------------------+-----------------------------+
       |  XMPP Element or Attribute  |  CPIM Header                |
       +-----------------------------+-----------------------------+
       |  to                         |  To                         |
       |  from                       |  From                       |
       |  <body/>                    |  body of the SEND request   |
       +-----------------------------+-----------------------------+

5.5.1.  Send a Message to All Occupants

   When Juliet wants to sends a message to all other occupants in the
   room, she sends a message of type "groupchat" to the <room@service>
   itself (in our example, <montague@chat.example.org>).

   The following examples show an exchange of a public message.

   Example 12: Juliet Sends Message to All Occupants (F16)

   |  <message from='juliet@example.com/yn0cl4bnw0yr3vym'
   |           to='montague@chat.example.org'
   |           type='groupchat'
   |           id='lzfed24s'>
   |        <body>Who knows where Romeo is?</body>
   |  </message>





Saint-Andre, et al.          Standards Track                   [Page 19]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Upon receiving such a message, the XMPP-to-MSRP gateway translates it
   into an MSRP SEND message.

   Example 13: Gateway Maps XMPP Message to MSRP (F17)

   |  MSRP a786hjs2 SEND
   |  To-Path: msrp://chat.example.org:12763/kjhd37s2s20w2a;tcp
   |  From-Path: msrp://x2m.example.com:7654/jshA7weztas;tcp
   |  Message-ID: 87652491
   |  Byte-Range: 1-*/*
   |  Content-Type: message/cpim
   |
   |  To: <sip:montague@chat.example.org>
   |  From: "Juliet" <sip:juliet@example.com>
   |  DateTime: 2008-10-15T15:02:31-03:00
   |  Content-Type: text/plain
   |
   |  Who knows where Romeo is?
   |  -------a786hjs2$

   Upon receiving the SEND request, if the request either contains a
   Failure-Report header field value of "yes" or does not contain a
   Failure-Report header at all, the MSRP switch immediately generates
   and sends a response.

   Example 14: MSRP Switch Returns 200 OK (F18)

   |  MSRP d93kswow 200 OK
   |  To-Path: msrp://x2m.example.com:7654/jshA7weztas;tcp
   |  From-Path: msrp://chat.example.org:12763/kjhd37s2s20w2a;tcp
   |  -------d93kswow$

   Since an XMPP MUC room could be moderated and an XMPP user cannot be
   sure whether her message has been accepted without receiving it back
   from the server, [XEP-0045] states that the sender needs to receive a
   reflected copy of the message it sent.  So, in this scenario, the
   XMPP-to-MSRP gateway has to reflect the message back to the sender.
   This procedure only applies to XMPP endpoints.

   Example 15: Gateway Reflects Message to XMPP User (F19)

   |  <message from='montague@chat.example.org/JuliC'
   |           to='juliet@example.com/yn0cl4bnw0yr3vym'
   |           type='groupchat'
   |           id='ix51z73m'>
   |        <body>Who knows where Romeo is?</body>
   |  </message>




Saint-Andre, et al.          Standards Track                   [Page 20]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


5.5.2.  Send a Private Message

   Since each occupant has a unique JID, Juliet can send a "private
   message" to a selected occupant through the service by sending a
   message to the user's occupant JID.  The XMPP message type ought to
   be "chat" (and is not allowed to be "groupchat").

   The following examples show an exchange of a private message.

   Example 16: Juliet Sends Private Message (F20)

   |  <message from='juliet@example.com/yn0cl4bnw0yr3vym'
   |           to='montague@chat.example.org/Romeo'
   |           type='chat'
   |           id='6sfln45q'>
   |        <body>O Romeo, Romeo! wherefore art thou Romeo?</body>
   |  </message>

   Upon receiving such a message, the XMPP-to-MSRP gateway translates it
   into an MSRP SEND message.

   Example 17: Gateway Maps Private Message from XMPP to MSRP (F21)

   |  MSRP a786hjs2 SEND
   |  To-Path: msrp://chat.example.org:12763/kjhd37s2s20w2a;tcp
   |  From-Path: msrp://x2m.example.com:7654/jshA7weztas;tcp
   |  Message-ID: 87652491
   |  Byte-Range: 1-*/*
   |  Content-Type: message/cpim
   |
   |  To: <sip:montague@chat.example.org>;gr=Romeo
   |  From: <sip:juliet@example.org>;gr=yn0cl4bnw0yr3vym
   |  DateTime: 2008-10-15T15:02:31-03:00
   |  Content-Type: text/plain
   |
   |  O Romeo, Romeo! wherefore art thou Romeo?
   |  -------a786hjs2$

   After acknowledging the message by sending an MSRP 200 OK message
   (step F22, not shown), the MSRP switch is responsible for sending the
   message to the intended recipient.  When doing so, it modifies the
   From header to the sender's address within the chat room.









Saint-Andre, et al.          Standards Track                   [Page 21]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 18: Switch Sends Private Message to SIP User

   |  MSRP a786hjs2 SEND
   |  To-Path: msrp://chat.example.org:12763/kjhd37s2s20w2a;tcp
   |  From-Path: msrp://x2m.example.com:7654/jshA7weztas;tcp
   |  Message-ID: 87652491
   |  Byte-Range: 1-*/*
   |  Content-Type: message/cpim
   |
   |  To: <sip:romeo@example.org>
   |  From: <sip:montague@chat.example.org>;gr=JuliC
   |  DateTime: 2008-10-15T15:02:31-03:00
   |  Content-Type: text/plain
   |
   |  O Romeo, Romeo! wherefore art thou Romeo?
   |  -------a786hjs2$

   Note: If an XMPP-to-MSRP gateway has support for private messaging,
   it MUST advertise that fact by adding a "private-messages" value to
   the a=chatroom SDP attribute it sends to the conference focus, as
   specified in [RFC7701].

   |  a=chatroom:nickname private-messages

5.6.  Change Nickname

   The XMPP user might want to change her nickname.  She can do so by
   sending an updated presence stanza to the room, containing a new
   nickname.

   Example 19: Juliet Changes Her Nickname (F23)

   |  <presence from='juliet@example.com/yn0cl4bnw0yr3vym'
   |            to='montague@chat.example.org/CapuletGirl'/>

   So far we have assumed that the requested nickname did not conflict
   with any existing nicknames.  The following text describes the
   handling of a nickname conflict.

   The MSRP switch analyzes the existing allocation of nicknames, and
   detects that the nickname proposal is already provided to another
   participant.  In this case, the MSRP switch answers with a 425
   response.








Saint-Andre, et al.          Standards Track                   [Page 22]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 20: MSRP Switch Does Not Accept Nickname Proposal (F25)

   |  MSRP a786hjs2 425 Nickname usage failed
   |  To-Path: msrp://x2m.example.com:7654/jshA7weztas;tcp
   |  From-Path: msrp://chat.example.org:12763/kjhd37s2s20w2a;tcp
   |  -------a786hjs2

   Upon receiving such a response, the XMPP-to-MSRP gateway translates
   it into an XMPP presence stanza of type "error", specifying a
   <conflict/> error condition (which implies that the XMPP client will
   then need to choose another nickname and repeat the process of
   joining).

   Example 21: Conflict Error for Nickname (F26)

   |  <presence from='montague@chat.example.org/JuliC'
   |            to='juliet@example.com/yn0cl4bnw0yr3vym'
   |            type='error'>
   |    <x xmlns='http://jabber.org/protocol/muc'/>
   |    <error type='cancel' by='montague@chat.example.org'>
   |      <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
   |    </error>
   |  </presence>

   Alternatively, the gateway might generate a new nickname request on
   behalf of the XMPP user, thus shielding the XMPP client from handling
   the conflict error.

5.7.  Invite Another User to a Room

   In XMPP, there are two methods for inviting another user to a room:
   direct invitations [XEP-0249] (sent directly from the user's real JID
   outside the room to the invitee's real JID) and mediated invitations
   (sent through the room from the user's occupant JID to the invitee's
   JID).  In this document, we cover mediated invitations only.

   For example, if Juliet decides to invite Benvolio to the room, she
   sends a message stanza with an invite and Benvolio's JID (which could
   be his real JID or an occupant JID in another room).












Saint-Andre, et al.          Standards Track                   [Page 23]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 22: Juliet Invites Benvolio to the Room (F27)

   |  <message from='juliet@example.com/yn0cl4bnw0yr3vym'
   |           id='nzd143v8'
   |           to='montague@chat.example.org'>
   |    <x xmlns='http://jabber.org/protocol/muc#user'>
   |      <invite to='benvolio@example.com'/>
   |    </x>
   |  </message>

   The XMPP-to-SIP gateway then sends a SIP REFER request to the
   conference focus indicating who needs to be invited in the Refer-To
   header, as per Section 5.5 of [RFC4579].

   Example 23: SIP Mapping of Invite (F28)

   |  REFER sip:montague@chat.example.org SIP/2.0
   |  To: <sip:montague@chat.example.org>
   |  From: "Juliet" <sip:juliet@example.com>;tag=786
   |  Call-ID: BC466C1C-E01D-4FD1-B766-9AD174BAF2E7
   |  CSeq: 5 REFER
   |  Contact: <sip:juliet@example.com>;gr=yn0cl4bnw0yr3vym
   |  Accept: message/sipfrag
   |  Refer-To: <sip:benvolio@example.com>
   |  Supported: replaces
   |  Content-Length: 0

   The conference focus then acknowledges the SIP REFER request with a
   200 OK response (step F29, not shown).

   The progress of the invitation will be tracked by the received NOTIFY
   requests as per [RFC3515].

   Example 24: Progress Notification for Invitation (F30)

   |  NOTIFY sip:juliet@example.com SIP/2.0
   |  To: <sip:juliet@example.com>;tag=786
   |  From: <sip:montague@chat.example.org>;tag=087js
   |  Call-ID: BC466C1C-E01D-4FD1-B766-9AD174BAF2E7
   |  CSeq: 6 NOTIFY
   |  Max-Forwards: 70
   |  Event: refer
   |  Subscription-State: active;expires=60
   |  Contact: <sip:montague@chat.example.org;transport=tcp>;isfocus
   |  Content-Type: message/sipfrag;version=2.0
   |  Content-Length: ...





Saint-Andre, et al.          Standards Track                   [Page 24]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Note: Implementers might want to be aware that several recently
   published specifications modify the way in which REFER requests
   handle SIP notifications (see [RFC7647] and [RFC7614]).

5.8.  Exit Room

   If Juliet decides to exit the chat room, her client sends a directed
   presence stanza of type "unavailable" to the occupant JID she is
   currently using in the room (here <montague@chat.example.org/JuliC>).

   Example 25: Juliet Exits Room (F31)

   |  <presence from='juliet@example.com/yn0cl4bnw0yr3vym'
   |            to='montague@chat.example.org/JuliC'
   |            type='unavailable'/>

   Upon receiving such a stanza, the XMPP-to-SIP gateway terminates the
   SIP session by sending a SIP BYE to the conference focus and the
   conference focus responds with a SIP 200 OK (steps F32 and F33, not
   shown).

   Juliet can include a custom exit message in the presence stanza of
   type "unavailable", in which case it is broadcast to other
   participants using the methods described above.

   Example 26: Juliet Exits the Chat Room (F31)

   |  <presence from='juliet@example.com/yn0cl4bnw0yr3vym'
   |            to='montague@chat.example.org/JuliC'
   |            type='unavailable'>
   |    <status>O, look! methinks I see my cousin's ghost</status>
   |  </presence>

6.  MSRP Multi-party Messaging Session to XMPP MUC

   This section describes how to map a Multi-party Instant Message (IM)
   MSRP session to an XMPP MUC session.  As before, the following
   diagram outlines the overall protocol flow of a sample session, which
   includes some optional exchanges (such as sending messages, changing
   nickname, and inviting another user).











Saint-Andre, et al.          Standards Track                   [Page 25]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   SIP               SIP               MSRP             XMPP
   User             Proxy             Switch           Server
    |             + S2X GW          + M2X GW          +X2S GW
    |                 |                 |             +X2M GW
    |                 |                 |                 |
    | (F35) SIP       |                 |                 |
    | INVITE          |                 |                 |
    |****************>|                 |                 |
    | (F36) SIP       |                 |                 |
    | 200 OK          |                 |                 |
    |<****************|                 |                 |
    | (F37) SIP ACK   |                 |                 |
    |****************>|                 |                 |
    | (F38) SIP       |                 |                 |
    | SUBSCRIBE       |                 |                 |
    | Event:          |                 |                 |
    | conference      |                 |                 |
    |****************>|                 |                 |
    | (F39) SIP       |                 |                 |
    | 200 OK          |                 |                 |
    |<****************|                 |                 |
    |                 | (F40) XMPP presence: enter room   |
    |                 |..................................>|
    |                 | (F41) XMPP presence               |
    |                 |<..................................|
    | (F42) SIP       |                 |                 |
    | NOTIFY          |                 |                 |
    |<****************|                 |                 |
    | (F43) SIP       |                 |                 |
    | 200 OK          |                 |                 |
    |****************>|                 |                 |
    .                 .                 .                 .
    .                 .                 .                 .
    | (F44) MSRP SEND                   |                 |
    |%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>|                 |
    |                 |                 | (F45) XMPP      |
    |                 |                 | groupchat       |
    |                 |                 | message         |
    |                 |                 |................>|
    |                 |                 | (F46) XMPP      |
    |                 |                 | groupchat       |
    |                 |                 | message         |
    |                 |                 |<................|
    | (F47) MSRP 200 OK                 |                 |
    |<%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|                 |
    .                 .                 .                 .





Saint-Andre, et al.          Standards Track                   [Page 26]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


    .                 .                 .                 .
    | (F48) MSRP SEND                   |                 |
    |%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>|                 |
    | (F49) MSRP 200 OK                 |                 |
    |<%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|                 |
    |                 |                 | (F50) XMPP      |
    |                 |                 | message         |
    |                 |                 |................>|
    .                 .                 .                 .
    .                 .                 .                 .
    | (F51) MSRP NICKNAME               |                 |
    |%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%>|                 |
    |                 |                 | (F52) XMPP      |
    |                 |                 | presence        |
    |                 |                 |................>|
    |                 |                 | (F53) XMPP      |
    |                 |                 | presence        |
    |                 |                 | error           |
    |                 |                 |<................|
    | (F54) MSRP 425 Error              |                 |
    |<%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%|                 |
    .                 .                 .                 .
    .                 .                 .                 .
    | (F55) SIP REFER |                 |                 |
    |****************>|                 |                 |
    | (F56) SIP       |                 |                 |
    | 200 OK          |                 |                 |
    |<****************|                 |                 |
    | (F57) SIP       |                 |                 |
    | NOTIFY          |                 |                 |
    |<****************|                 |                 |
    |                 | (F58) XMPP message invite         |
    |                 |..................................>|
    .                 .                 .                 .
    .                 .                 .                 .
    | (F59) SIP BYE   |                 |                 |
    |****************>|                 |                 |
    |                 | (F60) XMPP presence unavailable   |
    |                 |..................................>|
    |                 | (F61) XMPP presence unavailable   |
    |                 |<..................................|
    | (F62) SIP       |                 |                 |
    | 200 OK          |                 |                 |
    |<****************|                 |                 |
    |                 |                 |                 |






Saint-Andre, et al.          Standards Track                   [Page 27]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   If the XMPP presence stanza is received before the SIP SUBSCRIBE
   dialog is established for the conference event, then the server
   SHOULD cache the participant list until the subscription is
   established and delivered in a SIP NOTIFY request.

6.1.  Enter Room

   When the SIP user ("Romeo") wants to join a groupchat room
   ("capulet"), he first has to start the SIP session by sending out a
   SIP INVITE request containing an offered session description that
   includes an MSRP media line accompanied by mandatory 'path' and
   'chatroom' attributes.  Here we assume that Romeo's user agent has
   been configured to be aware of an MSRP switch (chat.example.org) it
   can use.  The MSRP media line is also accompanied by an 'accept-
   types' attribute specifying support for a Message/CPIM [RFC3862] top-
   level wrapper for the MSRP message.

   Example 27: SIP User Starts Session (F35)

   |  INVITE sip:capulet@rooms.example.com SIP/2.0
   |  From: "Romeo" <sip:romeo@example.org>;tag=43524545
   |  To: <sip:capulet@rooms.example.com>
   |  Contact: <sip:romeo@example.org>;gr=dr4hcr0st3lup4c
   |  Call-ID: 08CFDAA4-FAED-4E83-9317-253691908CD2
   |  CSeq: 1 INVITE
   |  Content-Type: application/sdp
   |  Content-Length: ...
   |
   |  c=IN IP4 s2x.example.org
   |  m=message 7313 TCP/MSRP *
   |  a=accept-types:message/cpim text/plain text/html
   |  a=accept-wrapped-types:text/plain text/html
   |  a=path:msrp://chat.example.org:7313/ansp71weztas;tcp
   |  a=chatroom:nickname private-messages

   Upon receiving the INVITE, the SIP proxy needs to determine the
   identity of the domain portion of the Request-URI or To header, which
   it does by following the procedures discussed in [RFC7247].  Here we
   assume that the SIP proxy has determined that the domain is serviced
   by an XMPP server, that it contains or has available to it a SIP-to-
   XMPP gateway or connection manager (which enables it to speak
   natively to XMPP servers), and that it hands off the message to the
   gateway.

   Implementations MAY wait until the nickname is set with an MSRP
   NICKNAME chunk before joining the XMPP MUC or MAY choose a temporary
   nickname (such as the SIP From header display name) and use it to
   join the room.  Here we assume the latter.



Saint-Andre, et al.          Standards Track                   [Page 28]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 28: SIP-to-XMPP Gateway ACKs Session (F36)

   |  SIP/2.0 200 OK
   |  From: "Romeo" <sip:romeo@example.org>;tag=43524545
   |  To: <sip:capulet@rooms.example.com>;tag=a3343df32
   |  Contact: <sip:rooms.example.com;transport=tcp>;isfocus
   |  Call-ID: 08CFDAA4-FAED-4E83-9317-253691908CD2
   |  CSeq: 1 INVITE
   |  Content-Type: application/sdp
   |
   |  m=message 8763 TCP/MSRP *
   |  a=accept-types:message/cpim text/plain text/html
   |  a=accept-wrapped-types:text/plain text/html
   |  a=path:msrp://chat.example.org:8763/lkjh37s2s20w2a;tcp
   |  a=chatroom:nickname private-messages

   The SIP/MSRP user agent subscribes to a conference event package at
   the destination groupchat service.

   Example 29: Gateway Subscribes to the Conference (F38)

   |  SUBSCRIBE sip:capulet@rooms.example.com SIP/2.0
   |  To: <sip:capulet@rooms.example.com>;tag=a3343df32
   |  From: "Romeo" <sip:romeo@example.org>;tag=43524545
   |  Contact: <sip:romeo@example.org>;gr=dr4hcr0st3lup4c
   |  Call-ID: 08CFDAA4-FAED-4E83-9317-253691908CD2
   |  CSeq: 2 SUBSCRIBE
   |  Event: conference
   |  Expires: 600
   |  Accept: application/conference-info+xml
   |  Allow-Events: conference
   |  Content-Length: 0

   After the conference subscription request is acknowledged, the SIP-
   to-XMPP gateway sends presence from Romeo to the MUC chat room.

   Example 30: Romeo Enters XMPP Chat Room (F40)

   |  <presence from='romeo@example.org/dr4hcr0st3lup4c'
   |            to='montague@chat.example.org/Romeo'>
   |    <x xmlns='http://jabber.org/protocol/muc'/>
   |  </presence>









Saint-Andre, et al.          Standards Track                   [Page 29]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


6.2.  Presence Broadcast

   If the MUC service is able to add the SIP/MSRP user to the room, it
   sends presence from all the existing occupants' room JIDs to the new
   occupant's full JID, including extended presence information about
   roles in an <x/> element.

   Example 31: XMPP Service Sends Presence from Existing Occupants to
   New Occupant (F41)

   |  <presence from='capulet@rooms.example.com/Romeo'
   |            to='romeo@example.org/dr4hcr0st3lup4c'>
   |    <x xmlns='http://jabber.org/protocol/muc#user'>
   |      <item affiliation='none' role='participant'/>
   |      <status code='110'/>
   |    </x>
   |  </presence>
   |
   |  <presence from='capulet@rooms.example.com/Ben'
   |            to='romeo@example.org/dr4hcr0st3lup4c'>
   |    <x xmlns='http://jabber.org/protocol/muc#user'>
   |      <item affiliation='none' role='participant'/>
   |    </x>
   |  </presence>
   |
   |  <presence from='capulet@rooms.example.com/JuliC'
   |            to='romeo@example.org/dr4hcr0st3lup4c'>
   |    <x xmlns='http://jabber.org/protocol/muc#user'>
   |      <item affiliation='none' role='participant'/>
   |    </x>
   |  </presence>

   Upon receiving these presence stanzas, if the conference focus has
   already completed the subscription to the conference event package
   [RFC4575], the XMPP-to-SIP gateway translates them into a SIP NOTIFY
   request containing the participant list (represented in the
   conference-info format specified in [RFC4575]).














Saint-Andre, et al.          Standards Track                   [Page 30]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 32: SIP Mapping of XMPP Participant Presence Stanzas (F42)

   |  NOTIFY sip:romeo@example.org SIP/2.0
   |  To: <sip:romeo@example.org>;tag=43524545
   |  From: <sip:capulet@rooms.example.com>;tag=a3343df32
   |  Call-ID: 08CFDAA4-FAED-4E83-9317-253691908CD2
   |  CSeq: 3 NOTIFY
   |  Event: conference
   |  Subscription-State: active;expires=3600
   |  Content-Type: application/conference-info+xml
   |  Content-Length: ...
   |
   |  <conference-info version="0" state="full"
   |      entity="sip:capulet@rooms.example.com">
   |    <conference-description>
   |      <subject>Today in Verona</subject>
   |      <conf-uris>
   |        <entry>
   |          <uri>tel:+18882934234</uri>
   |          <uri>sip:capulet@rooms.example.com</uri>
   |        </entry>
   |      </conf-uris>
   |   </conference-description>
   |   <users>
   |     <user entity="sip:capulet@rooms.example.com;gr=JuliC"
   |           state="full">
   |       <display-text>JuliC</display-text>
   |       <roles>
   |         <entry>participant</entry>
   |       </roles>
   |       <endpoint entity="sip:capulet@rooms.example.com;gr=JuliC"
   |                 state="full">
   |         <status>connected</status>
   |         <media id="211835821">
   |           <type>message</type>
   |         </media>
   |       </endpoint>
   |     </user>
   |     <user entity="sip:capulet@rooms.example.com;gr=Ben"
   |           state="full">
   |       <display-text>Ben</display-text>
   |       <roles>
   |         <entry>participant</entry>
   |       </roles>
   |       <endpoint entity="sip:capulet@rooms.example.com;gr=Ben"
   |                 state="full">
   |         <status>connected</status>
   |         <media id="211835822">



Saint-Andre, et al.          Standards Track                   [Page 31]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   |           <type>message</type>
   |         </media>
   |       </endpoint>
   |     </user>
   |   </users>
   |  </conference-info>

   Because the "room roster" is communicated in XMPP by means of
   multiple presence stanzas (one for each participant) whereas the
   participant list is communicated in SIP by means of a single
   conference information document, the SIP-to-XMPP gateway will need to
   keep track of the user's SIP URI and the mapping of that URI into an
   XMPP address; then, based on that mapping, it will need to determine
   when it has received a complete room roster from the MUC room, i.e.,
   when it has received the in-room presence of the SIP user (which
   according to [XEP-0045] is the last presence stanza received in the
   initial batch sent after joining).  Once that happens, the SIP-to-
   XMPP gateway can construct the conference information document
   containing the complete participant list and send that to the SIP
   user.

6.3.  Exchange Messages

   Once the user has joined the chat room, the user can exchange an
   unbounded number of messages, both public and private.

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

   Table 5: Message Syntax Mapping from MSRP Message to XMPP

       +-----------------------------+-----------------------------+
       |  CPIM Header                |XMPP Element or Attribute    |
       +-----------------------------+-----------------------------+
       |  To                         |  to                         |
       |  From                       |  from                       |
       |  body of the SEND request   |  <body/>                    |
       +-----------------------------+-----------------------------+

6.3.1.  Send a Message to All Occupants

   When Romeo wants to send a message to all other occupants in the
   room, he sends an MSRP SEND request to <room@service>
   (<capulet@rooms.example.com> in our example).






Saint-Andre, et al.          Standards Track                   [Page 32]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   The following examples show an exchange of a public message.

   Example 33: Romeo Sends a Message to the Chat Room (F44)

   |  MSRP a786hjs2 SEND
   |  To-Path: msrp://room.example.com:7313/ansp71weztas;tcp
   |  From-Path: msrp://chat.example.org:8763/lkjh37s2s20w2a;tcp
   |  Message-ID: 87652492
   |  Byte-Range: 1-*/*
   |  Content-Type: message/cpim
   |
   |  To: <sip:capulet@rooms.example.com>
   |  From: "Romeo" <sip:romeo@example.org>;gr=dr4hcr0st3lup4c
   |  DateTime: 2008-10-15T15:02:31-03:00
   |  Content-Type: text/plain
   |
   |  Romeo is here!
   |  -------a786hjs2$

   Upon receiving the SEND request, if the request either contains a
   Failure-Report header field value of "yes" or does not contain a
   Failure-Report header at all, the SIP-to-XMPP gateway immediately
   translates it into an XMPP message stanza and then generates and
   sends an MSRP response.

   Example 34: XMPP Mapping of Message (F45)

   |  <message from='romeo@example.org/dr4hcr0st3lup4c'
   |           to='capulet@rooms.example.com'
   |           type='groupchat'
   |           id='8gbx1g4p'>
   |    <body>Romeo is here!</body>
   |  </message>

   Example 35: MSRP Response to Public Message (F47)

   |  MSRP d93kswow 200 OK
   |  To-Path: msrp://rooms.example.com:8763/lkjh37s2s20w2a;tcp
   |  From-Path: msrp://chat.example.org:7313/ansp71weztas;tcp
   |  -------d93kswow$

   Note well that the XMPP MUC room will reflect the sender's message
   back to all users, including the sender.  The MSRP-to-XMPP gateway
   SHOULD wait until receiving this reflected message before sending an
   MSRP 200 OK reply to the original sender.






Saint-Andre, et al.          Standards Track                   [Page 33]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


6.3.2.  Send a Private Message

   Romeo can send a "private message" to a selected occupant via the
   chat room service by sending a message to the occupant's room
   nickname.

   The following examples show an exchange of a private message.

   Example 36: Romeo Sends a Private Message (F48)

   |  MSRP a786hjs2 SEND
   |  To-Path: msrp://rooms.example.com:7313/ansp71weztas;tcp
   |  From-Path: msrp://chat.example.org:8763/lkjh37s2s20w2a;tcp
   |  Message-ID: 87652492
   |  Byte-Range: 1-*/*
   |  Content-Type: message/cpim
   |
   |  To: <sip:capulet@rooms.example.com>;gr=JuliC
   |  From: "Romeo" <sip:romeo@example.org>;gr=dr4hcr0st3lup4c
   |  DateTime: 2008-10-15T15:02:31-03:00
   |  Content-Type: text/plain
   |
   |  I am here!!!
   |  -------a786hjs2$

   The MSRP switch is responsible for transforming the 'From' address
   into an in-room address (not shown).

   Once the MSRP switch sends that message to the gateway, the gateway
   is responsible for translating it into XMPP syntax.

   Example 37: XMPP Mapping of Private Message (F50)

   |  <message from='capulet@rooms.example.com/Romeo'
   |           to='capulet@rooms.example.com/JuliC'
   |           type='chat'
   |           id='rg2ca9k7'>
   |    <body>I am here!!!</body>
   |  </message>

6.4.  Change Nickname

   If Romeo decides to change his nickname within the room, he sends a
   new MSRP NICKNAME request.  In fact, modification of the nickname in
   MSRP is not different from the initial reservation and usage of a
   nickname.





Saint-Andre, et al.          Standards Track                   [Page 34]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 38: MSRP User Changes Nickname (F51)

   |  MSRP a786hjs2 NICKNAME
   |  To-Path: msrp://chat.example.org:7313/ansp71weztas;tcp
   |  From-Path: msrp://rooms.example.com:8763/lkjh37s2s20w2a;tcp
   |  Use-Nickname: "montecchi"
   |  -------a786hjs2

   Upon receiving such a message, the MSRP-to-XMPP gateway translates it
   into an XMPP presence stanza.

   Example 39: XMPP Mapping of Nickname Change (F52)

   |  <presence from='romeo@example.org/dr4hcr0st3lup4c'
   |            to='capulet@rooms.example.com/montecchi'/>

   The XMPP server will analyze the nickname allocation and determine if
   the requested nickname is available.  In case the nickname is not
   available or not usable, the server will generate a presence stanza
   of type "error" specifying a <conflict/> error condition.

   Example 40: XMPP Conflict Error for Nickname (F53)

   |  <presence from='capulet@rooms.example.com/Romeo'
   |            to='romeo@example.org/dr4hcr0st3lup4c'
   |            type='error'>
   |    <x xmlns='http://jabber.org/protocol/muc'/>
   |    <error type='cancel' by='capulet@rooms.example.com'>
   |      <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
   |    </error>
   |  </presence>

   Upon receiving this stanza, the XMPP-to-MSRP gateway will reply to
   the NICKNAME request with code 425.

   Example 41: Gateway Translates XMPP Nickname Conflict to MSRP Error
   Code (F54)

   |  MSRP a786hjs2 425 Nickname usage failed
   |  To-Path: msrp://chat.example.org:7313/ansp71weztas;tcp
   |  From-Path: msrp://rooms.example.com:8763/lkjh37s2s20w2a;tcp
   |  -------a786hjs2

6.5.  Invite Another User to a Room

   If a SIP user wants to invite another user to join the conference he
   will send a REFER request indicating who needs to be invited in the
   Refer-To header, as per Section 5.5 of [RFC4579].



Saint-Andre, et al.          Standards Track                   [Page 35]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 42: SIP User Invites Another User (F55)

   |  REFER sip:capulet@rooms.example.com SIP/2.0
   |  To: <sip:capulet@rooms.example.com>;tag=a3343df32
   |  From: "Romeo" <sip:romeo@example.org>;tag=5534562
   |  Call-ID: 08CFDAA4-FAED-4E83-9317-253691908CD2
   |  CSeq: 4 REFER
   |  Contact: <sip:romeo@example.org>;gr=dr4hcr0st3lup4c
   |  Accept: message/sipfrag
   |  Refer-To: <sip:benvolio@example.com>
   |  Supported: replaces
   |  Content-Length: 0

   The SIP-to-XMPP gateway then acknowledges the SIP REFER request with
   a 200 OK response (step F56).

   The gateway will then send a NOTIFY request as per [RFC3515]
   indicating that the invitation is in progress.  Since there is no way
   to know the progress of the invitation until the user has joined,
   implementations are advised to terminate the REFER dialog
   subscription upon receiving the first NOTIFY request, with a status
   code of 100 Trying.

   Example 43: Progress Notification for Invitation (F56)

   |  NOTIFY sip:romeo@example.org SIP/2.0
   |  To: <sip:romeo@example.org>;tag=5534562
   |  From: <sip:capulet@rooms.example.com>;tag=a3343df32
   |  Call-ID: 08CFDAA4-FAED-4E83-9317-253691908CD2
   |  CSeq: 5 NOTIFY
   |  Event: refer
   |  Subscription-State: terminated;reason=noresource
   |  Contact: <sip:capulet@rooms.example.com;transport=tcp>;isfocus
   |  Content-Type: message/sipfrag;version=2.0
   |  Content-Length: ...
   |
   |  SIP/2.0 100 Trying

6.6.  Exit Room

   If Romeo decides to exit the chat room, his client sends a SIP BYE to
   the <montague@chat.example.org> chat room.









Saint-Andre, et al.          Standards Track                   [Page 36]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   Example 44: Romeo Terminates Session (F59)

   |  BYE sip:capulet@rooms.example.com SIP/2.0
   |  Max-Forwards: 70
   |  From: "Romeo" <sip:romeo@example.org>;tag=5534562
   |  To: <sip:capulet@rooms.example.com>;tag=a3343df32
   |  Call-ID: 08CFDAA4-FAED-4E83-9317-253691908CD2
   |  CSeq: 6 BYE
   |  Content-Length: 0

   Upon receiving the SIP BYE, the SIP-to-XMPP gateway translates it
   into a presence stanza of type "unavailable" (F60) and sends it to
   the XMPP MUC room service.  Then, the SIP-to-XMPP gateway responds
   with a 200 OK to the MSRP user (F62).

   Example 45: Romeo Exits Chat Room (F60)

   |  <presence from='romeo@example.org/dr4hcr0st3lup4c'
   |            to='capulet@rooms.example.com/Romeo'
   |            type='unavailable'/>

7.  Handling of Nicknames and Display Names

   Fundamental rules for mapping addresses between XMPP and SIP are
   provided in [RFC7247].  However, chat rooms include a more
   specialized, unique identifier for each participant in a room, called
   a "nickname".  Implementations SHOULD apply the rules for preparation
   and comparison of nicknames specified in [RFC7700].

   In addition to nicknames, some groupchat implementations also include
   display names (which might or might not be different from users'
   nicknames).  A display name need not be unique within the context of
   a room but instead simply provides a user-friendly name for a
   participant.

   In the SIP conference event package, the nickname is the value of the
   Centralized Conferencing (XCON) 'nickname' attribute of the <user/>
   element [RFC6501] and the display name is the XML character data of
   the conference-info <display-text/> element [RFC4575].  In XMPP, the
   nickname is the value of the resourcepart of the occupant JID
   [XEP-0045] and the display name is the XML character data of the
   <nick/> element [XEP-0172].

   In practice, the <display-text/> element is treated as canonical in
   SIP implementations, and the <nick/> element is rarely used in XMPP
   implementations.  Therefore, for display purposes, SIP
   implementations ought to use the <display-text/> element if the XCON




Saint-Andre, et al.          Standards Track                   [Page 37]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   'nickname' attribute is not present, and XMPP implementations ought
   to use the resourcepart of the occupant JID if the <nick/> element is
   not present.

   If there is a conflict between the SIP nickname and the XMPP
   nickname, the SIP-to-XMPP or XMPP-to-SIP gateway is responsible for
   adjusting the nickname to avoid the conflict and for informing the
   SIP or XMPP client of the unique nickname used to join the chat room.

8.  Message Size

   It is possible for MSRP messages to exceed the size allowed by an
   XMPP service on the far end of an MSRP-to-XMPP gateway; see [RFC7573]
   for a discussion of this issue.

9.  Security Considerations

   The security considerations of [RFC3261], [RFC4975], [RFC6120],
   [RFC7247], [RFC7701], and [XEP-0045] apply.

   This document specifies methods for exchanging groupchat messages
   through a gateway that translates between SIP and XMPP.  Such a
   gateway MUST be compliant with the minimum security requirements of
   the protocols for which it translates (i.e., MSRP/SIP and XMPP).  The
   addition of gateways to the security models of MSRP, SIP, and XMPP
   introduces some new risks.  In particular, end-to-end security
   properties (especially confidentiality and integrity) between user
   agents that interface through an MSRP-to-XMPP gateway can be provided
   only if common formats are supported; unfortunately, although
   [RFC3862] specifies such a format for one-to-one instant messages,
   the problem of end-to-end security for multi-party messaging has not
   been solved in a standardized way.

   Some of the features that are not addressed by the minimal
   interoperability baseline defined in this document are relevant to
   security, such as the ability to administer rooms, kick out and ban
   users, and enable room moderation.  Users needing to take advantage
   of such features cannot do so through a gateway in a standardized
   manner and therefore will need to use native clients for the relevant
   protocol (MSRP or XMPP).

   As mentioned in [RFC7572], there are several possible methods for
   end-to-end encryption of one-to-one instant messages.  Unfortunately,
   because there is no widely deployed method for end-to-end encryption
   of multi-party instant messages, this document cannot provide a
   recommendation in this regard.





Saint-Andre, et al.          Standards Track                   [Page 38]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


10.  References

10.1.  Normative References

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

   [RFC3261]  Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston,
              A., Peterson, J., Sparks, R., Handley, M., and E.
              Schooler, "SIP: Session Initiation Protocol", RFC 3261,
              DOI 10.17487/RFC3261, June 2002,
              <http://www.rfc-editor.org/info/rfc3261>.

   [RFC4579]  Johnston, A. and O. Levin, "Session Initiation Protocol
              (SIP) Call Control - Conferencing for User Agents",
              BCP 119, RFC 4579, DOI 10.17487/RFC4579, August 2006,
              <http://www.rfc-editor.org/info/rfc4579>.

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

   [RFC5627]  Rosenberg, J., "Obtaining and Using Globally Routable User
              Agent URIs (GRUUs) in the Session Initiation Protocol
              (SIP)", RFC 5627, DOI 10.17487/RFC5627, October 2009,
              <http://www.rfc-editor.org/info/rfc5627>.

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

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

   [RFC7247]  Saint-Andre, P., Houri, A., and J. Hildebrand,
              "Interworking between the Session Initiation Protocol
              (SIP) and the Extensible Messaging and Presence Protocol
              (XMPP): Architecture, Addresses, and Error Handling",
              RFC 7247, DOI 10.17487/RFC7247, May 2014,
              <http://www.rfc-editor.org/info/rfc7247>.






Saint-Andre, et al.          Standards Track                   [Page 39]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   [RFC7573]  Saint-Andre, P. and S. Loreto, "Interworking between the
              Session Initiation Protocol (SIP) and the Extensible
              Messaging and Presence Protocol (XMPP): One-to-One Text
              Chat Sessions", RFC 7573, DOI 10.17487/RFC7573, June 2015,
              <http://www.rfc-editor.org/info/rfc7573>.

   [RFC7700]  Saint-Andre, P., "Preparation, Enforcement, and Comparison
              of Internationalized Strings Representing Nicknames",
              RFC 7700, DOI 10.17487/RFC7700, December 2015,
              <http://www.rfc-editor.org/info/rfc7700>.

   [RFC7701]  Niemi, A., Garcia-Martin, M., and G. Sandbakken, "Multi-
              party Chat Using the Message Session Relay Protocol
              (MSRP)", RFC 7701, DOI 10.17487/RFC7701, December 2015,
              <http://www.rfc-editor.org/info/rfc7701>.

   [XEP-0045] Saint-Andre, P., "Multi-User Chat", XSF XEP 0045, February
              2012, <http://www.xmpp.org/extensions/xep-0045.html>.

10.2.  Informative References

   [RFC3515]  Sparks, R., "The Session Initiation Protocol (SIP) Refer
              Method", RFC 3515, DOI 10.17487/RFC3515, April 2003,
              <http://www.rfc-editor.org/info/rfc3515>.

   [RFC3862]  Klyne, G. and D. Atkins, "Common Presence and Instant
              Messaging (CPIM): Message Format", RFC 3862,
              DOI 10.17487/RFC3862, August 2004,
              <http://www.rfc-editor.org/info/rfc3862>.

   [RFC4353]  Rosenberg, J., "A Framework for Conferencing with the
              Session Initiation Protocol (SIP)", RFC 4353,
              DOI 10.17487/RFC4353, February 2006,
              <http://www.rfc-editor.org/info/rfc4353>.

   [RFC4566]  Handley, M., Jacobson, V., and C. Perkins, "SDP: Session
              Description Protocol", RFC 4566, DOI 10.17487/RFC4566,
              July 2006, <http://www.rfc-editor.org/info/rfc4566>.

   [RFC4575]  Rosenberg, J., Schulzrinne, H., and O. Levin, Ed., "A
              Session Initiation Protocol (SIP) Event Package for
              Conference State", RFC 4575, DOI 10.17487/RFC4575, August
              2006, <http://www.rfc-editor.org/info/rfc4575>.








Saint-Andre, et al.          Standards Track                   [Page 40]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


   [RFC6501]  Novo, O., Camarillo, G., Morgan, D., and J. Urpalainen,
              "Conference Information Data Model for Centralized
              Conferencing (XCON)", RFC 6501, DOI 10.17487/RFC6501,
              March 2012, <http://www.rfc-editor.org/info/rfc6501>.

   [RFC6502]  Camarillo, G., Srinivasan, S., Even, R., and J.
              Urpalainen, "Conference Event Package Data Format
              Extension for Centralized Conferencing (XCON)", RFC 6502,
              DOI 10.17487/RFC6502, March 2012,
              <http://www.rfc-editor.org/info/rfc6502>.

   [RFC7572]  Saint-Andre, P., Houri, A., and J. Hildebrand,
              "Interworking between the Session Initiation Protocol
              (SIP) and the Extensible Messaging and Presence Protocol
              (XMPP): Instant Messaging", RFC 7572,
              DOI 10.17487/RFC7572, June 2015,
              <http://www.rfc-editor.org/info/rfc7572>.

   [RFC7614]  Sparks, R., "Explicit Subscriptions for the REFER Method",
              RFC 7614, DOI 10.17487/RFC7614, August 2015,
              <http://www.rfc-editor.org/info/rfc7614>.

   [RFC7647]  Sparks, R. and A. Roach, "Clarifications for the Use of
              REFER with RFC 6665", RFC 7647, DOI 10.17487/RFC7647,
              September 2015, <http://www.rfc-editor.org/info/rfc7647>.

   [XEP-0172] Saint-Andre, P. and V. Mercier, "User Nickname", XSF
              XEP 0172, March 2012,
              <http://xmpp.org/extensions/xep-0172.html>.

   [XEP-0249] Saint-Andre, P., "Direct MUC Invitations", XSF XEP 0249,
              September 2011,
              <http://xmpp.org/extensions/xep-0249.html>.


















Saint-Andre, et al.          Standards Track                   [Page 41]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


Acknowledgements

   Special thanks to Fabio Forno for coauthoring an early draft version
   of this document and to Ben Campbell for his detailed and insightful
   reviews.

   Thanks also to Dave Crocker, Philipp Hancke, Olle Johansson, Paul
   Kyzivat, and Matt Ryan for their feedback.

   Leif Johansson reviewed the document on behalf of the Security
   Directorate.

   Stephen Farrell, Barry Leiba, Pete Resnick, and Martin Stiemerling
   provided helpful input during IESG review.

   The authors gratefully acknowledge the assistance of Markus Isomaki
   and Yana Stamcheva as the working group Chairs and Gonzalo Camarillo
   and Alissa Cooper as the sponsoring Area Directors.

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





























Saint-Andre, et al.          Standards Track                   [Page 42]
^L
RFC 7702            SIP-XMPP Interworking: Groupchat       December 2015


Authors' Addresses

   Peter Saint-Andre
   &yet

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


   Saul Ibarra Corretge
   AG Projects
   Dr. Leijdsstraat 92
   Haarlem  2021RK
   The Netherlands

   Email: saul@ag-projects.com


   Salvatore Loreto
   Ericsson
   Hirsalantie 11
   Jorvas  02420
   Finland

   Email: Salvatore.Loreto@ericsson.com


























Saint-Andre, et al.          Standards Track                   [Page 43]
^L