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 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564
|
Network Working Group M. Handley
Request for Comments: 2543 ACIRI
Category: Standards Track H. Schulzrinne
Columbia U.
E. Schooler
Cal Tech
J. Rosenberg
Bell Labs
March 1999
SIP: Session Initiation Protocol
Status of this Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (1999). All Rights Reserved.
IESG Note
The IESG intends to charter, in the near future, one or more working
groups to produce standards for "name lookup", where such names would
include electronic mail addresses and telephone numbers, and the
result of such a lookup would be a list of attributes and
characteristics of the user or terminal associated with the name.
Groups which are in need of a "name lookup" protocol should follow
the development of these new working groups rather than using SIP for
this function. In addition it is anticipated that SIP will migrate
towards using such protocols, and SIP implementors are advised to
monitor these efforts.
Abstract
The Session Initiation Protocol (SIP) is an application-layer control
(signaling) protocol for creating, modifying and terminating sessions
with one or more participants. These sessions include Internet
multimedia conferences, Internet telephone calls and multimedia
distribution. Members in a session can communicate via multicast or
via a mesh of unicast relations, or a combination of these.
Handley, et al. Standards Track [Page 1]
RFC 2543 SIP: Session Initiation Protocol March 1999
SIP invitations used to create sessions carry session descriptions
which allow participants to agree on a set of compatible media types.
SIP supports user mobility by proxying and redirecting requests to
the user's current location. Users can register their current
location. SIP is not tied to any particular conference control
protocol. SIP is designed to be independent of the lower-layer
transport protocol and can be extended with additional capabilities.
Table of Contents
1 Introduction ........................................ 7
1.1 Overview of SIP Functionality ....................... 7
1.2 Terminology ......................................... 8
1.3 Definitions ......................................... 9
1.4 Overview of SIP Operation ........................... 12
1.4.1 SIP Addressing ...................................... 12
1.4.2 Locating a SIP Server ............................... 13
1.4.3 SIP Transaction ..................................... 14
1.4.4 SIP Invitation ...................................... 15
1.4.5 Locating a User ..................................... 17
1.4.6 Changing an Existing Session ........................ 18
1.4.7 Registration Services ............................... 18
1.5 Protocol Properties ................................. 18
1.5.1 Minimal State ....................................... 18
1.5.2 Lower-Layer-Protocol Neutral ........................ 18
1.5.3 Text-Based .......................................... 20
2 SIP Uniform Resource Locators ....................... 20
3 SIP Message Overview ................................ 24
4 Request ............................................. 26
4.1 Request-Line ........................................ 26
4.2 Methods ............................................. 27
4.2.1 INVITE .............................................. 28
4.2.2 ACK ................................................. 29
4.2.3 OPTIONS ............................................. 29
4.2.4 BYE ................................................. 30
4.2.5 CANCEL .............................................. 30
4.2.6 REGISTER ............................................ 31
4.3 Request-URI ......................................... 34
4.3.1 SIP Version ......................................... 35
4.4 Option Tags ......................................... 35
4.4.1 Registering New Option Tags with IANA ............... 35
5 Response ............................................ 36
5.1 Status-Line ......................................... 36
5.1.1 Status Codes and Reason Phrases ..................... 37
6 Header Field Definitions ............................ 39
6.1 General Header Fields ............................... 41
6.2 Entity Header Fields ................................ 42
6.3 Request Header Fields ............................... 43
Handley, et al. Standards Track [Page 2]
RFC 2543 SIP: Session Initiation Protocol March 1999
6.4 Response Header Fields .............................. 43
6.5 End-to-end and Hop-by-hop Headers ................... 43
6.6 Header Field Format ................................. 43
6.7 Accept .............................................. 44
6.8 Accept-Encoding ..................................... 44
6.9 Accept-Language ..................................... 45
6.10 Allow ............................................... 45
6.11 Authorization ....................................... 45
6.12 Call-ID ............................................. 46
6.13 Contact ............................................. 47
6.14 Content-Encoding .................................... 50
6.15 Content-Length ...................................... 51
6.16 Content-Type ........................................ 51
6.17 CSeq ................................................ 52
6.18 Date ................................................ 53
6.19 Encryption .......................................... 54
6.20 Expires ............................................. 55
6.21 From ................................................ 56
6.22 Hide ................................................ 57
6.23 Max-Forwards ........................................ 59
6.24 Organization ........................................ 59
6.25 Priority ............................................ 60
6.26 Proxy-Authenticate .................................. 60
6.27 Proxy-Authorization ................................. 61
6.28 Proxy-Require ....................................... 61
6.29 Record-Route ........................................ 62
6.30 Require ............................................. 63
6.31 Response-Key ........................................ 63
6.32 Retry-After ......................................... 64
6.33 Route ............................................... 65
6.34 Server .............................................. 65
6.35 Subject ............................................. 65
6.36 Timestamp ........................................... 66
6.37 To .................................................. 66
6.38 Unsupported ......................................... 68
6.39 User-Agent .......................................... 68
6.40 Via ................................................. 68
6.40.1 Requests ............................................ 68
6.40.2 Receiver-tagged Via Header Fields ................... 69
6.40.3 Responses ........................................... 70
6.40.4 User Agent and Redirect Servers ..................... 70
6.40.5 Syntax .............................................. 71
6.41 Warning ............................................. 72
6.42 WWW-Authenticate .................................... 74
7 Status Code Definitions ............................. 75
7.1 Informational 1xx ................................... 75
7.1.1 100 Trying .......................................... 75
7.1.2 180 Ringing ......................................... 75
Handley, et al. Standards Track [Page 3]
RFC 2543 SIP: Session Initiation Protocol March 1999
7.1.3 181 Call Is Being Forwarded ......................... 75
7.1.4 182 Queued .......................................... 76
7.2 Successful 2xx ...................................... 76
7.2.1 200 OK .............................................. 76
7.3 Redirection 3xx ..................................... 76
7.3.1 300 Multiple Choices ................................ 77
7.3.2 301 Moved Permanently ............................... 77
7.3.3 302 Moved Temporarily ............................... 77
7.3.4 305 Use Proxy ....................................... 77
7.3.5 380 Alternative Service ............................. 78
7.4 Request Failure 4xx ................................. 78
7.4.1 400 Bad Request ..................................... 78
7.4.2 401 Unauthorized .................................... 78
7.4.3 402 Payment Required ................................ 78
7.4.4 403 Forbidden ....................................... 78
7.4.5 404 Not Found ....................................... 78
7.4.6 405 Method Not Allowed .............................. 78
7.4.7 406 Not Acceptable .................................. 79
7.4.8 407 Proxy Authentication Required ................... 79
7.4.9 408 Request Timeout ................................. 79
7.4.10 409 Conflict ........................................ 79
7.4.11 410 Gone ............................................ 79
7.4.12 411 Length Required ................................. 79
7.4.13 413 Request Entity Too Large ........................ 80
7.4.14 414 Request-URI Too Long ............................ 80
7.4.15 415 Unsupported Media Type .......................... 80
7.4.16 420 Bad Extension ................................... 80
7.4.17 480 Temporarily Unavailable ......................... 80
7.4.18 481 Call Leg/Transaction Does Not Exist ............. 81
7.4.19 482 Loop Detected ................................... 81
7.4.20 483 Too Many Hops ................................... 81
7.4.21 484 Address Incomplete .............................. 81
7.4.22 485 Ambiguous ....................................... 81
7.4.23 486 Busy Here ....................................... 82
7.5 Server Failure 5xx .................................. 82
7.5.1 500 Server Internal Error ........................... 82
7.5.2 501 Not Implemented ................................. 82
7.5.3 502 Bad Gateway ..................................... 82
7.5.4 503 Service Unavailable ............................. 83
7.5.5 504 Gateway Time-out ................................ 83
7.5.6 505 Version Not Supported ........................... 83
7.6 Global Failures 6xx ................................. 83
7.6.1 600 Busy Everywhere ................................. 83
7.6.2 603 Decline ......................................... 84
7.6.3 604 Does Not Exist Anywhere ......................... 84
7.6.4 606 Not Acceptable .................................. 84
8 SIP Message Body .................................... 84
8.1 Body Inclusion ...................................... 84
Handley, et al. Standards Track [Page 4]
RFC 2543 SIP: Session Initiation Protocol March 1999
8.2 Message Body Type ................................... 85
8.3 Message Body Length ................................. 85
9 Compact Form ........................................ 85
10 Behavior of SIP Clients and Servers ................. 86
10.1 General Remarks ..................................... 86
10.1.1 Requests ............................................ 86
10.1.2 Responses ........................................... 87
10.2 Source Addresses, Destination Addresses and
Connections ......................................... 88
10.2.1 Unicast UDP ......................................... 88
10.2.2 Multicast UDP ....................................... 88
10.3 TCP ................................................. 89
10.4 Reliability for BYE, CANCEL, OPTIONS, REGISTER
Requests ............................................ 90
10.4.1 UDP ................................................. 90
10.4.2 TCP ................................................. 91
10.5 Reliability for INVITE Requests ..................... 91
10.5.1 UDP ................................................. 92
10.5.2 TCP ................................................. 95
10.6 Reliability for ACK Requests ........................ 95
10.7 ICMP Handling ....................................... 95
11 Behavior of SIP User Agents ......................... 95
11.1 Caller Issues Initial INVITE Request ................ 96
11.2 Callee Issues Response .............................. 96
11.3 Caller Receives Response to Initial Request ......... 96
11.4 Caller or Callee Generate Subsequent Requests ....... 97
11.5 Receiving Subsequent Requests ....................... 97
12 Behavior of SIP Proxy and Redirect Servers .......... 97
12.1 Redirect Server ..................................... 97
12.2 User Agent Server ................................... 98
12.3 Proxy Server ........................................ 98
12.3.1 Proxying Requests ................................... 98
12.3.2 Proxying Responses .................................. 99
12.3.3 Stateless Proxy: Proxying Responses ................. 99
12.3.4 Stateful Proxy: Receiving Requests .................. 99
12.3.5 Stateful Proxy: Receiving ACKs ...................... 99
12.3.6 Stateful Proxy: Receiving Responses ................. 100
12.3.7 Stateless, Non-Forking Proxy ........................ 100
12.4 Forking Proxy ....................................... 100
13 Security Considerations ............................. 104
13.1 Confidentiality and Privacy: Encryption ............. 104
13.1.1 End-to-End Encryption ............................... 104
13.1.2 Privacy of SIP Responses ............................ 107
13.1.3 Encryption by Proxies ............................... 108
13.1.4 Hop-by-Hop Encryption ............................... 108
13.1.5 Via field encryption ................................ 108
13.2 Message Integrity and Access Control:
Authentication ...................................... 109
Handley, et al. Standards Track [Page 5]
RFC 2543 SIP: Session Initiation Protocol March 1999
13.2.1 Trusting responses .................................. 112
13.3 Callee Privacy ...................................... 113
13.4 Known Security Problems ............................. 113
14 SIP Authentication using HTTP Basic and Digest
Schemes ............................................. 113
14.1 Framework ........................................... 113
14.2 Basic Authentication ................................ 114
14.3 Digest Authentication ............................... 114
14.4 Proxy-Authentication ................................ 115
15 SIP Security Using PGP .............................. 115
15.1 PGP Authentication Scheme ........................... 115
15.1.1 The WWW-Authenticate Response Header ................ 116
15.1.2 The Authorization Request Header .................... 117
15.2 PGP Encryption Scheme ............................... 118
15.3 Response-Key Header Field for PGP ................... 119
16 Examples ............................................ 119
16.1 Registration ........................................ 119
16.2 Invitation to a Multicast Conference ................ 121
16.2.1 Request ............................................. 121
16.2.2 Response ............................................ 122
16.3 Two-party Call ...................................... 123
16.4 Terminating a Call .................................. 125
16.5 Forking Proxy ....................................... 126
16.6 Redirects ........................................... 130
16.7 Negotiation ......................................... 131
16.8 OPTIONS Request ..................................... 132
A Minimal Implementation .............................. 134
A.1 Client .............................................. 134
A.2 Server .............................................. 135
A.3 Header Processing ................................... 135
B Usage of the Session Description Protocol (SDP)...... 136
B.1 Configuring Media Streams ........................... 136
B.2 Setting SDP Values for Unicast ...................... 138
B.3 Multicast Operation ................................. 139
B.4 Delayed Media Streams ............................... 139
B.5 Putting Media Streams on Hold ....................... 139
B.6 Subject and SDP "s=" Line ........................... 140
B.7 The SDP "o=" Line ................................... 140
C Summary of Augmented BNF ............................ 141
C.1 Basic Rules ......................................... 143
D Using SRV DNS Records ............................... 146
E IANA Considerations ................................. 148
F Acknowledgments ..................................... 149
G Authors' Addresses .................................. 149
H Bibliography ........................................ 150
I Full Copyright Statement ............................ 153
Handley, et al. Standards Track [Page 6]
RFC 2543 SIP: Session Initiation Protocol March 1999
1 Introduction
1.1 Overview of SIP Functionality
The Session Initiation Protocol (SIP) is an application-layer control
protocol that can establish, modify and terminate multimedia sessions
or calls. These multimedia sessions include multimedia conferences,
distance learning, Internet telephony and similar applications. SIP
can invite both persons and "robots", such as a media storage
service. SIP can invite parties to both unicast and multicast
sessions; the initiator does not necessarily have to be a member of
the session to which it is inviting. Media and participants can be
added to an existing session.
SIP can be used to initiate sessions as well as invite members to
sessions that have been advertised and established by other means.
Sessions can be advertised using multicast protocols such as SAP,
electronic mail, news groups, web pages or directories (LDAP), among
others.
SIP transparently supports name mapping and redirection services,
allowing the implementation of ISDN and Intelligent Network telephony
subscriber services. These facilities also enable personal mobility.
In the parlance of telecommunications intelligent network services,
this is defined as: "Personal mobility is the ability of end users to
originate and receive calls and access subscribed telecommunication
services on any terminal in any location, and the ability of the
network to identify end users as they move. Personal mobility is
based on the use of a unique personal identity (i.e., personal
number)." [1]. Personal mobility complements terminal mobility, i.e.,
the ability to maintain communications when moving a single end
system from one subnet to another.
SIP supports five facets of establishing and terminating multimedia
communications:
User location: determination of the end system to be used for
communication;
User capabilities: determination of the media and media parameters to
be used;
User availability: determination of the willingness of the called
party to engage in communications;
Call setup: "ringing", establishment of call parameters at both
called and calling party;
Handley, et al. Standards Track [Page 7]
RFC 2543 SIP: Session Initiation Protocol March 1999
Call handling: including transfer and termination of calls.
SIP can also initiate multi-party calls using a multipoint control
unit (MCU) or fully-meshed interconnection instead of multicast.
Internet telephony gateways that connect Public Switched Telephone
Network (PSTN) parties can also use SIP to set up calls between them.
SIP is designed as part of the overall IETF multimedia data and
control architecture currently incorporating protocols such as RSVP
(RFC 2205 [2]) for reserving network resources, the real-time
transport protocol (RTP) (RFC 1889 [3]) for transporting real-time
data and providing QOS feedback, the real-time streaming protocol
(RTSP) (RFC 2326 [4]) for controlling delivery of streaming media,
the session announcement protocol (SAP) [5] for advertising
multimedia sessions via multicast and the session description
protocol (SDP) (RFC 2327 [6]) for describing multimedia sessions.
However, the functionality and operation of SIP does not depend on
any of these protocols.
SIP can also be used in conjunction with other call setup and
signaling protocols. In that mode, an end system uses SIP exchanges
to determine the appropriate end system address and protocol from a
given address that is protocol-independent. For example, SIP could be
used to determine that the party can be reached via H.323 [7], obtain
the H.245 [8] gateway and user address and then use H.225.0 [9] to
establish the call.
In another example, SIP might be used to determine that the callee is
reachable via the PSTN and indicate the phone number to be called,
possibly suggesting an Internet-to-PSTN gateway to be used.
SIP does not offer conference control services such as floor control
or voting and does not prescribe how a conference is to be managed,
but SIP can be used to introduce conference control protocols. SIP
does not allocate multicast addresses.
SIP can invite users to sessions with and without resource
reservation. SIP does not reserve resources, but can convey to the
invited system the information necessary to do this.
1.2 Terminology
In this document, the key words "MUST", "MUST NOT", "REQUIRED",
"SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",
and "OPTIONAL" are to be interpreted as described in RFC 2119 [10]
and indicate requirement levels for compliant SIP implementations.
Handley, et al. Standards Track [Page 8]
RFC 2543 SIP: Session Initiation Protocol March 1999
1.3 Definitions
This specification uses a number of terms to refer to the roles
played by participants in SIP communications. The definitions of
client, server and proxy are similar to those used by the Hypertext
Transport Protocol (HTTP) (RFC 2068 [11]). The terms and generic
syntax of URI and URL are defined in RFC 2396 [12]. The following
terms have special significance for SIP.
Call: A call consists of all participants in a conference invited by
a common source. A SIP call is identified by a globally unique
call-id (Section 6.12). Thus, if a user is, for example, invited
to the same multicast session by several people, each of these
invitations will be a unique call. A point-to-point Internet
telephony conversation maps into a single SIP call. In a
multiparty conference unit (MCU) based call-in conference, each
participant uses a separate call to invite himself to the MCU.
Call leg: A call leg is identified by the combination of Call-ID, To
and From.
Client: An application program that sends SIP requests. Clients may
or may not interact directly with a human user. User agents and
proxies contain clients (and servers).
Conference: A multimedia session (see below), identified by a common
session description. A conference can have zero or more members
and includes the cases of a multicast conference, a full-mesh
conference and a two-party "telephone call", as well as
combinations of these. Any number of calls can be used to
create a conference.
Downstream: Requests sent in the direction from the caller to the
callee (i.e., user agent client to user agent server).
Final response: A response that terminates a SIP transaction, as
opposed to a provisional response that does not. All 2xx, 3xx,
4xx, 5xx and 6xx responses are final.
Initiator, calling party, caller: The party initiating a conference
invitation. Note that the calling party does not have to be the
same as the one creating the conference.
Invitation: A request sent to a user (or service) requesting
participation in a session. A successful SIP invitation consists
of two transactions: an INVITE request followed by an ACK
request.
Handley, et al. Standards Track [Page 9]
RFC 2543 SIP: Session Initiation Protocol March 1999
Invitee, invited user, called party, callee: The person or service
that the calling party is trying to invite to a conference.
Isomorphic request or response: Two requests or responses are defined
to be isomorphic for the purposes of this document if they have
the same values for the Call-ID, To, From and CSeq header
fields. In addition, isomorphic requests have to have the same
Request-URI.
Location server: See location service.
Location service: A location service is used by a SIP redirect or
proxy server to obtain information about a callee's possible
location(s). Location services are offered by location servers.
Location servers MAY be co-located with a SIP server, but the
manner in which a SIP server requests location services is
beyond the scope of this document.
Parallel search: In a parallel search, a proxy issues several
requests to possible user locations upon receiving an incoming
request. Rather than issuing one request and then waiting for
the final response before issuing the next request as in a
sequential search , a parallel search issues requests without
waiting for the result of previous requests.
Provisional response: A response used by the server to indicate
progress, but that does not terminate a SIP transaction. 1xx
responses are provisional, other responses are considered final.
Proxy, proxy server: An intermediary program that acts as both a
server and a client for the purpose of making requests on behalf
of other clients. Requests are serviced internally or by passing
them on, possibly after translation, to other servers. A proxy
interprets, and, if necessary, rewrites a request message before
forwarding it.
Redirect server: A redirect server is a server that accepts a SIP
request, maps the address into zero or more new addresses and
returns these addresses to the client. Unlike a proxy server ,
it does not initiate its own SIP request. Unlike a user agent
server , it does not accept calls.
Registrar: A registrar is a server that accepts REGISTER requests. A
registrar is typically co-located with a proxy or redirect
server and MAY offer location services.
Handley, et al. Standards Track [Page 10]
RFC 2543 SIP: Session Initiation Protocol March 1999
Ringback: Ringback is the signaling tone produced by the calling
client's application indicating that a called party is being
alerted (ringing).
Server: A server is an application program that accepts requests in
order to service requests and sends back responses to those
requests. Servers are either proxy, redirect or user agent
servers or registrars.
Session: From the SDP specification: "A multimedia session is a set
of multimedia senders and receivers and the data streams flowing
from senders to receivers. A multimedia conference is an example
of a multimedia session." (RFC 2327 [6]) (A session as defined
for SDP can comprise one or more RTP sessions.) As defined, a
callee can be invited several times, by different calls, to the
same session. If SDP is used, a session is defined by the
concatenation of the user name , session id , network type ,
address type and address elements in the origin field.
(SIP) transaction: A SIP transaction occurs between a client and a
server and comprises all messages from the first request sent
from the client to the server up to a final (non-1xx) response
sent from the server to the client. A transaction is identified
by the CSeq sequence number (Section 6.17) within a single call
leg. The ACK request has the same CSeq number as the
corresponding INVITE request, but comprises a transaction of its
own.
Upstream: Responses sent in the direction from the user agent server
to the user agent client.
URL-encoded: A character string encoded according to RFC 1738,
Section 2.2 [13].
User agent client (UAC), calling user agent: A user agent client is a
client application that initiates the SIP request.
User agent server (UAS), called user agent: A user agent server is a
server application that contacts the user when a SIP request is
received and that returns a response on behalf of the user. The
response accepts, rejects or redirects the request.
User agent (UA): An application which contains both a user agent
client and user agent server.
An application program MAY be capable of acting both as a client and
a server. For example, a typical multimedia conference control
application would act as a user agent client to initiate calls or to
Handley, et al. Standards Track [Page 11]
RFC 2543 SIP: Session Initiation Protocol March 1999
invite others to conferences and as a user agent server to accept
invitations. The properties of the different SIP server types are
summarized in Table 1.
property redirect proxy user agent registrar
server server server
__________________________________________________________________
also acts as a SIP client no yes no no
returns 1xx status yes yes yes yes
returns 2xx status no yes yes yes
returns 3xx status yes yes yes yes
returns 4xx status yes yes yes yes
returns 5xx status yes yes yes yes
returns 6xx status no yes yes yes
inserts Via header no yes no no
accepts ACK yes yes yes no
Table 1: Properties of the different SIP server types
1.4 Overview of SIP Operation
This section explains the basic protocol functionality and operation.
Callers and callees are identified by SIP addresses, described in
Section 1.4.1. When making a SIP call, a caller first locates the
appropriate server (Section 1.4.2) and then sends a SIP request
(Section 1.4.3). The most common SIP operation is the invitation
(Section 1.4.4). Instead of directly reaching the intended callee, a
SIP request may be redirected or may trigger a chain of new SIP
requests by proxies (Section 1.4.5). Users can register their
location(s) with SIP servers (Section 4.2.6).
1.4.1 SIP Addressing
The "objects" addressed by SIP are users at hosts, identified by a
SIP URL. The SIP URL takes a form similar to a mailto or telnet URL,
i.e., user@host. The user part is a user name or a telephone number.
The host part is either a domain name or a numeric network address.
See section 2 for a detailed discussion of SIP URL's.
A user's SIP address can be obtained out-of-band, can be learned via
existing media agents, can be included in some mailers' message
headers, or can be recorded during previous invitation interactions.
In many cases, a user's SIP URL can be guessed from their email
address.
Handley, et al. Standards Track [Page 12]
RFC 2543 SIP: Session Initiation Protocol March 1999
A SIP URL address can designate an individual (possibly located at
one of several end systems), the first available person from a group
of individuals or a whole group. The form of the address, for
example, sip:sales@example.com , is not sufficient, in general, to
determine the intent of the caller.
If a user or service chooses to be reachable at an address that is
guessable from the person's name and organizational affiliation, the
traditional method of ensuring privacy by having an unlisted "phone"
number is compromised. However, unlike traditional telephony, SIP
offers authentication and access control mechanisms and can avail
itself of lower-layer security mechanisms, so that client software
can reject unauthorized or undesired call attempts.
1.4.2 Locating a SIP Server
When a client wishes to send a request, the client either sends it to
a locally configured SIP proxy server (as in HTTP), independent of
the Request-URI, or sends it to the IP address and port corresponding
to the Request-URI.
For the latter case, the client must determine the protocol, port and
IP address of a server to which to send the request. A client SHOULD
follow the steps below to obtain this information, but MAY follow the
alternative, optional procedure defined in Appendix D. At each step,
unless stated otherwise, the client SHOULD try to contact a server at
the port number listed in the Request-URI. If no port number is
present in the Request-URI, the client uses port 5060. If the
Request-URI specifies a protocol (TCP or UDP), the client contacts
the server using that protocol. If no protocol is specified, the
client tries UDP (if UDP is supported). If the attempt fails, or if
the client doesn't support UDP but supports TCP, it then tries TCP.
A client SHOULD be able to interpret explicit network notifications
(such as ICMP messages) which indicate that a server is not
reachable, rather than relying solely on timeouts. (For socket-based
programs: For TCP, connect() returns ECONNREFUSED if the client could
not connect to a server at that address. For UDP, the socket needs to
be bound to the destination address using connect() rather than
sendto() or similar so that a second write() fails with ECONNREFUSED
if there is no server listening) If the client finds the server is
not reachable at a particular address, it SHOULD behave as if it had
received a 400-class error response to that request.
The client tries to find one or more addresses for the SIP server by
querying DNS. The procedure is as follows:
Handley, et al. Standards Track [Page 13]
RFC 2543 SIP: Session Initiation Protocol March 1999
1. If the host portion of the Request-URI is an IP address,
the client contacts the server at the given address.
Otherwise, the client proceeds to the next step.
2. The client queries the DNS server for address records for
the host portion of the Request-URI. If the DNS server
returns no address records, the client stops, as it has
been unable to locate a server. By address record, we mean
A RR's, AAAA RR's, or other similar address records, chosen
according to the client's network protocol capabilities.
There are no mandatory rules on how to select a host name
for a SIP server. Users are encouraged to name their SIP
servers using the sip.domainname (i.e., sip.example.com)
convention, as specified in RFC 2219 [16]. Users may only
know an email address instead of a full SIP URL for a
callee, however. In that case, implementations may be able
to increase the likelihood of reaching a SIP server for
that domain by constructing a SIP URL from that email
address by prefixing the host name with "sip.". In the
future, this mechanism is likely to become unnecessary as
better DNS techniques, such as the one in Appendix D,
become widely available.
A client MAY cache a successful DNS query result. A successful query
is one which contained records in the answer, and a server was
contacted at one of the addresses from the answer. When the client
wishes to send a request to the same host, it MUST start the search
as if it had just received this answer from the name server. The
client MUST follow the procedures in RFC1035 [15] regarding DNS cache
invalidation when the DNS time-to-live expires.
1.4.3 SIP Transaction
Once the host part has been resolved to a SIP server, the client
sends one or more SIP requests to that server and receives one or
more responses from the server. A request (and its retransmissions)
together with the responses triggered by that request make up a SIP
transaction. All responses to a request contain the same values in
the Call-ID, CSeq, To, and From fields (with the possible addition of
a tag in the To field (section 6.37)). This allows responses to be
matched with requests. The ACK request following an INVITE is not
part of the transaction since it may traverse a different set of
hosts.
Handley, et al. Standards Track [Page 14]
RFC 2543 SIP: Session Initiation Protocol March 1999
If TCP is used, request and responses within a single SIP transaction
are carried over the same TCP connection (see Section 10). Several
SIP requests from the same client to the same server MAY use the same
TCP connection or MAY use a new connection for each request.
If the client sent the request via unicast UDP, the response is sent
to the address contained in the next Via header field (Section 6.40)
of the response. If the request is sent via multicast UDP, the
response is directed to the same multicast address and destination
port. For UDP, reliability is achieved using retransmission (Section
10).
The SIP message format and operation is independent of the transport
protocol.
1.4.4 SIP Invitation
A successful SIP invitation consists of two requests, INVITE followed
by ACK. The INVITE (Section 4.2.1) request asks the callee to join a
particular conference or establish a two-party conversation. After
the callee has agreed to participate in the call, the caller confirms
that it has received that response by sending an ACK (Section 4.2.2)
request. If the caller no longer wants to participate in the call, it
sends a BYE request instead of an ACK.
The INVITE request typically contains a session description, for
example written in SDP (RFC 2327 [6]) format, that provides the
called party with enough information to join the session. For
multicast sessions, the session description enumerates the media
types and formats that are allowed to be distributed to that session.
For a unicast session, the session description enumerates the media
types and formats that the caller is willing to use and where it
wishes the media data to be sent. In either case, if the callee
wishes to accept the call, it responds to the invitation by returning
a similar description listing the media it wishes to use. For a
multicast session, the callee SHOULD only return a session
description if it is unable to receive the media indicated in the
caller's description or wants to receive data via unicast.
The protocol exchanges for the INVITE method are shown in Fig. 1 for
a proxy server and in Fig. 2 for a redirect server. (Note that the
messages shown in the figures have been abbreviated slightly.) In
Fig. 1, the proxy server accepts the INVITE request (step 1),
contacts the location service with all or parts of the address (step
2) and obtains a more precise location (step 3). The proxy server
then issues a SIP INVITE request to the address(es) returned by the
location service (step 4). The user agent server alerts the user
(step 5) and returns a success indication to the proxy server (step
Handley, et al. Standards Track [Page 15]
RFC 2543 SIP: Session Initiation Protocol March 1999
6). The proxy server then returns the success result to the original
caller (step 7). The receipt of this message is confirmed by the
caller using an ACK request, which is forwarded to the callee (steps
8 and 9). Note that an ACK can also be sent directly to the callee,
bypassing the proxy. All requests and responses have the same Call-
ID.
+....... cs.columbia.edu .......+
: :
: (~~~~~~~~~~) :
: ( location ) :
: ( service ) :
: (~~~~~~~~~~) :
: ^ | :
: | hgs@lab :
: 2| 3| :
: | | :
: henning | :
+.. cs.tu-berlin.de ..+ 1: INVITE : | | :
: : henning@cs.col: | \/ 4: INVITE 5: ring :
: cz@cs.tu-berlin.de ========================>(~~~~~~)=========>(~~~~~~) :
: <........................( )<.........( ) :
: : 7: 200 OK : ( )6: 200 OK ( ) :
: : : ( work ) ( lab ) :
: : 8: ACK : ( )9: ACK ( ) :
: ========================>(~~~~~~)=========>(~~~~~~) :
+.....................+ +...............................+
====> SIP request
....> SIP response
^
| non-SIP protocols
|
Figure 1: Example of SIP proxy server
The redirect server shown in Fig. 2 accepts the INVITE request (step
1), contacts the location service as before (steps 2 and 3) and,
instead of contacting the newly found address itself, returns the
address to the caller (step 4), which is then acknowledged via an ACK
Handley, et al. Standards Track [Page 16]
RFC 2543 SIP: Session Initiation Protocol March 1999
request (step 5). The caller issues a new request, with the same
call-ID but a higher CSeq, to the address returned by the first
server (step 6). In the example, the call succeeds (step 7). The
caller and callee complete the handshake with an ACK (step 8).
The next section discusses what happens if the location service
returns more than one possible alternative.
1.4.5 Locating a User
A callee may move between a number of different end systems over
time. These locations can be dynamically registered with the SIP
server (Sections 1.4.7, 4.2.6). A location server MAY also use one or
more other protocols, such as finger (RFC 1288 [17]), rwhois (RFC
2167 [18]), LDAP (RFC 1777 [19]), multicast-based protocols [20] or
operating-system dependent mechanisms to actively determine the end
system where a user might be reachable. A location server MAY return
several locations because the user is logged in at several hosts
simultaneously or because the location server has (temporarily)
inaccurate information. The SIP server combines the results to yield
a list of a zero or more locations.
The action taken on receiving a list of locations varies with the
type of SIP server. A SIP redirect server returns the list to the
client as Contact headers (Section 6.13). A SIP proxy server can
sequentially or in parallel try the addresses until the call is
successful (2xx response) or the callee has declined the call (6xx
response). With sequential attempts, a proxy server can implement an
"anycast" service.
If a proxy server forwards a SIP request, it MUST add itself to the
beginning of the list of forwarders noted in the Via (Section 6.40)
headers. The Via trace ensures that replies can take the same path
back, ensuring correct operation through compliant firewalls and
avoiding request loops. On the response path, each host MUST remove
its Via, so that routing internal information is hidden from the
callee and outside networks. A proxy server MUST check that it does
not generate a request to a host listed in the Via sent-by, via-
received or via-maddr parameters (Section 6.40). (Note: If a host has
several names or network addresses, this does not always work. Thus,
each host also checks if it is part of the Via list.)
A SIP invitation may traverse more than one SIP proxy server. If one
of these "forks" the request, i.e., issues more than one request in
response to receiving the invitation request, it is possible that a
client is reached, independently, by more than one copy of the
Handley, et al. Standards Track [Page 17]
RFC 2543 SIP: Session Initiation Protocol March 1999
invitation request. Each of these copies bears the same Call-ID. The
user agent MUST return the same status response returned in the first
response. Duplicate requests are not an error.
1.4.6 Changing an Existing Session
In some circumstances, it is desirable to change the parameters of an
existing session. This is done by re-issuing the INVITE, using the
same Call-ID, but a new or different body or header fields to convey
the new information. This re INVITE MUST have a higher CSeq than any
previous request from the client to the server.
For example, two parties may have been conversing and then want to
add a third party, switching to multicast for efficiency. One of the
participants invites the third party with the new multicast address
and simultaneously sends an INVITE to the second party, with the new
multicast session description, but with the old call identifier.
1.4.7 Registration Services
The REGISTER request allows a client to let a proxy or redirect
server know at which address(es) it can be reached. A client MAY also
use it to install call handling features at the server.
1.5 Protocol Properties
1.5.1 Minimal State
A single conference session or call involves one or more SIP
request-response transactions. Proxy servers do not have to keep
state for a particular call, however, they MAY maintain state for a
single SIP transaction, as discussed in Section 12. For efficiency, a
server MAY cache the results of location service requests.
1.5.2 Lower-Layer-Protocol Neutral
SIP makes minimal assumptions about the underlying transport and
network-layer protocols. The lower-layer can provide either a packet
or a byte stream service, with reliable or unreliable service.
In an Internet context, SIP is able to utilize both UDP and TCP as
transport protocols, among others. UDP allows the application to more
carefully control the timing of messages and their retransmission, to
perform parallel searches without requiring TCP connection state for
each outstanding request, and to use multicast. Routers can more
readily snoop SIP UDP packets. TCP allows easier passage through
existing firewalls.
Handley, et al. Standards Track [Page 18]
RFC 2543 SIP: Session Initiation Protocol March 1999
+....... cs.columbia.edu .......+
: :
: (~~~~~~~~~~) :
: ( location ) :
: ( service ) :
: (~~~~~~~~~~) :
: ^ | :
: | hgs@lab :
: 2| 3| :
: | | :
: henning| :
+.. cs.tu-berlin.de ..+ 1: INVITE : | | :
: : henning@cs.col: | \/ :
: cz@cs.tu-berlin.de =======================>(~~~~~~) :
: | ^ | <.......................( ) :
: | . | : 4: 302 Moved : ( ) :
: | . | : hgs@lab : ( work ) :
: | . | : : ( ) :
: | . | : 5: ACK : ( ) :
: | . | =======================>(~~~~~~) :
: | . | : : :
+.......|...|.........+ : :
| . | : :
| . | : :
| . | : :
| . | : :
| . | 6: INVITE hgs@lab.cs.columbia.edu (~~~~~~) :
| . ==================================================> ( ) :
| ..................................................... ( ) :
| 7: 200 OK : ( lab ) :
| : ( ) :
| 8: ACK : ( ) :
======================================================> (~~~~~~) :
+...............................+
====> SIP request
....> SIP response
^
| non-SIP protocols
|
Figure 2: Example of SIP redirect server
Handley, et al. Standards Track [Page 19]
RFC 2543 SIP: Session Initiation Protocol March 1999
When TCP is used, SIP can use one or more connections to attempt to
contact a user or to modify parameters of an existing conference.
Different SIP requests for the same SIP call MAY use different TCP
connections or a single persistent connection, as appropriate.
For concreteness, this document will only refer to Internet
protocols. However, SIP MAY also be used directly with protocols
such as ATM AAL5, IPX, frame relay or X.25. The necessary naming
conventions are beyond the scope of this document. User agents SHOULD
implement both UDP and TCP transport. Proxy, registrar, and redirect
servers MUST implement both UDP and TCP transport.
1.5.3 Text-Based
SIP is text-based, using ISO 10646 in UTF-8 encoding throughout. This
allows easy implementation in languages such as Java, Tcl and Perl,
allows easy debugging, and most importantly, makes SIP flexible and
extensible. As SIP is used for initiating multimedia conferences
rather than delivering media data, it is believed that the additional
overhead of using a text-based protocol is not significant.
2 SIP Uniform Resource Locators
SIP URLs are used within SIP messages to indicate the originator
(From), current destination (Request-URI) and final recipient (To) of
a SIP request, and to specify redirection addresses (Contact). A SIP
URL can also be embedded in web pages or other hyperlinks to indicate
that a particular user or service can be called via SIP. When used as
a hyperlink, the SIP URL indicates the use of the INVITE method.
The SIP URL scheme is defined to allow setting SIP request-header
fields and the SIP message-body.
This corresponds to the use of mailto: URLs. It makes it
possible, for example, to specify the subject, urgency or
media types of calls initiated through a web page or as
part of an email message.
A SIP URL follows the guidelines of RFC 2396 [12] and has the syntax
shown in Fig. 3. The syntax is described using Augmented Backus-Naur
Form (See Section C). Note that reserved characters have to be
escaped and that the "set of characters reserved within any given URI
component is defined by that component. In general, a character is
reserved if the semantics of the URI changes if the character is
replaced with its escaped US-ASCII encoding" [12].
Handley, et al. Standards Track [Page 20]
RFC 2543 SIP: Session Initiation Protocol March 1999
SIP-URL = "sip:" [ userinfo "@" ] hostport
url-parameters [ headers ]
userinfo = user [ ":" password ]
user = *( unreserved | escaped
| "&" | "=" | "+" | "$" | "," )
password = *( unreserved | escaped
| "&" | "=" | "+" | "$" | "," )
hostport = host [ ":" port ]
host = hostname | IPv4address
hostname = *( domainlabel "." ) toplabel [ "." ]
domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
toplabel = alpha | alpha *( alphanum | "-" ) alphanum
IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit
port = *digit
url-parameters = *( ";" url-parameter )
url-parameter = transport-param | user-param | method-param
| ttl-param | maddr-param | other-param
transport-param = "transport=" ( "udp" | "tcp" )
ttl-param = "ttl=" ttl
ttl = 1*3DIGIT ; 0 to 255
maddr-param = "maddr=" host
user-param = "user=" ( "phone" | "ip" )
method-param = "method=" Method
tag-param = "tag=" UUID
UUID = 1*( hex | "-" )
other-param = ( token | ( token "=" ( token | quoted-string )))
headers = "?" header *( "&" header )
header = hname "=" hvalue
hname = 1*uric
hvalue = *uric
uric = reserved | unreserved | escaped
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
"$" | ","
digits = 1*DIGIT
Figure 3: SIP URL syntax
The URI character classes referenced above are described in Appendix
C.
The components of the SIP URI have the following meanings.
Handley, et al. Standards Track [Page 21]
RFC 2543 SIP: Session Initiation Protocol March 1999
telephone-subscriber = global-phone-number | local-phone-number
global-phone-number = "+" 1*phonedigit [isdn-subaddress]
[post-dial]
local-phone-number = 1*(phonedigit | dtmf-digit |
pause-character) [isdn-subaddress]
[post-dial]
isdn-subaddress = ";isub=" 1*phonedigit
post-dial = ";postd=" 1*(phonedigit | dtmf-digit
| pause-character)
phonedigit = DIGIT | visual-separator
visual-separator = "-" | "."
pause-character = one-second-pause | wait-for-dial-tone
one-second-pause = "p"
wait-for-dial-tone = "w"
dtmf-digit = "*" | "#" | "A" | "B" | "C" | "D"
Figure 4: SIP URL syntax; telephone subscriber
user: If the host is an Internet telephony gateway, the user field
MAY also encode a telephone number using the notation of
telephone-subscriber (Fig. 4). The telephone number is a special
case of a user name and cannot be distinguished by a BNF. Thus,
a URL parameter, user, is added to distinguish telephone numbers
from user names. The phone identifier is to be used when
connecting to a telephony gateway. Even without this parameter,
recipients of SIP URLs MAY interpret the pre-@ part as a phone
number if local restrictions on the name space for user name
allow it.
password: The SIP scheme MAY use the format "user:password" in the
userinfo field. The use of passwords in the userinfo is NOT
RECOMMENDED, because the passing of authentication information
in clear text (such as URIs) has proven to be a security risk in
almost every case where it has been used.
host: The mailto: URL and RFC 822 email addresses require that
numeric host addresses ("host numbers") are enclosed in square
brackets (presumably, since host names might be numeric), while
host numbers without brackets are used for all other URLs. The
SIP URL requires the latter form, without brackets.
The issue of IPv6 literal addresses in URLs is being looked at
elsewhere in the IETF. SIP implementers are advised to keep up to
date on that activity.
Handley, et al. Standards Track [Page 22]
RFC 2543 SIP: Session Initiation Protocol March 1999
port: The port number to send a request to. If not present, the
procedures outlined in Section 1.4.2 are used to determine the
port number to send a request to.
URL parameters: SIP URLs can define specific parameters of the
request. URL parameters are added after the host component and
are separated by semi-colons. The transport parameter determines
the the transport mechanism (UDP or TCP). UDP is to be assumed
when no explicit transport parameter is included. The maddr
parameter provides the server address to be contacted for this
user, overriding the address supplied in the host field. This
address is typically a multicast address, but could also be the
address of a backup server. The ttl parameter determines the
time-to-live value of the UDP multicast packet and MUST only be
used if maddr is a multicast address and the transport protocol
is UDP. The user parameter was described above. For example, to
specify to call j.doe@big.com using multicast to 239.255.255.1
with a ttl of 15, the following URL would be used:
sip:j.doe@big.com;maddr=239.255.255.1;ttl=15
The transport, maddr, and ttl parameters MUST NOT be used in the From
and To header fields and the Request-URI; they are ignored if
present.
Headers: Headers of the SIP request can be defined with the "?"
mechanism within a SIP URL. The special hname "body" indicates
that the associated hvalue is the message-body of the SIP INVITE
request. Headers MUST NOT be used in the From and To header
fields and the Request-URI; they are ignored if present. hname
and hvalue are encodings of a SIP header name and value,
respectively. All URL reserved characters in the header names
and values MUST be escaped.
Method: The method of the SIP request can be specified with the
method parameter. This parameter MUST NOT be used in the From
and To header fields and the Request-URI; they are ignored if
present.
Table 2 summarizes where the components of the SIP URL can be used
and what default values they assume if not present.
Examples of SIP URLs are:
Handley, et al. Standards Track [Page 23]
RFC 2543 SIP: Session Initiation Protocol March 1999
default Req.-URI To From Contact external
user -- x x x x x
password -- x x x x
host mandatory x x x x x
port 5060 x x x x x
user-param ip x x x x x
method INVITE x x
maddr-param -- x x
ttl-param 1 x x
transp.-param -- x x
headers -- x x
Table 2: Use and default values of URL components for SIP headers,
Request-URI and references
sip:j.doe@big.com
sip:j.doe:secret@big.com;transport=tcp
sip:j.doe@big.com?subject=project
sip:+1-212-555-1212:1234@gateway.com;user=phone
sip:1212@gateway.com
sip:alice@10.1.2.3
sip:alice@example.com
sip:alice%40example.com@gateway.com
sip:alice@registrar.com;method=REGISTER
Within a SIP message, URLs are used to indicate the source and
intended destination of a request, redirection addresses and the
current destination of a request. Normally all these fields will
contain SIP URLs.
SIP URLs are case-insensitive, so that for example the two URLs
sip:j.doe@example.com and SIP:J.Doe@Example.com are equivalent. All
URL parameters are included when comparing SIP URLs for equality.
SIP header fields MAY contain non-SIP URLs. As an example, if a call
from a telephone is relayed to the Internet via SIP, the SIP From
header field might contain a phone URL.
3 SIP Message Overview
SIP is a text-based protocol and uses the ISO 10646 character set in
UTF-8 encoding (RFC 2279 [21]). Senders MUST terminate lines with a
CRLF, but receivers MUST also interpret CR and LF by themselves as
line terminators.
Handley, et al. Standards Track [Page 24]
RFC 2543 SIP: Session Initiation Protocol March 1999
Except for the above difference in character sets, much of the
message syntax is and header fields are identical to HTTP/1.1; rather
than repeating the syntax and semantics here we use [HX.Y] to refer
to Section X.Y of the current HTTP/1.1 specification (RFC 2068 [11]).
In addition, we describe SIP in both prose and an augmented Backus-
Naur form (ABNF). See section C for an overview of ABNF.
Note, however, that SIP is not an extension of HTTP.
Unlike HTTP, SIP MAY use UDP. When sent over TCP or UDP, multiple SIP
transactions can be carried in a single TCP connection or UDP
datagram. UDP datagrams, including all headers, SHOULD NOT be larger
than the path maximum transmission unit (MTU) if the MTU is known, or
1500 bytes if the MTU is unknown.
The 1500 bytes accommodates encapsulation within the
"typical" ethernet MTU without IP fragmentation. Recent
studies [22] indicate that an MTU of 1500 bytes is a
reasonable assumption. The next lower common MTU values are
1006 bytes for SLIP and 296 for low-delay PPP (RFC 1191
[23]). Thus, another reasonable value would be a message
size of 950 bytes, to accommodate packet headers within the
SLIP MTU without fragmentation.
A SIP message is either a request from a client to a server, or a
response from a server to a client.
SIP-message = Request | Response
Both Request (section 4) and Response (section 5) messages use the
generic-message format of RFC 822 [24] for transferring entities (the
body of the message). Both types of messages consist of a start-line,
one or more header fields (also known as "headers"), an empty line
(i.e., a line with nothing preceding the carriage-return line-feed
(CRLF)) indicating the end of the header fields, and an optional
message-body. To avoid confusion with similar-named headers in HTTP,
we refer to the headers describing the message body as entity
headers. These components are described in detail in the upcoming
sections.
generic-message = start-line
*message-header
Handley, et al. Standards Track [Page 25]
RFC 2543 SIP: Session Initiation Protocol March 1999
CRLF
[ message-body ]
start-line = Request-Line | ;Section 4.1
Status-Line ;Section 5.1
message-header = ( general-header
| request-header
| response-header
| entity-header )
In the interest of robustness, any leading empty line(s) MUST be
ignored. In other words, if the Request or Response message begins
with one or more CRLF, CR, or LFs, these characters MUST be ignored.
4 Request
The Request message format is shown below:
Request = Request-Line ; Section 4.1
*( general-header
| request-header
| entity-header )
CRLF
[ message-body ] ; Section 8
4.1 Request-Line
The Request-Line begins with a method token, followed by the
Request-URI and the protocol version, and ending with CRLF. The
elements are separated by SP characters. No CR or LF are allowed
except in the final CRLF sequence.
Request-Line = Method SP Request-URI SP SIP-Version CRLF
Handley, et al. Standards Track [Page 26]
RFC 2543 SIP: Session Initiation Protocol March 1999
general-header = Accept ; Section 6.7
| Accept-Encoding ; Section 6.8
| Accept-Language ; Section 6.9
| Call-ID ; Section 6.12
| Contact ; Section 6.13
| CSeq ; Section 6.17
| Date ; Section 6.18
| Encryption ; Section 6.19
| Expires ; Section 6.20
| From ; Section 6.21
| Record-Route ; Section 6.29
| Timestamp ; Section 6.36
| To ; Section 6.37
| Via ; Section 6.40
entity-header = Content-Encoding ; Section 6.14
| Content-Length ; Section 6.15
| Content-Type ; Section 6.16
request-header = Authorization ; Section 6.11
| Contact ; Section 6.13
| Hide ; Section 6.22
| Max-Forwards ; Section 6.23
| Organization ; Section 6.24
| Priority ; Section 6.25
| Proxy-Authorization ; Section 6.27
| Proxy-Require ; Section 6.28
| Route ; Section 6.33
| Require ; Section 6.30
| Response-Key ; Section 6.31
| Subject ; Section 6.35
| User-Agent ; Section 6.39
response-header = Allow ; Section 6.10
| Proxy-Authenticate ; Section 6.26
| Retry-After ; Section 6.32
| Server ; Section 6.34
| Unsupported ; Section 6.38
| Warning ; Section 6.41
| WWW-Authenticate ; Section 6.42
Table 3: SIP headers
4.2 Methods
The methods are defined below. Methods that are not supported by a
proxy or redirect server are treated by that server as if they were
an OPTIONS method and forwarded accordingly. Methods that are not
Handley, et al. Standards Track [Page 27]
RFC 2543 SIP: Session Initiation Protocol March 1999
supported by a user agent server or registrar cause a 501 (Not
Implemented) response to be returned (Section 7). As in HTTP, the
Method token is case-sensitive.
Method = "INVITE" | "ACK" | "OPTIONS" | "BYE"
| "CANCEL" | "REGISTER"
4.2.1 INVITE
The INVITE method indicates that the user or service is being invited
to participate in a session. The message body contains a description
of the session to which the callee is being invited. For two-party
calls, the caller indicates the type of media it is able to receive
and possibly the media it is willing to send as well as their
parameters such as network destination. A success response MUST
indicate in its message body which media the callee wishes to receive
and MAY indicate the media the callee is going to send.
Not all session description formats have the ability to
indicate sending media.
A server MAY automatically respond to an invitation for a conference
the user is already participating in, identified either by the SIP
Call-ID or a globally unique identifier within the session
description, with a 200 (OK) response.
If a user agent receives an INVITE request for an existing call leg
with a higher CSeq sequence number than any previous INVITE for the
same Call-ID, it MUST check any version identifiers in the session
description or, if there are no version identifiers, the content of
the session description to see if it has changed. It MUST also
inspect any other header fields for changes. If there is a change,
the user agent MUST update any internal state or information
generated as a result of that header. If the session description has
changed, the user agent server MUST adjust the session parameters
accordingly, possibly after asking the user for confirmation.
(Versioning of the session description can be used to accommodate the
capabilities of new arrivals to a conference, add or delete media or
change from a unicast to a multicast conference.)
This method MUST be supported by SIP proxy, redirect and user agent
servers as well as clients.
Handley, et al. Standards Track [Page 28]
RFC 2543 SIP: Session Initiation Protocol March 1999
4.2.2 ACK
The ACK request confirms that the client has received a final
response to an INVITE request. (ACK is used only with INVITE
requests.) 2xx responses are acknowledged by client user agents, all
other final responses by the first proxy or client user agent to
receive the response. The Via is always initialized to the host that
originates the ACK request, i.e., the client user agent after a 2xx
response or the first proxy to receive a non-2xx final response. The
ACK request is forwarded as the corresponding INVITE request, based
on its Request-URI. See Section 10 for details.
The ACK request MAY contain a message body with the final session
description to be used by the callee. If the ACK message body is
empty, the callee uses the session description in the INVITE request.
A proxy server receiving an ACK request after having sent a 3xx, 4xx,
5xx, or 6xx response must make a determination about whether the ACK
is for it, or for some user agent or proxy server further downstream.
This determination is made by examining the tag in the To field. If
the tag in the ACK To header field matches the tag in the To header
field of the response, and the From, CSeq and Call-ID header fields
in the response match those in the ACK, the ACK is meant for the
proxy server. Otherwise, the ACK SHOULD be proxied downstream as any
other request.
It is possible for a user agent client or proxy server to
receive multiple 3xx, 4xx, 5xx, and 6xx responses to a
request along a single branch. This can happen under
various error conditions, typically when a forking proxy
transitions from stateful to stateless before receiving all
responses. The various responses will all be identical,
except for the tag in the To field, which is different for
each one. It can therefore be used as a means to
disambiguate them.
This method MUST be supported by SIP proxy, redirect and user agent
servers as well as clients.
4.2.3 OPTIONS
The server is being queried as to its capabilities. A server that
believes it can contact the user, such as a user agent where the user
is logged in and has been recently active, MAY respond to this
request with a capability set. A called user agent MAY return a
status reflecting how it would have responded to an invitation, e.g.,
Handley, et al. Standards Track [Page 29]
RFC 2543 SIP: Session Initiation Protocol March 1999
600 (Busy). Such a server SHOULD return an Allow header field
indicating the methods that it supports. Proxy and redirect servers
simply forward the request without indicating their capabilities.
This method MUST be supported by SIP proxy, redirect and user agent
servers, registrars and clients.
4.2.4 BYE
The user agent client uses BYE to indicate to the server that it
wishes to release the call. A BYE request is forwarded like an INVITE
request and MAY be issued by either caller or callee. A party to a
call SHOULD issue a BYE request before releasing a call ("hanging
up"). A party receiving a BYE request MUST cease transmitting media
streams specifically directed at the party issuing the BYE request.
If the INVITE request contained a Contact header, the callee SHOULD
send a BYE request to that address rather than the From address.
This method MUST be supported by proxy servers and SHOULD be
supported by redirect and user agent SIP servers.
4.2.5 CANCEL
The CANCEL request cancels a pending request with the same Call-ID,
To, From and CSeq (sequence number only) header field values, but
does not affect a completed request. (A request is considered
completed if the server has returned a final status response.)
A user agent client or proxy client MAY issue a CANCEL request at any
time. A proxy, in particular, MAY choose to send a CANCEL to
destinations that have not yet returned a final response after it has
received a 2xx or 6xx response for one or more of the parallel-search
requests. A proxy that receives a CANCEL request forwards the request
to all destinations with pending requests.
The Call-ID, To, the numeric part of CSeq and From headers in the
CANCEL request are identical to those in the original request. This
allows a CANCEL request to be matched with the request it cancels.
However, to allow the client to distinguish responses to the CANCEL
from those to the original request, the CSeq Method component is set
to CANCEL. The Via header field is initialized to the proxy issuing
the CANCEL request. (Thus, responses to this CANCEL request only
reach the issuing proxy.)
Once a user agent server has received a CANCEL, it MUST NOT issue a
2xx response for the cancelled original request.
Handley, et al. Standards Track [Page 30]
RFC 2543 SIP: Session Initiation Protocol March 1999
A redirect or user agent server receiving a CANCEL request responds
with a status of 200 (OK) if the transaction exists and a status of
481 (Transaction Does Not Exist) if not, but takes no further action.
In particular, any existing call is unaffected.
The BYE request cannot be used to cancel branches of a
parallel search, since several branches may, through
intermediate proxies, find the same user agent server and
then terminate the call. To terminate a call instead of
just pending searches, the UAC must use BYE instead of or
in addition to CANCEL. While CANCEL can terminate any
pending request other than ACK or CANCEL, it is typically
useful only for INVITE. 200 responses to INVITE and 200
responses to CANCEL are distinguished by the method in the
Cseq header field, so there is no ambiguity.
This method MUST be supported by proxy servers and SHOULD be
supported by all other SIP server types.
4.2.6 REGISTER
A client uses the REGISTER method to register the address listed in
the To header field with a SIP server.
A user agent MAY register with a local server on startup by sending a
REGISTER request to the well-known "all SIP servers" multicast
address "sip.mcast.net" (224.0.1.75). This request SHOULD be scoped
to ensure it is not forwarded beyond the boundaries of the
administrative system. This MAY be done with either TTL or
administrative scopes [25], depending on what is implemented in the
network. SIP user agents MAY listen to that address and use it to
become aware of the location of other local users [20]; however, they
do not respond to the request. A user agent MAY also be configured
with the address of a registrar server to which it sends a REGISTER
request upon startup.
Requests are processed in the order received. Clients SHOULD avoid
sending a new registration (as opposed to a retransmission) until
they have received the response from the server for the previous one.
Clients may register from different locations, by necessity
using different Call-ID values. Thus, the CSeq value cannot
be used to enforce ordering. Since registrations are
additive, ordering is less of a problem than if each
REGISTER request completely replaced all earlier ones.
Handley, et al. Standards Track [Page 31]
RFC 2543 SIP: Session Initiation Protocol March 1999
The meaning of the REGISTER request-header fields is defined as
follows. We define "address-of-record" as the SIP address that the
registry knows the registrand, typically of the form "user@domain"
rather than "user@host". In third-party registration, the entity
issuing the request is different from the entity being registered.
To: The To header field contains the address-of-record whose
registration is to be created or updated.
From: The From header field contains the address-of-record of the
person responsible for the registration. For first-party
registration, it is identical to the To header field value.
Request-URI: The Request-URI names the destination of the
registration request, i.e., the domain of the registrar. The
user name MUST be empty. Generally, the domains in the Request-
URI and the To header field have the same value; however, it is
possible to register as a "visitor", while maintaining one's
name. For example, a traveler sip:alice@acme.com (To) might
register under the Request-URI sip:atlanta.hiayh.org , with the
former as the To header field and the latter as the Request-URI.
The REGISTER request is no longer forwarded once it has reached
the server whose authoritative domain is the one listed in the
Request-URI.
Call-ID: All registrations from a client SHOULD use the same Call-ID
header value, at least within the same reboot cycle.
Cseq: Registrations with the same Call-ID MUST have increasing CSeq
header values. However, the server does not reject out-of-order
requests.
Contact: The request MAY contain a Contact header field; future non-
REGISTER requests for the URI given in the To header field
SHOULD be directed to the address(es) given in the Contact
header.
If the request does not contain a Contact header, the registration
remains unchanged.
This is useful to obtain the current list of registrations
in the response. Registrations using SIP URIs that differ
in one or more of host, port, transport-param or maddr-
param (see Figure 3) from an existing registration are
added to the list of registrations. Other URI types are
compared according to the standard URI equivalency rules
for the URI schema. If the URIs are equivalent to that of
an existing registration, the new registration replaces the
Handley, et al. Standards Track [Page 32]
RFC 2543 SIP: Session Initiation Protocol March 1999
old one if it has a higher q value or, for the same value
of q, if the ttl value is higher. All current registrations
MUST share the same action value. Registrations that have
a different action than current registrations for the same
user MUST be rejected with status of 409 (Conflict).
A proxy server ignores the q parameter when processing non-REGISTER
requests, while a redirect server simply returns that parameter in
its Contact response header field.
Having the proxy server interpret the q parameter is not
sufficient to guide proxy behavior, as it is not clear, for
example, how long it is supposed to wait between trying
addresses.
If the registration is changed while a user agent or proxy server
processes an invitation, the new information SHOULD be used.
This allows a service known as "directed pick-up". In the
telephone network, directed pickup permits a user at a
remote station who hears his own phone ringing to pick up
at that station, dial an access code, and be connected to
the calling user as if he had answered his own phone.
A server MAY choose any duration for the registration lifetime.
Registrations not refreshed after this amount of time SHOULD be
silently discarded. Responses to a registration SHOULD include an
Expires header (Section 6.20) or expires Contact parameters (Section
6.13), indicating the time at which the server will drop the
registration. If none is present, one hour is assumed. Clients MAY
request a registration lifetime by indicating the time in an Expires
header in the request. A server SHOULD NOT use a higher lifetime than
the one requested, but MAY use a lower one. A single address (if
host-independent) MAY be registered from several different clients.
A client cancels an existing registration by sending a REGISTER
request with an expiration time (Expires) of zero seconds for a
particular Contact or the wildcard Contact designated by a "*" for
all registrations. Registrations are matched based on the user, host,
port and maddr parameters.
The server SHOULD return the current list of registrations in the 200
response as Contact header fields.
It is particularly important that REGISTER requests are authenticated
since they allow to redirect future requests (see Section 13.2).
Handley, et al. Standards Track [Page 33]
RFC 2543 SIP: Session Initiation Protocol March 1999
Beyond its use as a simple location service, this method is
needed if there are several SIP servers on a single host.
In that case, only one of the servers can use the default
port number.
Support of this method is RECOMMENDED.
4.3 Request-URI
The Request-URI is a SIP URL as described in Section 2 or a general
URI. It indicates the user or service to which this request is being
addressed. Unlike the To field, the Request-URI MAY be re-written by
proxies.
When used as a Request-URI, a SIP-URL MUST NOT contain the
transport-param, maddr-param, ttl-param, or headers elements. A
server that receives a SIP-URL with these elements removes them
before further processing.
Typically, the UAC sets the Request-URI and To to the same
SIP URL, presumed to remain unchanged over long time
periods. However, if the UAC has cached a more direct path
to the callee, e.g., from the Contact header field of a
response to a previous request, the To would still contain
the long-term, "public" address, while the Request-URI
would be set to the cached address.
Proxy and redirect servers MAY use the information in the Request-URI
and request header fields to handle the request and possibly rewrite
the Request-URI. For example, a request addressed to the generic
address sip:sales@acme.com is proxied to the particular person, e.g.,
sip:bob@ny.acme.com , with the To field remaining as
sip:sales@acme.com. At ny.acme.com , Bob then designates Alice as
the temporary substitute.
The host part of the Request-URI typically agrees with one of the
host names of the receiving server. If it does not, the server SHOULD
proxy the request to the address indicated or return a 404 (Not
Found) response if it is unwilling or unable to do so. For example,
the Request-URI and server host name can disagree in the case of a
firewall proxy that handles outgoing calls. This mode of operation is
similar to that of HTTP proxies.
If a SIP server receives a request with a URI indicating a scheme
other than SIP which that server does not understand, the server MUST
return a 400 (Bad Request) response. It MUST do this even if the To
Handley, et al. Standards Track [Page 34]
RFC 2543 SIP: Session Initiation Protocol March 1999
header field contains a scheme it does understand. This is because
proxies are responsible for processing the Request-URI; the To field
is of end-to-end significance.
4.3.1 SIP Version
Both request and response messages include the version of SIP in use,
and follow [H3.1] (with HTTP replaced by SIP, and HTTP/1.1 replaced
by SIP/2.0) regarding version ordering, compliance requirements, and
upgrading of version numbers. To be compliant with this
specification, applications sending SIP messages MUST include a SIP-
Version of "SIP/2.0".
4.4 Option Tags
Option tags are unique identifiers used to designate new options in
SIP. These tags are used in Require (Section 6.30) and Unsupported
(Section 6.38) fields.
Syntax:
option-tag = token
See Section C for a definition of token. The creator of a new SIP
option MUST either prefix the option with their reverse domain name
or register the new option with the Internet Assigned Numbers
Authority (IANA). For example, "com.foo.mynewfeature" is an apt name
for a feature whose inventor can be reached at "foo.com". Individual
organizations are then responsible for ensuring that option names
don't collide. Options registered with IANA have the prefix
"org.iana.sip.", options described in RFCs have the prefix
"org.ietf.rfc.N", where N is the RFC number. Option tags are case-
insensitive.
4.4.1 Registering New Option Tags with IANA
When registering a new SIP option, the following information MUST be
provided:
o Name and description of option. The name MAY be of any
length, but SHOULD be no more than twenty characters long. The
name MUST consist of alphanum (See Figure 3) characters only;
Handley, et al. Standards Track [Page 35]
RFC 2543 SIP: Session Initiation Protocol March 1999
o Indication of who has change control over the option (for
example, IETF, ISO, ITU-T, other international standardization
bodies, a consortium or a particular company or group of
companies);
o A reference to a further description, if available, for
example (in order of preference) an RFC, a published paper, a
patent filing, a technical report, documented source code or a
computer manual;
o Contact information (postal and email address);
Registrations should be sent to iana@iana.org
This procedure has been borrowed from RTSP [4] and the RTP
AVP [26].
5 Response
After receiving and interpreting a request message, the recipient
responds with a SIP response message. The response message format is
shown below:
Response = Status-Line ; Section 5.1
*( general-header
| response-header
| entity-header )
CRLF
[ message-body ] ; Section 8
SIP's structure of responses is similar to [H6], but is defined
explicitly here.
5.1 Status-Line
The first line of a Response message is the Status-Line, consisting
of the protocol version (Section 4.3.1) followed by a numeric
Status-Code and its associated textual phrase, with each element
separated by SP characters. No CR or LF is allowed except in the
final CRLF sequence.
Status-Line = SIP-version SP Status-Code SP Reason-Phrase CRLF
Handley, et al. Standards Track [Page 36]
RFC 2543 SIP: Session Initiation Protocol March 1999
5.1.1 Status Codes and Reason Phrases
The Status-Code is a 3-digit integer result code that indicates the
outcome of the attempt to understand and satisfy the request. The
Reason-Phrase is intended to give a short textual description of the
Status-Code. The Status-Code is intended for use by automata, whereas
the Reason-Phrase is intended for the human user. The client is not
required to examine or display the Reason-Phrase.
Status-Code = Informational ;Fig. 5
| Success ;Fig. 5
| Redirection ;Fig. 6
| Client-Error ;Fig. 7
| Server-Error ;Fig. 8
| Global-Failure ;Fig. 9
| extension-code
extension-code = 3DIGIT
Reason-Phrase = *<TEXT-UTF8, excluding CR, LF>
We provide an overview of the Status-Code below, and provide full
definitions in Section 7. The first digit of the Status-Code defines
the class of response. The last two digits do not have any
categorization role. SIP/2.0 allows 6 values for the first digit:
1xx: Informational -- request received, continuing to process the
request;
2xx: Success -- the action was successfully received, understood, and
accepted;
3xx: Redirection -- further action needs to be taken in order to
complete the request;
4xx: Client Error -- the request contains bad syntax or cannot be
fulfilled at this server;
5xx: Server Error -- the server failed to fulfill an apparently valid
request;
6xx: Global Failure -- the request cannot be fulfilled at any server.
Figures 5 through 9 present the individual values of the numeric
response codes, and an example set of corresponding reason phrases
for SIP/2.0. These reason phrases are only recommended; they may be
replaced by local equivalents without affecting the protocol. Note
Handley, et al. Standards Track [Page 37]
RFC 2543 SIP: Session Initiation Protocol March 1999
that SIP adopts many HTTP/1.1 response codes. SIP/2.0 adds response
codes in the range starting at x80 to avoid conflicts with newly
defined HTTP response codes, and adds a new class, 6xx, of response
codes.
SIP response codes are extensible. SIP applications are not required
to understand the meaning of all registered response codes, though
such understanding is obviously desirable. However, applications MUST
understand the class of any response code, as indicated by the first
digit, and treat any unrecognized response as being equivalent to the
x00 response code of that class, with the exception that an
unrecognized response MUST NOT be cached. For example, if a client
receives an unrecognized response code of 431, it can safely assume
that there was something wrong with its request and treat the
response as if it had received a 400 (Bad Request) response code. In
such cases, user agents SHOULD present to the user the message body
returned with the response, since that message body is likely to
include human-readable information which will explain the unusual
status.
Informational = "100" ; Trying
| "180" ; Ringing
| "181" ; Call Is Being Forwarded
| "182" ; Queued
Success = "200" ; OK
Figure 5: Informational and success status codes
Redirection = "300" ; Multiple Choices
| "301" ; Moved Permanently
| "302" ; Moved Temporarily
| "303" ; See Other
| "305" ; Use Proxy
| "380" ; Alternative Service
Figure 6: Redirection status codes
Handley, et al. Standards Track [Page 38]
RFC 2543 SIP: Session Initiation Protocol March 1999
Client-Error = "400" ; Bad Request
| "401" ; Unauthorized
| "402" ; Payment Required
| "403" ; Forbidden
| "404" ; Not Found
| "405" ; Method Not Allowed
| "406" ; Not Acceptable
| "407" ; Proxy Authentication Required
| "408" ; Request Timeout
| "409" ; Conflict
| "410" ; Gone
| "411" ; Length Required
| "413" ; Request Entity Too Large
| "414" ; Request-URI Too Large
| "415" ; Unsupported Media Type
| "420" ; Bad Extension
| "480" ; Temporarily not available
| "481" ; Call Leg/Transaction Does Not Exist
| "482" ; Loop Detected
| "483" ; Too Many Hops
| "484" ; Address Incomplete
| "485" ; Ambiguous
| "486" ; Busy Here
Figure 7: Client error status codes
Server-Error = "500" ; Internal Server Error
| "501" ; Not Implemented
| "502" ; Bad Gateway
| "503" ; Service Unavailable
| "504" ; Gateway Time-out
| "505" ; SIP Version not supported
Figure 8: Server error status codes
6 Header Field Definitions
SIP header fields are similar to HTTP header fields in both syntax
and semantics. In particular, SIP header fields follow the syntax for
message-header as described in [H4.2]. The rules for extending header
fields over multiple lines, and use of multiple message-header fields
with the same field-name, described in [H4.2] also apply to SIP. The
Handley, et al. Standards Track [Page 39]
RFC 2543 SIP: Session Initiation Protocol March 1999
Global-Failure | "600" ; Busy Everywhere
| "603" ; Decline
| "604" ; Does not exist anywhere
| "606" ; Not Acceptable
Figure 9: Global failure status codes
rules in [H4.2] regarding ordering of header fields apply to SIP,
with the exception of Via fields, see below, whose order matters.
Additionally, header fields which are hop-by-hop MUST appear before
any header fields which are end-to-end. Proxies SHOULD NOT reorder
header fields. Proxies add Via header fields and MAY add other hop-
by-hop header fields. They can modify certain header fields, such as
Max-Forwards (Section 6.23) and "fix up" the Via header fields with
"received" parameters as described in Section 6.40.1. Proxies MUST
NOT alter any fields that are authenticated (see Section 13.2).
The header fields required, optional and not applicable for each
method are listed in Table 4 and Table 5. The table uses "o" to
indicate optional, "m" mandatory and "-" for not applicable. A "*"
indicates that the header fields are needed only if message body is
not empty. See sections 6.15, 6.16 and 8 for details.
The "where" column describes the request and response types with
which the header field can be used. "R" refers to header fields that
can be used in requests (that is, request and general header fields).
"r" designates a response or general-header field as applicable to
all responses, while a list of numeric values indicates the status
codes with which the header field can be used. "g" and "e" designate
general (Section 6.1) and entity header (Section 6.2) fields,
respectively. If a header field is marked "c", it is copied from the
request to the response.
The "enc." column describes whether this message header field MAY be
encrypted end-to-end. A "n" designates fields that MUST NOT be
encrypted, while "c" designates fields that SHOULD be encrypted if
encryption is used.
The "e-e" column has a value of "e" for end-to-end and a value of "h"
for hop-by-hop header fields.
Handley, et al. Standards Track [Page 40]
RFC 2543 SIP: Session Initiation Protocol March 1999
where enc. e-e ACK BYE CAN INV OPT REG
__________________________________________________________
Accept R e - - - o o o
Accept 415 e - - - o o o
Accept-Encoding R e - - - o o o
Accept-Encoding 415 e - - - o o o
Accept-Language R e - o o o o o
Accept-Language 415 e - o o o o o
Allow 200 e - - - - m -
Allow 405 e o o o o o o
Authorization R e o o o o o o
Call-ID gc n e m m m m m m
Contact R e o - - o o o
Contact 1xx e - - - o o -
Contact 2xx e - - - o o o
Contact 3xx e - o - o o o
Contact 485 e - o - o o o
Content-Encoding e e o - - o o o
Content-Length e e o - - o o o
Content-Type e e * - - * * *
CSeq gc n e m m m m m m
Date g e o o o o o o
Encryption g n e o o o o o o
Expires g e - - - o - o
From gc n e m m m m m m
Hide R n h o o o o o o
Max-Forwards R n e o o o o o o
Organization g c h - - - o o o
Table 4: Summary of header fields, A--O
Other header fields can be added as required; a server MUST ignore
header fields not defined in this specification that it does not
understand. A proxy MUST NOT remove or modify header fields not
defined in this specification that it does not understand. A compact
form of these header fields is also defined in Section 9 for use over
UDP when the request has to fit into a single packet and size is an
issue.
Table 6 in Appendix A lists those header fields that different client
and server types MUST be able to parse.
6.1 General Header Fields
General header fields apply to both request and response messages.
The "general-header" field names can be extended reliably only in
combination with a change in the protocol version. However, new or
Handley, et al. Standards Track [Page 41]
RFC 2543 SIP: Session Initiation Protocol March 1999
where enc. e-e ACK BYE CAN INV OPT REG
___________________________________________________________________
Proxy-Authenticate 407 n h o o o o o o
Proxy-Authorization R n h o o o o o o
Proxy-Require R n h o o o o o o
Priority R c e - - - o - -
Require R e o o o o o o
Retry-After R c e - - - - - o
Retry-After 404,480,486 c e o o o o o o
503 c e o o o o o o
600,603 c e o o o o o o
Response-Key R c e - o o o o o
Record-Route R h o o o o o o
Record-Route 2xx h o o o o o o
Route R h o o o o o o
Server r c e o o o o o o
Subject R c e - - - o - -
Timestamp g e o o o o o o
To gc(1) n e m m m m m m
Unsupported 420 e o o o o o o
User-Agent g c e o o o o o o
Via gc(2) n e m m m m m m
Warning r e o o o o o o
WWW-Authenticate 401 c e o o o o o o
Table 5: Summary of header fields, P--Z; (1): copied with possible
addition of tag; (2): UAS removes first Via header field
experimental header fields MAY be given the semantics of general
header fields if all parties in the communication recognize them to
be "general-header" fields. Unrecognized header fields are treated as
"entity-header" fields.
6.2 Entity Header Fields
The "entity-header" fields define meta-information about the
message-body or, if no body is present, about the resource identified
by the request. The term "entity header" is an HTTP 1.1 term where
the response body can contain a transformed version of the message
body. The original message body is referred to as the "entity". We
retain the same terminology for header fields but usually refer to
the "message body" rather then the entity as the two are the same in
SIP.
Handley, et al. Standards Track [Page 42]
RFC 2543 SIP: Session Initiation Protocol March 1999
6.3 Request Header Fields
The "request-header" fields allow the client to pass additional
information about the request, and about the client itself, to the
server. These fields act as request modifiers, with semantics
equivalent to the parameters of a programming language method
invocation.
The "request-header" field names can be extended reliably only in
combination with a change in the protocol version. However, new or
experimental header fields MAY be given the semantics of "request-
header" fields if all parties in the communication recognize them to
be request-header fields. Unrecognized header fields are treated as
"entity-header" fields.
6.4 Response Header Fields
The "response-header" fields allow the server to pass additional
information about the response which cannot be placed in the Status-
Line. These header fields give information about the server and about
further access to the resource identified by the Request-URI.
Response-header field names can be extended reliably only in
combination with a change in the protocol version. However, new or
experimental header fields MAY be given the semantics of "response-
header" fields if all parties in the communication recognize them to
be "response-header" fields. Unrecognized header fields are treated
as "entity-header" fields.
6.5 End-to-end and Hop-by-hop Headers
End-to-end headers MUST be transmitted unmodified across all proxies,
while hop-by-hop headers MAY be modified or added by proxies.
6.6 Header Field Format
Header fields ("general-header", "request-header", "response-header",
and "entity-header") follow the same generic header format as that
given in Section 3.1 of RFC 822 [24]. Each header field consists of a
name followed by a colon (":") and the field value. Field names are
case-insensitive. The field value MAY be preceded by any amount of
leading white space (LWS), though a single space (SP) is preferred.
Header fields can be extended over multiple lines by preceding each
extra line with at least one SP or horizontal tab (HT). Applications
MUST follow HTTP "common form" when generating these constructs,
since there might exist some implementations that fail to accept
anything beyond the common forms.
Handley, et al. Standards Track [Page 43]
RFC 2543 SIP: Session Initiation Protocol March 1999
message-header = field-name ":" [ field-value ] CRLF
field-name = token
field-value = *( field-content | LWS )
field-content = < the OCTETs making up the field-value
and consisting of either *TEXT-UTF8
or combinations of token,
separators, and quoted-string>
The relative order of header fields with different field names is not
significant. Multiple header fields with the same field-name may be
present in a message if and only if the entire field-value for that
header field is defined as a comma-separated list (i.e., #(values)).
It MUST be possible to combine the multiple header fields into one
"field-name: field-value" pair, without changing the semantics of the
message, by appending each subsequent field-value to the first, each
separated by a comma. The order in which header fields with the same
field-name are received is therefore significant to the
interpretation of the combined field value, and thus a proxy MUST NOT
change the order of these field values when a message is forwarded.
Field names are not case-sensitive, although their values may be.
6.7 Accept
The Accept header follows the syntax defined in [H14.1]. The
semantics are also identical, with the exception that if no Accept
header is present, the server SHOULD assume a default value of
application/sdp.
This request-header field is used only with the INVITE, OPTIONS and
REGISTER request methods to indicate what media types are acceptable
in the response.
Example:
Accept: application/sdp;level=1, application/x-private, text/html
6.8 Accept-Encoding
The Accept-Encoding request-header field is similar to Accept, but
restricts the content-codings [H3.4.1] that are acceptable in the
response. See [H14.3]. The syntax of this header is defined in
[H14.3]. The semantics in SIP are identical to those defined in
[H14.3].
Handley, et al. Standards Track [Page 44]
RFC 2543 SIP: Session Initiation Protocol March 1999
6.9 Accept-Language
The Accept-Language header follows the syntax defined in [H14.4]. The
rules for ordering the languages based on the q parameter apply to
SIP as well. When used in SIP, the Accept-Language request-header
field can be used to allow the client to indicate to the server in
which language it would prefer to receive reason phrases, session
descriptions or status responses carried as message bodies. A proxy
MAY use this field to help select the destination for the call, for
example, a human operator conversant in a language spoken by the
caller.
Example:
Accept-Language: da, en-gb;q=0.8, en;q=0.7
6.10 Allow
The Allow entity-header field lists the set of methods supported by
the resource identified by the Request-URI. The purpose of this field
is strictly to inform the recipient of valid methods associated with
the resource. An Allow header field MUST be present in a 405 (Method
Not Allowed) response and SHOULD be present in an OPTIONS response.
Allow = "Allow" ":" 1#Method
6.11 Authorization
A user agent that wishes to authenticate itself with a server --
usually, but not necessarily, after receiving a 401 response -- MAY
do so by including an Authorization request-header field with the
request. The Authorization field value consists of credentials
containing the authentication information of the user agent for the
realm of the resource being requested.
Section 13.2 overviews the use of the Authorization header, and
section 15 describes the syntax and semantics when used with PGP
based authentication.
Handley, et al. Standards Track [Page 45]
RFC 2543 SIP: Session Initiation Protocol March 1999
6.12 Call-ID
The Call-ID general-header field uniquely identifies a particular
invitation or all registrations of a particular client. Note that a
single multimedia conference can give rise to several calls with
different Call-IDs, e.g., if a user invites a single individual
several times to the same (long-running) conference.
For an INVITE request, a callee user agent server SHOULD NOT alert
the user if the user has responded previously to the Call-ID in the
INVITE request. If the user is already a member of the conference and
the conference parameters contained in the session description have
not changed, a callee user agent server MAY silently accept the call,
regardless of the Call-ID. An invitation for an existing Call-ID or
session can change the parameters of the conference. A client
application MAY decide to simply indicate to the user that the
conference parameters have been changed and accept the invitation
automatically or it MAY require user confirmation.
A user may be invited to the same conference or call using several
different Call-IDs. If desired, the client MAY use identifiers within
the session description to detect this duplication. For example, SDP
contains a session id and version number in the origin (o) field.
The REGISTER and OPTIONS methods use the Call-ID value to
unambiguously match requests and responses. All REGISTER requests
issued by a single client SHOULD use the same Call-ID, at least
within the same boot cycle.
Since the Call-ID is generated by and for SIP, there is no
reason to deal with the complexity of URL-encoding and
case-ignoring string comparison.
Call-ID = ( "Call-ID" | "i" ) ":" local-id "@" host
local-id = 1*uric
"host" SHOULD be either a fully qualified domain name or a globally
routable IP address. If this is the case, the "local-id" SHOULD be an
identifier consisting of URI characters that is unique within "host".
Use of cryptographically random identifiers [27] is RECOMMENDED. If,
however, host is not an FQDN or globally routable IP address (such as
a net 10 address), the local-id MUST be globally unique, as opposed
Handley, et al. Standards Track [Page 46]
RFC 2543 SIP: Session Initiation Protocol March 1999
to unique within host. These rules guarantee overall global
uniqueness of the Call-ID. The value for Call-ID MUST NOT be reused
for a different call. Call-IDs are case-sensitive.
Using cryptographically random identifiers provides some
protection against session hijacking. Call-ID, To and From
are needed to identify a call leg. The distinction between
call and call leg matters in calls with third-party
control.
For systems which have tight bandwidth constraints, many of the
mandatory SIP headers have a compact form, as discussed in Section 9.
These are alternate names for the headers which occupy less space in
the message. In the case of Call-ID, the compact form is i.
For example, both of the following are valid:
Call-ID: f81d4fae-7dec-11d0-a765-00a0c91e6bf6@foo.bar.com
or
i:f81d4fae-7dec-11d0-a765-00a0c91e6bf6@foo.bar.com
6.13 Contact
The Contact general-header field can appear in INVITE, ACK, and
REGISTER requests, and in 1xx, 2xx, 3xx, and 485 responses. In
general, it provides a URL where the user can be reached for further
communications.
INVITE and ACK requests: INVITE and ACK requests MAY contain Contact
headers indicating from which location the request is
originating.
This allows the callee to send future requests, such as
BYE, directly to the caller instead of through a series of
proxies. The Via header is not sufficient since the
desired address may be that of a proxy.
INVITE 2xx responses: A user agent server sending a definitive,
positive response (2xx) MAY insert a Contact response header
field indicating the SIP address under which it is reachable
most directly for future SIP requests, such as ACK, within the
Handley, et al. Standards Track [Page 47]
RFC 2543 SIP: Session Initiation Protocol March 1999
same Call-ID. The Contact header field contains the address of
the server itself or that of a proxy, e.g., if the host is
behind a firewall. The value of this Contact header is copied
into the Request-URI of subsequent requests for this call if the
response did not also contain a Record-Route header. If the
response also contains a Record-Route header field, the address
in the Contact header field is added as the last item in the
Route header field. See Section 6.29 for details.
The Contact value SHOULD NOT be cached across calls, as it
may not represent the most desirable location for a
particular destination address.
INVITE 1xx responses: A UAS sending a provisional response (1xx) MAY
insert a Contact response header. It has the same semantics in a
1xx response as a 2xx INVITE response. Note that CANCEL requests
MUST NOT be sent to that address, but rather follow the same
path as the original request.
REGISTER requests: REGISTER requests MAY contain a Contact header
field indicating at which locations the user is reachable. The
REGISTER request defines a wildcard Contact field, "*", which
MUST only be used with Expires: 0 to remove all registrations
for a particular user. An optional "expires" parameter indicates
the desired expiration time of the registration. If a Contact
entry does not have an "expires" parameter, the Expires header
field is used as the default value. If neither of these
mechanisms is used, SIP URIs are assumed to expire after one
hour. Other URI schemes have no expiration times.
REGISTER 2xx responses: A REGISTER response MAY return all locations
at which the user is currently reachable. An optional "expires"
parameter indicates the expiration time of the registration. If
a Contact entry does not have an "expires" parameter, the value
of the Expires header field indicates the expiration time. If
neither mechanism is used, the expiration time specified in the
request, explicitly or by default, is used.
3xx and 485 responses: The Contact response-header field can be used
with a 3xx or 485 (Ambiguous) response codes to indicate one or
more alternate addresses to try. It can appear in responses to
BYE, INVITE and OPTIONS methods. The Contact header field
contains URIs giving the new locations or user names to try, or
may simply specify additional transport parameters. A 300
(Multiple Choices), 301 (Moved Permanently), 302 (Moved
Temporarily) or 485 (Ambiguous) response SHOULD contain a
Contact field containing URIs of new addresses to be tried. A
Handley, et al. Standards Track [Page 48]
RFC 2543 SIP: Session Initiation Protocol March 1999
301 or 302 response may also give the same location and username
that was being tried but specify additional transport parameters
such as a different server or multicast address to try or a
change of SIP transport from UDP to TCP or vice versa. The
client copies the "user", "password", "host", "port" and "user-
param" elements of the Contact URI into the Request-URI of the
redirected request and directs the request to the address
specified by the "maddr" and "port" parameters, using the
transport protocol given in the "transport" parameter. If
"maddr" is a multicast address, the value of "ttl" is used as
the time-to-live value.
Note that the Contact header field MAY also refer to a different
entity than the one originally called. For example, a SIP call
connected to GSTN gateway may need to deliver a special information
announcement such as "The number you have dialed has been changed."
A Contact response header field can contain any suitable URI
indicating where the called party can be reached, not limited to SIP
URLs. For example, it could contain URL's for phones, fax, or irc (if
they were defined) or a mailto: (RFC 2368, [28]) URL.
The following parameters are defined. Additional parameters may be
defined in other specifications.
q: The "qvalue" indicates the relative preference among the locations
given. "qvalue" values are decimal numbers from 0 to 1, with
higher values indicating higher preference.
action: The "action" parameter is used only when registering with the
REGISTER request. It indicates whether the client wishes that
the server proxy or redirect future requests intended for the
client. If this parameter is not specified the action taken
depends on server configuration. In its response, the registrar
SHOULD indicate the mode used. This parameter is ignored for
other requests.
expires: The "expires" parameter indicates how long the URI is valid.
The parameter is either a number indicating seconds or a quoted
string containing a SIP-date. If this parameter is not provided,
the value of the Expires header field determines how long the
URI is valid. Implementations MAY treat values larger than
2**32-1 (4294967295 seconds or 136 years) as equivalent to
2**32-1.
Contact = ( "Contact" | "m" ) ":"
("*" | (1# (( name-addr | addr-spec )
[ *( ";" contact-params ) ] [ comment ] )))
name-addr = [ display-name ] "<" addr-spec ">"
addr-spec = SIP-URL | URI
display-name = *token | quoted-string
contact-params = "q" "=" qvalue
| "action" "=" "proxy" | "redirect"
| "expires" "=" delta-seconds | <"> SIP-date <">
| extension-attribute
extension-attribute = extension-name [ "=" extension-value ]
only allows one address, unquoted. Since URIs can contain
commas and semicolons as reserved characters, they can be
mistaken for header or parameter delimiters, respectively.
The current syntax corresponds to that for the To and From
header, which also allows the use of display names.
Example:
Contact: "Mr. Watson" <sip:watson@worcester.bell-telephone.com>
;q=0.7; expires=3600,
"Mr. Watson" <mailto:watson@bell-telephone.com> ;q=0.1
6.14 Content-Encoding
Content-Encoding = ( "Content-Encoding" | "e" ) ":"
1#content-coding
The Content-Encoding entity-header field is used as a modifier to the
"media-type". When present, its value indicates what additional
content codings have been applied to the entity-body, and thus what
decoding mechanisms MUST be applied in order to obtain the media-type
referenced by the Content-Type header field. Content-Encoding is
primarily used to allow a body to be compressed without losing the
identity of its underlying media type.
If multiple encodings have been applied to an entity, the content
codings MUST be listed in the order in which they were applied.
All content-coding values are case-insensitive. The Internet Assigned
Numbers Authority (IANA) acts as a registry for content-coding value
tokens. See [3.5] for a definition of the syntax for content-coding.
Clients MAY apply content encodings to the body in requests. If the
server is not capable of decoding the body, or does not recognize any
of the content-coding values, it MUST send a 415 "Unsupported Media
Type" response, listing acceptable encodings in the Accept-Encoding
Handley, et al. Standards Track [Page 50]
RFC 2543 SIP: Session Initiation Protocol March 1999
header. A server MAY apply content encodings to the bodies in
responses. The server MUST only use encodings listed in the Accept-
Encoding header in the request.
6.15 Content-Length
The Content-Length entity-header field indicates the size of the
message-body, in decimal number of octets, sent to the recipient.
Content-Length = ( "Content-Length" | "l" ) ":" 1*DIGIT
An example is
Content-Length: 3495
Applications SHOULD use this field to indicate the size of the
message-body to be transferred, regardless of the media type of the
entity. Any Content-Length greater than or equal to zero is a valid
value. If no body is present in a message, then the Content-Length
header field MUST be set to zero. If a server receives a UDP request
without Content-Length, it MUST assume that the request encompasses
the remainder of the packet. If a server receives a UDP request with
a Content-Length, but the value is larger than the size of the body
sent in the request, the client SHOULD generate a 400 class response.
If there is additional data in the UDP packet after the last byte of
the body has been read, the server MUST treat the remaining data as a
separate message. This allows several messages to be placed in a
single UDP packet.
If a response does not contain a Content-Length, the client assumes
that it encompasses the remainder of the UDP packet or the data until
the TCP connection is closed, as applicable. Section 8 describes how
to determine the length of the message body.
6.16 Content-Type
The Content-Type entity-header field indicates the media type of the
message-body sent to the recipient. The "media-type" element is
defined in [H3.7].
Content-Type = ( "Content-Type" | "c" ) ":" media-type
Handley, et al. Standards Track [Page 51]
RFC 2543 SIP: Session Initiation Protocol March 1999
Examples of this header field are
Content-Type: application/sdp
Content-Type: text/html; charset=ISO-8859-4
6.17 CSeq
Clients MUST add the CSeq (command sequence) general-header field to
every request. A CSeq header field in a request contains the request
method and a single decimal sequence number chosen by the requesting
client, unique within a single value of Call-ID. The sequence number
MUST be expressible as a 32-bit unsigned integer. The initial value
of the sequence number is arbitrary, but MUST be less than 2**31.
Consecutive requests that differ in request method, headers or body,
but have the same Call-ID MUST contain strictly monotonically
increasing and contiguous sequence numbers; sequence numbers do not
wrap around. Retransmissions of the same request carry the same
sequence number, but an INVITE with a different message body or
different header fields (a "re-invitation") acquires a new, higher
sequence number. A server MUST echo the CSeq value from the request
in its response. If the Method value is missing in the received CSeq
header field, the server fills it in appropriately.
The ACK and CANCEL requests MUST contain the same CSeq value as the
INVITE request that it refers to, while a BYE request cancelling an
invitation MUST have a higher sequence number. A BYE request with a
CSeq that is not higher should cause a 400 response to be generated.
A user agent server MUST remember the highest sequence number for any
INVITE request with the same Call-ID value. The server MUST respond
to, and then discard, any INVITE request with a lower sequence
number.
All requests spawned in a parallel search have the same CSeq value as
the request triggering the parallel search.
CSeq = "CSeq" ":" 1*DIGIT Method
Strictly speaking, CSeq header fields are needed for any
SIP request that can be cancelled by a BYE or CANCEL
request or where a client can issue several requests for
the same Call-ID in close succession. Without a sequence
Handley, et al. Standards Track [Page 52]
RFC 2543 SIP: Session Initiation Protocol March 1999
number, the response to an INVITE could be mistaken for the
response to the cancellation (BYE or CANCEL). Also, if the
network duplicates packets or if an ACK is delayed until
the server has sent an additional response, the client
could interpret an old response as the response to a re-
invitation issued shortly thereafter. Using CSeq also makes
it easy for the server to distinguish different versions of
an invitation, without comparing the message body.
The Method value allows the client to distinguish the response to an
INVITE request from that of a CANCEL response. CANCEL requests can be
generated by proxies; if they were to increase the sequence number,
it might conflict with a later request issued by the user agent for
the same call.
With a length of 32 bits, a server could generate, within a single
call, one request a second for about 136 years before needing to wrap
around. The initial value of the sequence number is chosen so that
subsequent requests within the same call will not wrap around. A
non-zero initial value allows to use a time-based initial sequence
number, if the client desires. A client could, for example, choose
the 31 most significant bits of a 32-bit second clock as an initial
sequence number.
Forked requests MUST have the same CSeq as there would be ambiguity
otherwise between these forked requests and later BYE issued by the
client user agent.
Example:
CSeq: 4711 INVITE
6.18 Date
Date is a general-header field. Its syntax is:
SIP-date = rfc1123-date
See [H14.19] for a definition of rfc1123-date. Note that unlike
HTTP/1.1, SIP only supports the most recent RFC1123 [29] formatting
for dates.
Handley, et al. Standards Track [Page 53]
RFC 2543 SIP: Session Initiation Protocol March 1999
The Date header field reflects the time when the request or response
is first sent. Thus, retransmissions have the same Date header field
value as the original.
The Date header field can be used by simple end systems
without a battery-backed clock to acquire a notion of
current time.
6.19 Encryption
The Encryption general-header field specifies that the content has
been encrypted. Section 13 describes the overall SIP security
architecture and algorithms. This header field is intended for end-
to-end encryption of requests and responses. Requests are encrypted
based on the public key belonging to the entity named in the To
header field. Responses are encrypted based on the public key
conveyed in the Response-Key header field. Note that the public keys
themselves may not be used for the encryption. This depends on the
particular algorithms used.
For any encrypted message, at least the message body and possibly
other message header fields are encrypted. An application receiving a
request or response containing an Encryption header field decrypts
the body and then concatenates the plaintext to the request line and
headers of the original message. Message headers in the decrypted
part completely replace those with the same field name in the
plaintext part. (Note: If only the body of the message is to be
encrypted, the body has to be prefixed with CRLF to allow proper
concatenation.) Note that the request method and Request-URI cannot
be encrypted.
Encryption only provides privacy; the recipient has no
guarantee that the request or response came from the party
listed in the From message header, only that the sender
used the recipient's public key. However, proxies will not
be able to modify the request or response.
Encryption = "Encryption" ":" encryption-scheme 1*SP
#encryption-params
encryption-scheme = token
encryption-params = token "=" ( token | quoted-string )
The token indicates the form of encryption used; it is
described in section 13.
Handley, et al. Standards Track [Page 54]
RFC 2543 SIP: Session Initiation Protocol March 1999
The example in Figure 10 shows a message encrypted with ASCII-armored
PGP that was generated by applying "pgp -ea" to the payload to be
encrypted.
INVITE sip:watson@boston.bell-telephone.com SIP/2.0
Via: SIP/2.0/UDP 169.130.12.5
From: <sip:a.g.bell@bell-telephone.com>
To: T. A. Watson <sip:watson@bell-telephone.com>
Call-ID: 187602141351@worcester.bell-telephone.com
Content-Length: 885
Encryption: PGP version=2.6.2,encoding=ascii
hQEMAxkp5GPd+j5xAQf/ZDIfGD/PDOM1wayvwdQAKgGgjmZWe+MTy9NEX8O25Red
h0/pyrd/+DV5C2BYs7yzSOSXaj1C/tTK/4do6rtjhP8QA3vbDdVdaFciwEVAcuXs
ODxlNAVqyDi1RqFC28BJIvQ5KfEkPuACKTK7WlRSBc7vNPEA3nyqZGBTwhxRSbIR
RuFEsHSVojdCam4htcqxGnFwD9sksqs6LIyCFaiTAhWtwcCaN437G7mUYzy2KLcA
zPVGq1VQg83b99zPzIxRdlZ+K7+bAnu8Rtu+ohOCMLV3TPXbyp+err1YiThCZHIu
X9dOVj3CMjCP66RSHa/ea0wYTRRNYA/G+kdP8DSUcqYAAAE/hZPX6nFIqk7AVnf6
IpWHUPTelNUJpzUp5Ou+q/5P7ZAsn+cSAuF2YWtVjCf+SQmBR13p2EYYWHoxlA2/
GgKADYe4M3JSwOtqwU8zUJF3FIfk7vsxmSqtUQrRQaiIhqNyG7KxJt4YjWnEjF5E
WUIPhvyGFMJaeQXIyGRYZAYvKKklyAJcm29zLACxU5alX4M25lHQd9FR9Zmq6Jed
wbWvia6cAIfsvlZ9JGocmQYF7pcuz5pnczqP+/yvRqFJtDGD/v3s++G2R+ViVYJO
z/lxGUZaM4IWBCf+4DUjNanZM0oxAE28NjaIZ0rrldDQmO8V9FtPKdHxkqA5iJP+
6vGOFti1Ak4kmEz0vM/Nsv7kkubTFhRl05OiJIGr9S1UhenlZv9l6RuXsOY/EwH2
z8X9N4MhMyXEVuC9rt8/AUhmVQ==
=bOW+
Figure 10: PGP Encryption Example
Since proxies can base their forwarding decision on any combination
of SIP header fields, there is no guarantee that an encrypted request
"hiding" header fields will reach the same destination as an
otherwise identical un-encrypted request.
6.20 Expires
The Expires entity-header field gives the date and time after which
the message content expires.
This header field is currently defined only for the REGISTER and
INVITE methods. For REGISTER, it is a request and response-header
field. In a REGISTER request, the client indicates how long it wishes
the registration to be valid. In the response, the server indicates
Handley, et al. Standards Track [Page 55]
RFC 2543 SIP: Session Initiation Protocol March 1999
the earliest expiration time of all registrations. The server MAY
choose a shorter time interval than that requested by the client, but
SHOULD NOT choose a longer one.
For INVITE requests, it is a request and response-header field. In a
request, the caller can limit the validity of an invitation, for
example, if a client wants to limit the time duration of a search or
a conference invitation. A user interface MAY take this as a hint to
leave the invitation window on the screen even if the user is not
currently at the workstation. This also limits the duration of a
search. If the request expires before the search completes, the proxy
returns a 408 (Request Timeout) status. In a 302 (Moved Temporarily)
response, a server can advise the client of the maximal duration of
the redirection.
The value of this field can be either a SIP-date or an integer number
of seconds (in decimal), measured from the receipt of the request.
The latter approach is preferable for short durations, as it does not
depend on clients and servers sharing a synchronized clock.
Implementations MAY treat values larger than 2**32-1 (4294967295 or
136 years) as equivalent to 2**32-1.
Expires = "Expires" ":" ( SIP-date | delta-seconds )
Two examples of its use are
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Expires: 5
6.21 From
Requests and responses MUST contain a From general-header field,
indicating the initiator of the request. The From field MAY contain
the "tag" parameter. The server copies the From header field from the
request to the response. The optional "display-name" is meant to be
rendered by a human-user interface. A system SHOULD use the display
name "Anonymous" if the identity of the client is to remain hidden.
The SIP-URL MUST NOT contain the "transport-param", "maddr-param",
"ttl-param", or "headers" elements. A server that receives a SIP-URL
with these elements removes them before further processing.
Handley, et al. Standards Track [Page 56]
RFC 2543 SIP: Session Initiation Protocol March 1999
Even if the "display-name" is empty, the "name-addr" form MUST be
used if the "addr-spec" contains a comma, question mark, or
semicolon.
From = ( "From" | "f" ) ":" ( name-addr | addr-spec )
*( ";" addr-params )
addr-params = tag-param
tag-param = "tag=" UUID
UUID = 1*( hex | "-" )
Examples:
From: "A. G. Bell" <sip:agb@bell-telephone.com>
From: sip:+12125551212@server.phone2net.com
From: Anonymous <sip:c8oqz84zk7z@privacy.org>
The "tag" MAY appear in the From field of a request. It MUST be
present when it is possible that two instances of a user sharing a
SIP address can make call invitations with the same Call-ID.
The "tag" value MUST be globally unique and cryptographically random
with at least 32 bits of randomness. A single user maintains the same
tag throughout the call identified by the Call-ID.
Call-ID, To and From are needed to identify a call leg.
The distinction between call and call leg matters in calls
with multiple responses to a forked request. The format is
similar to the equivalent RFC 822 [24] header, but with a
URI instead of just an email address.
6.22 Hide
A client uses the Hide request header field to indicate that it wants
the path comprised of the Via header fields (Section 6.40) to be
hidden from subsequent proxies and user agents. It can take two
forms: Hide: route and Hide: hop. Hide header fields are typically
added by the client user agent, but MAY be added by any proxy along
the path.
Handley, et al. Standards Track [Page 57]
RFC 2543 SIP: Session Initiation Protocol March 1999
If a request contains the "Hide: route" header field, all following
proxies SHOULD hide their previous hop. If a request contains the
"Hide: hop" header field, only the next proxy SHOULD hide the
previous hop and then remove the Hide option unless it also wants to
remain anonymous.
A server hides the previous hop by encrypting the "host" and "port"
parts of the top-most Via header field with an algorithm of its
choice. Servers SHOULD add additional "salt" to the "host" and "port"
information prior to encryption to prevent malicious downstream
proxies from guessing earlier parts of the path based on seeing
identical encrypted Via headers. Hidden Via fields are marked with
the "hidden" Via option, as described in Section 6.40.
A server that is capable of hiding Via headers MUST attempt to
decrypt all Via headers marked as "hidden" to perform loop detection.
Servers that are not capable of hiding can ignore hidden Via fields
in their loop detection algorithm.
If hidden headers were not marked, a proxy would have to
decrypt all headers to detect loops, just in case one was
encrypted, as the Hide: Hop option may have been removed
along the way.
A host MUST NOT add such a "Hide: hop" header field unless it can
guarantee it will only send a request for this destination to the
same next hop. The reason for this is that it is possible that the
request will loop back through this same hop from a downstream proxy.
The loop will be detected by the next hop if the choice of next hop
is fixed, but could loop an arbitrary number of times otherwise.
A client requesting "Hide: route" can only rely on keeping the
request path private if it sends the request to a trusted proxy.
Hiding the route of a SIP request is of limited value if the request
results in data packets being exchanged directly between the calling
and called user agent.
The use of Hide header fields is discouraged unless path privacy is
truly needed; Hide fields impose extra processing costs and
restrictions for proxies and can cause requests to generate 482 (Loop
Detected) responses that could otherwise be avoided.
The encryption of Via header fields is described in more detail in
Section 13.
The Hide header field has the following syntax:
Handley, et al. Standards Track [Page 58]
RFC 2543 SIP: Session Initiation Protocol March 1999
Hide = "Hide" ":" ( "route" | "hop" )
6.23 Max-Forwards
The Max-Forwards request-header field may be used with any SIP method
to limit the number of proxies or gateways that can forward the
request to the next downstream server. This can also be useful when
the client is attempting to trace a request chain which appears to be
failing or looping in mid-chain.
Max-Forwards = "Max-Forwards" ":" 1*DIGIT
The Max-Forwards value is a decimal integer indicating the remaining
number of times this request message is allowed to be forwarded.
Each proxy or gateway recipient of a request containing a Max-
Forwards header field MUST check and update its value prior to
forwarding the request. If the received value is zero (0), the
recipient MUST NOT forward the request. Instead, for the OPTIONS and
REGISTER methods, it MUST respond as the final recipient. For all
other methods, the server returns 483 (Too many hops).
If the received Max-Forwards value is greater than zero, then the
forwarded message MUST contain an updated Max-Forwards field with a
value decremented by one (1).
Example:
Max-Forwards: 6
6.24 Organization
The Organization general-header field conveys the name of the
organization to which the entity issuing the request or response
belongs. It MAY also be inserted by proxies at the boundary of an
organization.
The field MAY be used by client software to filter calls.
Handley, et al. Standards Track [Page 59]
RFC 2543 SIP: Session Initiation Protocol March 1999
Organization = "Organization" ":" *TEXT-UTF8
6.25 Priority
The Priority request-header field indicates the urgency of the
request as perceived by the client.
Priority = "Priority" ":" priority-value
priority-value = "emergency" | "urgent" | "normal"
| "non-urgent"
It is RECOMMENDED that the value of "emergency" only be used when
life, limb or property are in imminent danger.
Examples:
Subject: A tornado is heading our way!
Priority: emergency
Subject: Weekend plans
Priority: non-urgent
These are the values of RFC 2076 [30], with the addition of
"emergency".
6.26 Proxy-Authenticate
The Proxy-Authenticate response-header field MUST be included as part
of a 407 (Proxy Authentication Required) response. The field value
consists of a challenge that indicates the authentication scheme and
parameters applicable to the proxy for this Request-URI.
Unlike its usage within HTTP, the Proxy-Authenticate header MUST be
passed upstream in the response to the UAC. In SIP, only UAC's can
authenticate themselves to proxies.
The syntax for this header is defined in [H14.33]. See 14 for further
details on its usage.
Handley, et al. Standards Track [Page 60]
RFC 2543 SIP: Session Initiation Protocol March 1999
A client SHOULD cache the credentials used for a particular proxy
server and realm for the next request to that server. Credentials
are, in general, valid for a specific value of the Request-URI at a
particular proxy server. If a client contacts a proxy server that has
required authentication in the past, but the client does not have
credentials for the particular Request-URI, it MAY attempt to use the
most-recently used credential. The server responds with 401
(Unauthorized) if the client guessed wrong.
This suggested caching behavior is motivated by proxies
restricting phone calls to authenticated users. It seems
likely that in most cases, all destinations require the
same password. Note that end-to-end authentication is
likely to be destination-specific.
6.27 Proxy-Authorization
The Proxy-Authorization request-header field allows the client to
identify itself (or its user) to a proxy which requires
authentication. The Proxy-Authorization field value consists of
credentials containing the authentication information of the user
agent for the proxy and/or realm of the resource being requested.
Unlike Authorization, the Proxy-Authorization header field applies
only to the next outbound proxy that demanded authentication using
the Proxy- Authenticate field. When multiple proxies are used in a
chain, the Proxy-Authorization header field is consumed by the first
outbound proxy that was expecting to receive credentials. A proxy MAY
relay the credentials from the client request to the next proxy if
that is the mechanism by which the proxies cooperatively authenticate
a given request.
See [H14.34] for a definition of the syntax, and section 14 for a
discussion of its usage.
6.28 Proxy-Require
The Proxy-Require header field is used to indicate proxy-sensitive
features that MUST be supported by the proxy. Any Proxy-Require
header field features that are not supported by the proxy MUST be
negatively acknowledged by the proxy to the client if not supported.
Proxy servers treat this field identically to the Require field.
See Section 6.30 for more details on the mechanics of this message
and a usage example.
Handley, et al. Standards Track [Page 61]
RFC 2543 SIP: Session Initiation Protocol March 1999
6.29 Record-Route
The Record-Route request and response header field is added to a
request by any proxy that insists on being in the path of subsequent
requests for the same call leg. It contains a globally reachable
Request-URI that identifies the proxy server. Each proxy server adds
its Request-URI to the beginning of the list.
The server copies the Record-Route header field unchanged into the
response. (Record-Route is only relevant for 2xx responses.)
The calling user agent client copies the Record-Route header into a
Route header field of subsequent requests within the same call leg,
reversing the order of requests, so that the first entry is closest
to the user agent client. If the response contained a Contact header
field, the calling user agent adds its content as the last Route
header. Unless this would cause a loop, any client MUST send any
subsequent requests for this call leg to the first Request-URI in the
Route request header field and remove that entry.
The calling user agent MUST NOT use the Record-Route header field in
requests that contain Route header fields.
Some proxies, such as those controlling firewalls or in an
automatic call distribution (ACD) system, need to maintain
call state and thus need to receive any BYE and ACK packets
for the call.
The Record-Route header field has the following syntax:
Record-Route = "Record-Route" ":" 1# name-addr
Proxy servers SHOULD use the "maddr" URL parameter containing their
address to ensure that subsequent requests are guaranteed to reach
exactly the same server.
Example for a request that has traversed the hosts ieee.org and
bell-telephone.com , in that order:
Record-Route: <sip:a.g.bell@bell-telephone.com>,
<sip:a.bell@ieee.org>
Handley, et al. Standards Track [Page 62]
RFC 2543 SIP: Session Initiation Protocol March 1999
6.30 Require
The Require request-header field is used by clients to tell user
agent servers about options that the client expects the server to
support in order to properly process the request. If a server does
not understand the option, it MUST respond by returning status code
420 (Bad Extension) and list those options it does not understand in
the Unsupported header.
Require = "Require" ":" 1#option-tag
Example:
C->S: INVITE sip:watson@bell-telephone.com SIP/2.0
Require: com.example.billing
Payment: sheep_skins, conch_shells
S->C: SIP/2.0 420 Bad Extension
Unsupported: com.example.billing
This is to make sure that the client-server interaction
will proceed without delay when all options are understood
by both sides, and only slow down if options are not
understood (as in the example above). For a well-matched
client-server pair, the interaction proceeds quickly,
saving a round-trip often required by negotiation
mechanisms. In addition, it also removes ambiguity when the
client requires features that the server does not
understand. Some features, such as call handling fields,
are only of interest to end systems.
Proxy and redirect servers MUST ignore features that are not
understood. If a particular extension requires that intermediate
devices support it, the extension MUST be tagged in the Proxy-Require
field as well (see Section 6.28).
6.31 Response-Key
The Response-Key request-header field can be used by a client to
request the key that the called user agent SHOULD use to encrypt the
response with. The syntax is:
Handley, et al. Standards Track [Page 63]
RFC 2543 SIP: Session Initiation Protocol March 1999
Response-Key = "Response-Key" ":" key-scheme 1*SP #key-param
key-scheme = token
key-param = token "=" ( token | quoted-string )
The "key-scheme" gives the type of encryption to be used for the
response. Section 13 describes security schemes.
If the client insists that the server return an encrypted response,
it includes a
Require: org.ietf.sip.encrypt-response
header field in its request. If the server cannot encrypt for
whatever reason, it MUST follow normal Require header field
procedures and return a 420 (Bad Extension) response. If this Require
header field is not present, a server SHOULD still encrypt if it can.
6.32 Retry-After
The Retry-After general-header field can be used with a 503 (Service
Unavailable) response to indicate how long the service is expected to
be unavailable to the requesting client and with a 404 (Not Found),
600 (Busy), or 603 (Decline) response to indicate when the called
party anticipates being available again. The value of this field can
be either an SIP-date or an integer number of seconds (in decimal)
after the time of the response.
A REGISTER request MAY include this header field when deleting
registrations with "Contact: * ;expires: 0". The Retry-After value
then indicates when the user might again be reachable. The registrar
MAY then include this information in responses to future calls.
An optional comment can be used to indicate additional information
about the time of callback. An optional "duration" parameter
indicates how long the called party will be reachable starting at the
initial time of availability. If no duration parameter is given, the
service is assumed to be available indefinitely.
Retry-After = "Retry-After" ":" ( SIP-date | delta-seconds )
[ comment ] [ ";" "duration" "=" delta-seconds ]
Examples of its use are
Retry-After: Mon, 21 Jul 1997 18:48:34 GMT (I'm in a meeting)
Handley, et al. Standards Track [Page 64]
RFC 2543 SIP: Session Initiation Protocol March 1999
Retry-After: Mon, 01 Jan 9999 00:00:00 GMT
(Dear John: Don't call me back, ever)
Retry-After: Fri, 26 Sep 1997 21:00:00 GMT;duration=3600
Retry-After: 120
In the third example, the callee is reachable for one hour starting
at 21:00 GMT. In the last example, the delay is 2 minutes.
6.33 Route
The Route request-header field determines the route taken by a
request. Each host removes the first entry and then proxies the
request to the host listed in that entry, also using it as the
Request-URI. The operation is further described in Section 6.29.
The Route header field has the following syntax:
Route = "Route" ":" 1# name-addr
6.34 Server
The Server response-header field contains information about the
software used by the user agent server to handle the request. The
syntax for this field is defined in [H14.39].
6.35 Subject
This is intended to provide a summary, or to indicate the nature, of
the call, allowing call filtering without having to parse the session
description. (Also, the session description does not have to use the
same subject indication as the invitation.)
Subject = ( "Subject" | "s" ) ":" *TEXT-UTF8
Example:
Subject: Tune in - they are talking about your work!
Handley, et al. Standards Track [Page 65]
RFC 2543 SIP: Session Initiation Protocol March 1999
6.36 Timestamp
The timestamp general-header field describes when the client sent the
request to the server. The value of the timestamp is of significance
only to the client and it MAY use any timescale. The server MUST echo
the exact same value and MAY, if it has accurate information about
this, add a floating point number indicating the number of seconds
that have elapsed since it has received the request. The timestamp is
used by the client to compute the round-trip time to the server so
that it can adjust the timeout value for retransmissions.
Timestamp = "Timestamp" ":" *(DIGIT) [ "." *(DIGIT) ] [ delay ]
delay = *(DIGIT) [ "." *(DIGIT) ]
Note that there MUST NOT be any LWS between a DIGIT and the decimal
point.
6.37 To
The To general-header field specifies recipient of the request, with
the same SIP URL syntax as the From field.
To = ( "To" | "t" ) ":" ( name-addr | addr-spec )
*( ";" addr-params )
Requests and responses MUST contain a To general-header field,
indicating the desired recipient of the request. The optional
"display-name" is meant to be rendered by a human-user interface.
The UAS or redirect server copies the To header field into its
response, and MUST add a "tag" parameter if the request contained
more than one Via header field.
If there was more than one Via header field, the request
was handled by at least one proxy server. Since the
receiver cannot know whether any of the proxy servers
forked the request, it is safest to assume that they might
have.
The SIP-URL MUST NOT contain the "transport-param", "maddr-param",
"ttl-param", or "headers" elements. A server that receives a SIP-URL
with these elements removes them before further processing.
Handley, et al. Standards Track [Page 66]
RFC 2543 SIP: Session Initiation Protocol March 1999
The "tag" parameter serves as a general mechanism to distinguish
multiple instances of a user identified by a single SIP URL. As
proxies can fork requests, the same request can reach multiple
instances of a user (mobile and home phones, for example). As each
can respond, there needs to be a means to distinguish the responses
from each at the caller. The situation also arises with multicast
requests. The tag in the To header field serves to distinguish
responses at the UAC. It MUST be placed in the To field of the
response by each instance when there is a possibility that the
request was forked at an intermediate proxy. The "tag" MUST be added
by UAS, registrars and redirect servers, but MUST NOT be inserted
into responses forwarded upstream by proxies. The "tag" is added for
all definitive responses for all methods, and MAY be added for
informational responses from a UAS or redirect server. All subsequent
transactions between two entities MUST include the "tag" parameter,
as described in Section 11.
See Section 6.21 for details of the "tag" parameter.
The "tag" parameter in To headers is ignored when matching responses
to requests that did not contain a "tag" in their To header.
A SIP server returns a 400 (Bad Request) response if it receives a
request with a To header field containing a URI with a scheme it does
not recognize.
Even if the "display-name" is empty, the "name-addr" form MUST be
used if the "addr-spec" contains a comma, question mark, or
semicolon.
The following are examples of valid To headers:
To: The Operator <sip:operator@cs.columbia.edu>;tag=287447
To: sip:+12125551212@server.phone2net.com
Call-ID, To and From are needed to identify a call leg.
The distinction between call and call leg matters in calls
with multiple responses from a forked request. The "tag" is
added to the To header field in the response to allow
forking of future requests for the same call by proxies,
while addressing only one of the possibly several
responding user agent servers. It also allows several
instances of the callee to send requests that can be
distinguished.
Handley, et al. Standards Track [Page 67]
RFC 2543 SIP: Session Initiation Protocol March 1999
6.38 Unsupported
The Unsupported response-header field lists the features not
supported by the server. See Section 6.30 for a usage example and
motivation.
Syntax:
Unsupported = "Unsupported" ":" 1#option-tag
6.39 User-Agent
The User-Agent general-header field contains information about the
client user agent originating the request. The syntax and semantics
are defined in [H14.42].
6.40 Via
The Via field indicates the path taken by the request so far. This
prevents request looping and ensures replies take the same path as
the requests, which assists in firewall traversal and other unusual
routing situations.
6.40.1 Requests
The client originating the request MUST insert into the request a Via
field containing its host name or network address and, if not the
default port number, the port number at which it wishes to receive
responses. (Note that this port number can differ from the UDP source
port number of the request.) A fully-qualified domain name is
RECOMMENDED. Each subsequent proxy server that sends the request
onwards MUST add its own additional Via field before any existing Via
fields. A proxy that receives a redirection (3xx) response and then
searches recursively, MUST use the same Via headers as on the
original proxied request.
A proxy SHOULD check the top-most Via header field to ensure that it
contains the sender's correct network address, as seen from that
proxy. If the sender's address is incorrect, the proxy MUST add an
additional "received" attribute, as described 6.40.2.
A host behind a network address translator (NAT) or
firewall may not be able to insert a network address into
the Via header that can be reached by the next hop beyond
Handley, et al. Standards Track [Page 68]
RFC 2543 SIP: Session Initiation Protocol March 1999
the NAT. Use of the received attribute allows SIP requests
to traverse NAT's which only modify the source IP address.
NAT's which modify port numbers, called Network Address
Port Translator's (NAPT) will not properly pass SIP when
transported on UDP, in which case an application layer
gateway is required. When run over TCP, SIP stands a better
chance of traversing NAT's, since its behavior is similar
to HTTP in this case (but of course on different ports).
A proxy sending a request to a multicast address MUST add the "maddr"
parameter to its Via header field, and SHOULD add the "ttl"
parameter. If a server receives a request which contained an "maddr"
parameter in the topmost Via field, it SHOULD send the response to
the multicast address listed in the "maddr" parameter.
If a proxy server receives a request which contains its own address
in the Via header value, it MUST respond with a 482 (Loop Detected)
status code.
A proxy server MUST NOT forward a request to a multicast group which
already appears in any of the Via headers.
This prevents a malfunctioning proxy server from causing
loops. Also, it cannot be guaranteed that a proxy server
can always detect that the address returned by a location
service refers to a host listed in the Via list, as a
single host may have aliases or several network interfaces.
6.40.2 Receiver-tagged Via Header Fields
Normally, every host that sends or forwards a SIP message adds a Via
field indicating the path traversed. However, it is possible that
Network Address Translators (NATs) changes the source address and
port of the request (e.g., from net-10 to a globally routable
address), in which case the Via header field cannot be relied on to
route replies. To prevent this, a proxy SHOULD check the top-most Via
header field to ensure that it contains the sender's correct network
address, as seen from that proxy. If the sender's address is
incorrect, the proxy MUST add a "received" parameter to the Via
header field inserted by the previous hop. Such a modified Via header
field is known as a receiver-tagged Via header field. An example is:
Via: SIP/2.0/UDP erlang.bell-telephone.com:5060
Via: SIP/2.0/UDP 10.0.0.1:5060 ;received=199.172.136.3
Handley, et al. Standards Track [Page 69]
RFC 2543 SIP: Session Initiation Protocol March 1999
In this example, the message originated from 10.0.0.1 and traversed a
NAT with the external address border.ieee.org (199.172.136.3) to
reach erlang.bell-telephone.com. The latter noticed the mismatch,
and added a parameter to the previous hop's Via header field,
containing the address that the packet actually came from. (Note that
the NAT border.ieee.org is not a SIP server.)
6.40.3 Responses
Via header fields in responses are processed by a proxy or UAC
according to the following rules:
1. The first Via header field should indicate the proxy or
client processing this response. If it does not, discard
the message. Otherwise, remove this Via field.
2. If there is no second Via header field, this response is
destined for this client. Otherwise, the processing depends
on whether the Via field contains a "maddr" parameter or is
a receiver-tagged field:
- If the second Via header field contains a "maddr"
parameter, send the response to the multicast address
listed there, using the port indicated in "sent-by", or
port 5060 if none is present. The response SHOULD be sent
using the TTL indicated in the "ttl" parameter, or with a
TTL of 1 if that parameter is not present. For
robustness, responses MUST be sent to the address
indicated in the "maddr" parameter even if it is not a
multicast address.
- If the second Via header field does not contain a "maddr"
parameter and is a receiver-tagged field (Section
6.40.2), send the message to the address in the
"received" parameter, using the port indicated in the
"sent-by" value, or using port 5060 if none is present.
- If neither of the previous cases apply, send the message
to the address indicated by the "sent-by" value in the
second Via header field.
6.40.4 User Agent and Redirect Servers
A UAS or redirect server sends a response based on one of the
following rules:
o If the first Via header field in the request contains a
"maddr" parameter, send the response to the multicast address
Handley, et al. Standards Track [Page 70]
RFC 2543 SIP: Session Initiation Protocol March 1999
listed there, using the port indicated in "sent-by", or port
5060 if none is present. The response SHOULD be sent using the
TTL indicated in the "ttl" parameter, or with a TTL of 1 if
that parameter is not present. For robustness, responses MUST
be sent to the address indicated in the "maddr" parameter even
if it is not a multicast address.
o If the address in the "sent-by" value of the first Via field
differs from the source address of the packet, send the
response to the actual packet source address, similar to the
treatment for receiver-tagged Via header fields (Section
6.40.2).
o If neither of these conditions is true, send the response to
the address contained in the "sent-by" value. If the request
was sent using TCP, use the existing TCP connection if
available.
6.40.5 Syntax
The format for a Via header field is shown in Fig. 11. The defaults
for "protocol-name" and "transport" are "SIP" and "UDP",
respectively. The "maddr" parameter, designating the multicast
address, and the "ttl" parameter, designating the time-to-live (TTL)
value, are included only if the request was sent via multicast. The
"received" parameter is added only for receiver-added Via fields
(Section 6.40.2). For reasons of privacy, a client or proxy may wish
to hide its Via information by encrypting it (see Section 6.22). The
"hidden" parameter is included if this header field was hidden by the
upstream proxy (see 6.22). Note that privacy of the proxy relies on
the cooperation of the next hop, as the next-hop proxy will, by
necessity, know the IP address and port number of the source host.
The "branch" parameter is included by every forking proxy. The token
MUST be unique for each distinct request generated when a proxy
forks. CANCEL requests MUST have the same branch value as the
corresponding forked request. When a response arrives at the proxy it
can use the branch value to figure out which branch the response
corresponds to. A proxy which generates a single request (non-
forking) MAY also insert the "branch" parameter. The identifier has
to be unique only within a set of isomorphic requests.
Via: SIP/2.0/UDP first.example.com:4000;ttl=16
;maddr=224.2.0.1 ;branch=a7c6a8dlze (Example)
Via: SIP/2.0/UDP adk8
Handley, et al. Standards Track [Page 71]
RFC 2543 SIP: Session Initiation Protocol March 1999
Via = ( "Via" | "v") ":" 1#( sent-protocol sent-by
*( ";" via-params ) [ comment ] )
via-params = via-hidden | via-ttl | via-maddr
| via-received | via-branch
via-hidden = "hidden"
via-ttl = "ttl" "=" ttl
via-maddr = "maddr" "=" maddr
via-received = "received" "=" host
via-branch = "branch" "=" token
sent-protocol = protocol-name "/" protocol-version "/" transport
protocol-name = "SIP" | token
protocol-version = token
transport = "UDP" | "TCP" | token
sent-by = ( host [ ":" port ] ) | ( concealed-host )
concealed-host = token
ttl = 1*3DIGIT ; 0 to 255
Figure 11: Syntax of Via header field
6.41 Warning
The Warning response-header field is used to carry additional
information about the status of a response. Warning headers are sent
with responses and have the following format:
Warning = "Warning" ":" 1#warning-value
warning-value = warn-code SP warn-agent SP warn-text
warn-code = 3DIGIT
warn-agent = ( host [ ":" port ] ) | pseudonym
; the name or pseudonym of the server adding
; the Warning header, for use in debugging
warn-text = quoted-string
A response MAY carry more than one Warning header.
The "warn-text" should be in a natural language that is most likely
to be intelligible to the human user receiving the response. This
decision can be based on any available knowledge, such as the
location of the cache or user, the Accept-Language field in a
request, or the Content-Language field in a response. The default
language is i-default [31].
Handley, et al. Standards Track [Page 72]
RFC 2543 SIP: Session Initiation Protocol March 1999
Any server MAY add Warning headers to a response. Proxy servers MUST
place additional Warning headers before any Authorization headers.
Within that constraint, Warning headers MUST be added after any
existing Warning headers not covered by a signature. A proxy server
MUST NOT delete any Warning header field that it received with a
response.
When multiple Warning headers are attached to a response, the user
agent SHOULD display as many of them as possible, in the order that
they appear in the response. If it is not possible to display all of
the warnings, the user agent first displays warnings that appear
early in the response.
The warn-code consists of three digits. A first digit of "3"
indicates warnings specific to SIP.
This is a list of the currently-defined "warn-code"s, each with a
recommended warn-text in English, and a description of its meaning.
Note that these warnings describe failures induced by the session
description.
Warnings 300 through 329 are reserved for indicating problems with
keywords in the session description, 330 through 339 are warnings
related to basic network services requested in the session
description, 370 through 379 are warnings related to quantitative QoS
parameters requested in the session description, and 390 through 399
are miscellaneous warnings that do not fall into one of the above
categories.
300 Incompatible network protocol: One or more network protocols
contained in the session description are not available.
301 Incompatible network address formats: One or more network address
formats contained in the session description are not available.
302 Incompatible transport protocol: One or more transport protocols
described in the session description are not available.
303 Incompatible bandwidth units: One or more bandwidth measurement
units contained in the session description were not understood.
304 Media type not available: One or more media types contained in
the session description are not available.
305 Incompatible media format: One or more media formats contained in
the session description are not available.
Handley, et al. Standards Track [Page 73]
RFC 2543 SIP: Session Initiation Protocol March 1999
306 Attribute not understood: One or more of the media attributes in
the session description are not supported.
307 Session description parameter not understood: A parameter other
than those listed above was not understood.
330 Multicast not available: The site where the user is located does
not support multicast.
331 Unicast not available: The site where the user is located does
not support unicast communication (usually due to the presence
of a firewall).
370 Insufficient bandwidth: The bandwidth specified in the session
description or defined by the media exceeds that known to be
available.
399 Miscellaneous warning: The warning text can include arbitrary
information to be presented to a human user, or logged. A system
receiving this warning MUST NOT take any automated action.
1xx and 2xx have been taken by HTTP/1.1.
Additional "warn-code"s, as in the example below, can be defined
through IANA.
Examples:
Warning: 307 isi.edu "Session parameter 'foo' not understood"
Warning: 301 isi.edu "Incompatible network address type 'E.164'"
6.42 WWW-Authenticate
The WWW-Authenticate response-header field MUST be included in 401
(Unauthorized) response messages. The field value consists of at
least one challenge that indicates the authentication scheme(s) and
parameters applicable to the Request-URI. See [H14.46] for a
definition of the syntax, and section 14 for an overview of usage.
The content of the "realm" parameter SHOULD be displayed to the user.
A user agent SHOULD cache the authorization credentials for a given
value of the destination (To header) and "realm" and attempt to re-
use these values on the next request for that destination.
Handley, et al. Standards Track [Page 74]
RFC 2543 SIP: Session Initiation Protocol March 1999
In addition to the "basic" and "digest" authentication schemes
defined in the specifications cited above, SIP defines a new scheme,
PGP (RFC 2015, [32]), Section 15. Other schemes, such as S/MIME, are
for further study.
7 Status Code Definitions
The response codes are consistent with, and extend, HTTP/1.1 response
codes. Not all HTTP/1.1 response codes are appropriate, and only
those that are appropriate are given here. Other HTTP/1.1 response
codes SHOULD NOT be used. Response codes not defined by HTTP/1.1 have
codes x80 upwards to avoid clashes with future HTTP response codes.
Also, SIP defines a new class, 6xx. The default behavior for unknown
response codes is given for each category of codes.
7.1 Informational 1xx
Informational responses indicate that the server or proxy contacted
is performing some further action and does not yet have a definitive
response. The client SHOULD wait for a further response from the
server, and the server SHOULD send such a response without further
prompting. A server SHOULD send a 1xx response if it expects to take
more than 200 ms to obtain a final response. A server MAY issue zero
or more 1xx responses, with no restriction on their ordering or
uniqueness. Note that 1xx responses are not transmitted reliably,
that is, they do not cause the client to send an ACK. Servers are
free to retransmit informational responses and clients can inquire
about the current state of call processing by re-sending the request.
7.1.1 100 Trying
Some unspecified action is being taken on behalf of this call (e.g.,
a database is being consulted), but the user has not yet been
located.
7.1.2 180 Ringing
The called user agent has located a possible location where the user
has registered recently and is trying to alert the user.
7.1.3 181 Call Is Being Forwarded
A proxy server MAY use this status code to indicate that the call is
being forwarded to a different set of destinations.
Handley, et al. Standards Track [Page 75]
RFC 2543 SIP: Session Initiation Protocol March 1999
7.1.4 182 Queued
The called party is temporarily unavailable, but the callee has
decided to queue the call rather than reject it. When the callee
becomes available, it will return the appropriate final status
response. The reason phrase MAY give further details about the status
of the call, e.g., "5 calls queued; expected waiting time is 15
minutes". The server MAY issue several 182 responses to update the
caller about the status of the queued call.
7.2 Successful 2xx
The request was successful and MUST terminate a search.
7.2.1 200 OK
The request has succeeded. The information returned with the response
depends on the method used in the request, for example:
BYE: The call has been terminated. The message body is empty.
CANCEL: The search has been cancelled. The message body is empty.
INVITE: The callee has agreed to participate; the message body
indicates the callee's capabilities.
OPTIONS: The callee has agreed to share its capabilities, included in
the message body.
REGISTER: The registration has succeeded. The client treats the
message body according to its Content-Type.
7.3 Redirection 3xx
3xx responses give information about the user's new location, or
about alternative services that might be able to satisfy the call.
They SHOULD terminate an existing search, and MAY cause the initiator
to begin a new search if appropriate.
Any redirection (3xx) response MUST NOT suggest any of the addresses
in the Via (Section 6.40) path of the request in the Contact header
field. (Addresses match if their host and port number match.)
To avoid forwarding loops, a user agent client or proxy MUST check
whether the address returned by a redirect server equals an address
tried earlier.
Handley, et al. Standards Track [Page 76]
RFC 2543 SIP: Session Initiation Protocol March 1999
7.3.1 300 Multiple Choices
The address in the request resolved to several choices, each with its
own specific location, and the user (or user agent) can select a
preferred communication end point and redirect its request to that
location.
The response SHOULD include an entity containing a list of resource
characteristics and location(s) from which the user or user agent can
choose the one most appropriate, if allowed by the Accept request
header. The entity format is specified by the media type given in the
Content-Type header field. The choices SHOULD also be listed as
Contact fields (Section 6.13). Unlike HTTP, the SIP response MAY
contain several Contact fields or a list of addresses in a Contact
field. User agents MAY use the Contact header field value for
automatic redirection or MAY ask the user to confirm a choice.
However, this specification does not define any standard for such
automatic selection.
This status response is appropriate if the callee can be
reached at several different locations and the server
cannot or prefers not to proxy the request.
7.3.2 301 Moved Permanently
The user can no longer be found at the address in the Request-URI and
the requesting client SHOULD retry at the new address given by the
Contact header field (Section 6.13). The caller SHOULD update any
local directories, address books and user location caches with this
new value and redirect future requests to the address(es) listed.
7.3.3 302 Moved Temporarily
The requesting client SHOULD retry the request at the new address(es)
given by the Contact header field (Section 6.13). The duration of
the redirection can be indicated through an Expires (Section 6.20)
header. If there is no explicit expiration time, the address is only
valid for this call and MUST NOT be cached for future calls.
7.3.4 305 Use Proxy
The requested resource MUST be accessed through the proxy given by
the Contact field. The Contact field gives the URI of the proxy. The
recipient is expected to repeat this single request via the proxy.
305 responses MUST only be generated by user agent servers.
Handley, et al. Standards Track [Page 77]
RFC 2543 SIP: Session Initiation Protocol March 1999
7.3.5 380 Alternative Service
The call was not successful, but alternative services are possible.
The alternative services are described in the message body of the
response. Formats for such bodies are not defined here, and may be
the subject of future standardization.
7.4 Request Failure 4xx
4xx responses are definite failure responses from a particular
server. The client SHOULD NOT retry the same request without
modification (e.g., adding appropriate authorization). However, the
same request to a different server might be successful.
7.4.1 400 Bad Request
The request could not be understood due to malformed syntax.
7.4.2 401 Unauthorized
The request requires user authentication.
7.4.3 402 Payment Required
Reserved for future use.
7.4.4 403 Forbidden
The server understood the request, but is refusing to fulfill it.
Authorization will not help, and the request SHOULD NOT be repeated.
7.4.5 404 Not Found
The server has definitive information that the user does not exist at
the domain specified in the Request-URI. This status is also returned
if the domain in the Request-URI does not match any of the domains
handled by the recipient of the request.
7.4.6 405 Method Not Allowed
The method specified in the Request-Line is not allowed for the
address identified by the Request-URI. The response MUST include an
Allow header field containing a list of valid methods for the
indicated address.
Handley, et al. Standards Track [Page 78]
RFC 2543 SIP: Session Initiation Protocol March 1999
7.4.7 406 Not Acceptable
The resource identified by the request is only capable of generating
response entities which have content characteristics not acceptable
according to the accept headers sent in the request.
7.4.8 407 Proxy Authentication Required
This code is similar to 401 (Unauthorized), but indicates that the
client MUST first authenticate itself with the proxy. The proxy MUST
return a Proxy-Authenticate header field (section 6.26) containing a
challenge applicable to the proxy for the requested resource. The
client MAY repeat the request with a suitable Proxy-Authorization
header field (section 6.27). SIP access authentication is explained
in section 13.2 and 14.
This status code is used for applications where access to the
communication channel (e.g., a telephony gateway) rather than the
callee requires authentication.
7.4.9 408 Request Timeout
The server could not produce a response, e.g., a user location,
within the time indicated in the Expires request-header field. The
client MAY repeat the request without modifications at any later
time.
7.4.10 409 Conflict
The request could not be completed due to a conflict with the current
state of the resource. This response is returned if the action
parameter in a REGISTER request conflicts with existing
registrations.
7.4.11 410 Gone
The requested resource is no longer available at the server and no
forwarding address is known. This condition is expected to be
considered permanent. If the server does not know, or has no facility
to determine, whether or not the condition is permanent, the status
code 404 (Not Found) SHOULD be used instead.
7.4.12 411 Length Required
The server refuses to accept the request without a defined Content-
Length. The client MAY repeat the request if it adds a valid
Content-Length header field containing the length of the message-body
in the request message.
Handley, et al. Standards Track [Page 79]
RFC 2543 SIP: Session Initiation Protocol March 1999
7.4.13 413 Request Entity Too Large
The server is refusing to process a request because the request
entity is larger than the server is willing or able to process. The
server MAY close the connection to prevent the client from continuing
the request.
If the condition is temporary, the server SHOULD include a Retry-
After header field to indicate that it is temporary and after what
time the client MAY try again.
7.4.14 414 Request-URI Too Long
The server is refusing to service the request because the Request-URI
is longer than the server is willing to interpret.
7.4.15 415 Unsupported Media Type
The server is refusing to service the request because the message
body of the request is in a format not supported by the requested
resource for the requested method. The server SHOULD return a list of
acceptable formats using the Accept, Accept-Encoding and Accept-
Language header fields.
7.4.16 420 Bad Extension
The server did not understand the protocol extension specified in a
Require (Section 6.30) header field.
7.4.17 480 Temporarily Unavailable
The callee's end system was contacted successfully but the callee is
currently unavailable (e.g., not logged in or logged in in such a
manner as to preclude communication with the callee). The response
MAY indicate a better time to call in the Retry-After header. The
user could also be available elsewhere (unbeknownst to this host),
thus, this response does not terminate any searches. The reason
phrase SHOULD indicate a more precise cause as to why the callee is
unavailable. This value SHOULD be setable by the user agent. Status
486 (Busy Here) MAY be used to more precisely indicate a particular
reason for the call failure.
This status is also returned by a redirect server that recognizes the
user identified by the Request-URI, but does not currently have a
valid forwarding location for that user.
Handley, et al. Standards Track [Page 80]
RFC 2543 SIP: Session Initiation Protocol March 1999
7.4.18 481 Call Leg/Transaction Does Not Exist
This status is returned under two conditions: The server received a
BYE request that does not match any existing call leg or the server
received a CANCEL request that does not match any existing
transaction. (A server simply discards an ACK referring to an unknown
transaction.)
7.4.19 482 Loop Detected
The server received a request with a Via (Section 6.40) path
containing itself.
7.4.20 483 Too Many Hops
The server received a request that contains more Via entries (hops)
(Section 6.40) than allowed by the Max-Forwards (Section 6.23) header
field.
7.4.21 484 Address Incomplete
The server received a request with a To (Section 6.37) address or
Request-URI that was incomplete. Additional information SHOULD be
provided.
This status code allows overlapped dialing. With overlapped
dialing, the client does not know the length of the dialing
string. It sends strings of increasing lengths, prompting
the user for more input, until it no longer receives a 484
status response.
7.4.22 485 Ambiguous
The callee address provided in the request was ambiguous. The
response MAY contain a listing of possible unambiguous addresses in
Contact headers.
Revealing alternatives can infringe on privacy concerns of the user
or the organization. It MUST be possible to configure a server to
respond with status 404 (Not Found) or to suppress the listing of
possible choices if the request address was ambiguous.
Example response to a request with the URL lee@example.com :
485 Ambiguous SIP/2.0
Contact: Carol Lee <sip:carol.lee@example.com>
Handley, et al. Standards Track [Page 81]
RFC 2543 SIP: Session Initiation Protocol March 1999
Contact: Ping Lee <sip:p.lee@example.com>
Contact: Lee M. Foote <sip:lee.foote@example.com>
Some email and voice mail systems provide this
functionality. A status code separate from 3xx is used
since the semantics are different: for 300, it is assumed
that the same person or service will be reached by the
choices provided. While an automated choice or sequential
search makes sense for a 3xx response, user intervention is
required for a 485 response.
7.4.23 486 Busy Here
The callee's end system was contacted successfully but the callee is
currently not willing or able to take additional calls. The response
MAY indicate a better time to call in the Retry-After header. The
user could also be available elsewhere, such as through a voice mail
service, thus, this response does not terminate any searches. Status
600 (Busy Everywhere) SHOULD be used if the client knows that no
other end system will be able to accept this call.
7.5 Server Failure 5xx
5xx responses are failure responses given when a server itself has
erred. They are not definitive failures, and MUST NOT terminate a
search if other possible locations remain untried.
7.5.1 500 Server Internal Error
The server encountered an unexpected condition that prevented it from
fulfilling the request. The client MAY display the specific error
condition, and MAY retry the request after several seconds.
7.5.2 501 Not Implemented
The server does not support the functionality required to fulfill the
request. This is the appropriate response when the server does not
recognize the request method and is not capable of supporting it for
any user.
7.5.3 502 Bad Gateway
The server, while acting as a gateway or proxy, received an invalid
response from the downstream server it accessed in attempting to
fulfill the request.
Handley, et al. Standards Track [Page 82]
RFC 2543 SIP: Session Initiation Protocol March 1999
7.5.4 503 Service Unavailable
The server is currently unable to handle the request due to a
temporary overloading or maintenance of the server. The implication
is that this is a temporary condition which will be alleviated after
some delay. If known, the length of the delay MAY be indicated in a
Retry-After header. If no Retry-After is given, the client MUST
handle the response as it would for a 500 response.
Note: The existence of the 503 status code does not imply that a
server has to use it when becoming overloaded. Some servers MAY wish
to simply refuse the connection.
7.5.5 504 Gateway Time-out
The server, while acting as a gateway, did not receive a timely
response from the server (e.g., a location server) it accessed in
attempting to complete the request.
7.5.6 505 Version Not Supported
The server does not support, or refuses to support, the SIP protocol
version that was used in the request message. The server is
indicating that it is unable or unwilling to complete the request
using the same major version as the client, other than with this
error message. The response MAY contain an entity describing why that
version is not supported and what other protocols are supported by
that server. The format for such an entity is not defined here and
may be the subject of future standardization.
7.6 Global Failures 6xx
6xx responses indicate that a server has definitive information about
a particular user, not just the particular instance indicated in the
Request-URI. All further searches for this user are doomed to failure
and pending searches SHOULD be terminated.
7.6.1 600 Busy Everywhere
The callee's end system was contacted successfully but the callee is
busy and does not wish to take the call at this time. The response
MAY indicate a better time to call in the Retry-After header. If the
callee does not wish to reveal the reason for declining the call, the
callee uses status code 603 (Decline) instead. This status response
is returned only if the client knows that no other end point (such as
a voice mail system) will answer the request. Otherwise, 486 (Busy
Here) should be returned.
Handley, et al. Standards Track [Page 83]
RFC 2543 SIP: Session Initiation Protocol March 1999
7.6.2 603 Decline
The callee's machine was successfully contacted but the user
explicitly does not wish to or cannot participate. The response MAY
indicate a better time to call in the Retry-After header.
7.6.3 604 Does Not Exist Anywhere
The server has authoritative information that the user indicated in
the To request field does not exist anywhere. Searching for the user
elsewhere will not yield any results.
7.6.4 606 Not Acceptable
The user's agent was contacted successfully but some aspects of the
session description such as the requested media, bandwidth, or
addressing style were not acceptable.
A 606 (Not Acceptable) response means that the user wishes to
communicate, but cannot adequately support the session described. The
606 (Not Acceptable) response MAY contain a list of reasons in a
Warning header field describing why the session described cannot be
supported. Reasons are listed in Section 6.41. It is hoped that
negotiation will not frequently be needed, and when a new user is
being invited to join an already existing conference, negotiation may
not be possible. It is up to the invitation initiator to decide
whether or not to act on a 606 (Not Acceptable) response.
8 SIP Message Body
8.1 Body Inclusion
Requests MAY contain message bodies unless otherwise noted. Within
this specification, the BYE request MUST NOT contain a message body.
For ACK, INVITE and OPTIONS, the message body is always a session
description. The use of message bodies for REGISTER requests is for
further study.
For response messages, the request method and the response status
code determine the type and interpretation of any message body. All
responses MAY include a body. Message bodies for 1xx responses
contain advisory information about the progress of the request. 2xx
responses to INVITE requests contain session descriptions. In 3xx
responses, the message body MAY contain the description of
alternative destinations or services, as described in Section 7.3.
For responses with status 400 or greater, the message body MAY
Handley, et al. Standards Track [Page 84]
RFC 2543 SIP: Session Initiation Protocol March 1999
contain additional, human-readable information about the reasons for
failure. It is RECOMMENDED that information in 1xx and 300 and
greater responses be of type text/plain or text/html
8.2 Message Body Type
The Internet media type of the message body MUST be given by the
Content-Type header field. If the body has undergone any encoding
(such as compression) then this MUST be indicated by the Content-
Encoding header field, otherwise Content-Encoding MUST be omitted. If
applicable, the character set of the message body is indicated as
part of the Content-Type header-field value.
8.3 Message Body Length
The body length in bytes SHOULD be given by the Content-Length header
field. Section 6.15 describes the behavior in detail.
The "chunked" transfer encoding of HTTP/1.1 MUST NOT be used for SIP.
(Note: The chunked encoding modifies the body of a message in order
to transfer it as a series of chunks, each with its own size
indicator.)
9 Compact Form
When SIP is carried over UDP with authentication and a complex
session description, it may be possible that the size of a request or
response is larger than the MTU. To address this problem, a more
compact form of SIP is also defined by using abbreviations for the
common header fields listed below:
short field name long field name note
c Content-Type
e Content-Encoding
f From
i Call-ID
m Contact from "moved"
l Content-Length
s Subject
t To
v Via
Thus, the message in section 16.2 could also be written:
Handley, et al. Standards Track [Page 85]
RFC 2543 SIP: Session Initiation Protocol March 1999
INVITE sip:schooler@vlsi.caltech.edu SIP/2.0
v:SIP/2.0/UDP 131.215.131.131;maddr=239.128.16.254;ttl=16
v:SIP/2.0/UDP 128.16.64.19
f:sip:mjh@isi.edu
t:sip:schooler@cs.caltech.edu
i:62729-27@128.16.64.19
c:application/sdp
CSeq: 4711 INVITE
l:187
v=0
o=user1 53655765 2353687637 IN IP4 128.3.4.5
s=Mbone Audio
i=Discussion of Mbone Engineering Issues
e=mbone@somewhere.com
c=IN IP4 224.2.0.1/127
t=0 0
m=audio 3456 RTP/AVP 0
Clients MAY mix short field names and long field names within the
same request. Servers MUST accept both short and long field names for
requests. Proxies MAY change header fields between their long and
short forms, but this MUST NOT be done to fields following an
Authorization header.
10 Behavior of SIP Clients and Servers
10.1 General Remarks
SIP is defined so it can use either UDP (unicast or multicast) or TCP
as a transport protocol; it provides its own reliability mechanism.
10.1.1 Requests
Servers discard isomorphic requests, but first retransmit the
appropriate response. (SIP requests are said to be idempotent , i.e.,
receiving more than one copy of a request does not change the server
state.)
After receiving a CANCEL request from an upstream client, a stateful
proxy server MAY send a CANCEL on all branches where it has not yet
received a final response.
When a user agent receives a request, it checks the Call-ID against
those of in-progress calls. If the Call-ID was found, it compares the
tag value of To with the user's tag and rejects the request if the
Handley, et al. Standards Track [Page 86]
RFC 2543 SIP: Session Initiation Protocol March 1999
two do not match. If the From header, including any tag value,
matches the value for an existing call leg, the server compares the
CSeq header field value. If less than or equal to the current
sequence number, the request is a retransmission. Otherwise, it is a
new request. If the From header does not match an existing call leg,
a new call leg is created.
If the Call-ID was not found, a new call leg is created, with entries
for the To, From and Call-ID headers. In this case, the To header
field should not have contained a tag. The server returns a response
containing the same To value, but with a unique tag added. The tag
MAY be omitted if the request contained only one Via header field.
10.1.2 Responses
A server MAY issue one or more provisional responses at any time
before sending a final response. If a stateful proxy, user agent
server, redirect server or registrar cannot respond to a request with
a final response within 200 ms, it SHOULD issue a provisional (1xx)
response as soon as possible. Stateless proxies MUST NOT issue
provisional responses on their own.
Responses are mapped to requests by the matching To, From, Call-ID,
CSeq headers and the branch parameter of the first Via header.
Responses terminate request retransmissions even if they have Via
headers that cause them to be delivered to an upstream client.
A stateful proxy may receive a response that it does not have state
for, that is, where it has no a record of an associated request. If
the Via header field indicates that the upstream server used TCP, the
proxy actively opens a TCP connection to that address. Thus, proxies
have to be prepared to receive responses on the incoming side of
passive TCP connections, even though most responses will arrive on
the incoming side of an active connection. (An active connection is a
TCP connection initiated by the proxy, a passive connection is one
accepted by the proxy, but initiated by another entity.)
100 responses SHOULD NOT be forwarded, other 1xx responses MAY be
forwarded, possibly after the server eliminates responses with status
codes that had already been sent earlier. 2xx responses are forwarded
according to the Via header. Once a stateful proxy has received a 2xx
response, it MUST NOT forward non-2xx final responses. Responses
with status 300 and higher are retransmitted by each stateful proxy
until the next upstream proxy sends an ACK (see below for timing
details) or CANCEL.
Handley, et al. Standards Track [Page 87]
RFC 2543 SIP: Session Initiation Protocol March 1999
A stateful proxy SHOULD maintain state for at least 32 seconds after
the receipt of the first definitive non-200 response, in order to
handle retransmissions of the response.
The 32 second window is given by the maximum retransmission
duration of 200-class responses using the default timers,
in case the ACK is lost somewhere on the way to the called
user agent or the next stateful proxy.
10.2 Source Addresses, Destination Addresses and Connections
10.2.1 Unicast UDP
Responses are returned to the address listed in the Via header field
(Section 6.40), not the source address of the request.
Recall that responses are not generated by the next-hop
stateless server, but generated by either a proxy server or
the user agent server. Thus, the stateless proxy can only
use the Via header field to forward the response.
10.2.2 Multicast UDP
Requests MAY be multicast; multicast requests likely feature a host-
independent Request-URI. This request SHOULD be scoped to ensure it
is not forwarded beyond the boundaries of the administrative system.
This MAY be done with either TTL or administrative scopes[25],
depending on what is implemented in the network.
A client receiving a multicast query does not have to check whether
the host part of the Request-URI matches its own host or domain name.
If the request was received via multicast, the response is also
returned via multicast. Responses to multicast requests are multicast
with the same TTL as the request, where the TTL is derived from the
ttl parameter in the Via header (Section 6.40).
To avoid response implosion, servers MUST NOT answer multicast
requests with a status code other than 2xx or 6xx. The server delays
its response by a random interval uniformly distributed between zero
and one second. Servers MAY suppress responses if they hear a lower-
numbered or 6xx response from another group member prior to sending.
Servers do not respond to CANCEL requests received via multicast to
avoid request implosion. A proxy or UAC SHOULD send a CANCEL on
receiving the first 2xx or 6xx response to a multicast request.
Handley, et al. Standards Track [Page 88]
RFC 2543 SIP: Session Initiation Protocol March 1999
Server response suppression is a MAY since it requires a
server to violate some basic message processing rules. Lets
say A sends a multicast request, and it is received by B,C,
and D. B sends a 200 response. The topmost Via field in the
response will contain the address of A. C will also receive
this response, and could use it to suppress its own
response. However, C would normally not examine this
response, as the topmost Via is not its own. Normally, a
response received with an incorrect topmost Via MUST be
dropped, but not in this case. To distinguish this packet
from a misrouted or multicast looped packet is fairly
complex, and for this reason the procedure is a MAY. The
CANCEL, instead, provides a simpler and more standard way
to perform response suppression. It is for this reason that
the use of CANCEL here is a SHOULD
10.3 TCP
A single TCP connection can serve one or more SIP transactions. A
transaction contains zero or more provisional responses followed by
one or more final responses. (Typically, transactions contain exactly
one final response, but there are exceptional circumstances, where,
for example, multiple 200 responses can be generated.)
The client SHOULD keep the connection open at least until the first
final response arrives. If the client closes or resets the TCP
connection prior to receiving the first final response, the server
treats this action as equivalent to a CANCEL request.
This behavior makes it less likely that malfunctioning
clients cause a proxy server to keep connection state
indefinitely.
The server SHOULD NOT close the TCP connection until it has sent its
final response, at which point it MAY close the TCP connection if it
wishes to. However, normally it is the client's responsibility to
close the connection.
If the server leaves the connection open, and if the client so
desires it MAY re-use the connection for further SIP requests or for
requests from the same family of protocols (such as HTTP or stream
control commands).
Handley, et al. Standards Track [Page 89]
RFC 2543 SIP: Session Initiation Protocol March 1999
If a server needs to return a response to a client and no longer has
a connection open to that client, it MAY open a connection to the
address listed in the Via header. Thus, a proxy or user agent MUST be
prepared to receive both requests and responses on a "passive"
connection.
10.4 Reliability for BYE, CANCEL, OPTIONS, REGISTER Requests
10.4.1 UDP
A SIP client using UDP SHOULD retransmit a BYE, CANCEL, OPTIONS, or
REGISTER request with an exponential backoff, starting at a T1 second
interval, doubling the interval for each packet, and capping off at a
T2 second interval. This means that after the first packet is sent,
the second is sent T1 seconds later, the next 2*T1 seconds after
that, the next 4*T1 seconds after that, and so on, until the interval
hits T2. Subsequent retransmissions are spaced by T2 seconds. If the
client receives a provisional response, it continues to retransmit
the request, but with an interval of T2 seconds. Retransmissions
cease when the client has sent a total of eleven packets, or receives
a definitive response. Default values for T1 and T2 are 500 ms and 4
s, respectively. Clients MAY use larger values, but SHOULD NOT use
smaller ones. Servers retransmit the response upon receipt of a
request retransmission. After the server sends a final response, it
cannot be sure the client has received the response, and thus SHOULD
cache the results for at least 10*T2 seconds to avoid having to, for
example, contact the user or location server again upon receiving a
request retransmission.
Use of the exponential backoff is for congestion control
purposes. However, the back-off must cap off, since request
retransmissions are used to trigger response
retransmissions at the server. Without a cap, the loss of a
single response could significantly increase transaction
latencies.
The value of the initial retransmission timer is smaller than that
that for TCP since it is expected that network paths suitable for
interactive communications have round-trip times smaller than 500 ms.
For congestion control purposes, the retransmission count has to be
bounded. Given that most transactions are expected to consist of one
request and a few responses, round-trip time estimation is not likely
to be very useful. If RTT estimation is desired to more quickly
discover a missing final response, each request retransmission needs
to be labeled with its own Timestamp (Section 6.36), returned in the
response. The server caches the result until it can be sure that the
client will not retransmit the same request again.
Handley, et al. Standards Track [Page 90]
RFC 2543 SIP: Session Initiation Protocol March 1999
Each server in a proxy chain generates its own final response to a
CANCEL request. The server responds immediately upon receipt of the
CANCEL request rather than waiting until it has received final
responses from the CANCEL requests it generates.
BYE and OPTIONS final responses are generated by redirect and user
agent servers; REGISTER final responses are generated by registrars.
Note that in contrast to the reliability mechanism described in
Section 10.5, responses to these requests are not retransmitted
periodically and not acknowledged via ACK.
10.4.2 TCP
Clients using TCP do not need to retransmit requests.
10.5 Reliability for INVITE Requests
Special considerations apply for the INVITE method.
1. After receiving an invitation, considerable time can elapse
before the server can determine the outcome. For example,
if the called party is "rung" or extensive searches are
performed, delays between the request and a definitive
response can reach several tens of seconds. If either
caller or callee are automated servers not directly
controlled by a human being, a call attempt could be
unbounded in time.
2. If a telephony user interface is modeled or if we need to
interface to the PSTN, the caller's user interface will
provide "ringback", a signal that the callee is being
alerted. (The status response 180 (Ringing) MAY be used to
initiate ringback.) Once the callee picks up, the caller
needs to know so that it can enable the voice path and stop
ringback. The callee's response to the invitation could get
lost. Unless the response is transmitted reliably, the
caller will continue to hear ringback while the callee
assumes that the call exists.
3. The client has to be able to terminate an on-going request,
e.g., because it is no longer willing to wait for the
connection or search to succeed. The server will have to
wait several retransmission intervals to interpret the lack
of request retransmissions as the end of a call. If the
call succeeds shortly after the caller has given up, the
callee will "pick up the phone" and not be "connected".
Handley, et al. Standards Track [Page 91]
RFC 2543 SIP: Session Initiation Protocol March 1999
10.5.1 UDP
For UDP, A SIP client SHOULD retransmit a SIP INVITE request with an
interval that starts at T1 seconds, and doubles after each packet
transmission. The client ceases retransmissions if it receives a
provisional or definitive response, or once it has sent a total of 7
request packets.
A server which transmits a provisional response should retransmit it
upon reception of a duplicate request. A server which transmits a
final response should retransmit it with an interval that starts at
T1 seconds, and doubles for each subsequent packet. Response
retransmissions cease when any one of the following occurs:
1. An ACK request for the same transaction is received;
2. a BYE request for the same call leg is received;
3. a CANCEL request for the same call leg is received and the
final response status was equal or greater to 300;
4. the response has been transmitted 7 times.
Only the user agent client generates an ACK for 2xx final responses,
If the response contained a Contact header field, the ACK MAY be sent
to the address listed in that Contact header field. If the response
did not contain a Contact header, the client uses the same To header
field and Request-URI as for the INVITE request and sends the ACK to
the same destination as the original INVITE request. ACKs for final
responses other than 2xx are sent to the same server that the
original request was sent to, using the same Request-URI as the
original request. Note, however, that the To header field in the ACK
is copied from the response being acknowledged, not the request, and
thus MAY additionally contain the tag parameter. Also note than
unlike 2xx final responses, a proxy generates an ACK for non-2xx
final responses.
The ACK request MUST NOT be acknowledged to prevent a response-ACK
feedback loop. Fig. 12 and 13 show the client and server state
diagram for invitations.
The mechanism in Sec. 10.4 would not work well for INVITE
because of the long delays between INVITE and a final
response. If the 200 response were to get lost, the callee
would believe the call to exist, but the voice path would
Handley, et al. Standards Track [Page 92]
RFC 2543 SIP: Session Initiation Protocol March 1999
+===========+
* *
...........>* Initial *<;;;;;;;;;;
: 7 INVITE * * ;
: sent +===========+ ;
: | ;
: | - ;
: | INVITE ;
: | ;
: v ;
: ************* ;
: T1*2^n <--* * ;
: INVITE -->* Calling *--------+ ;
: * * | ;
: ************* | ;
: : | | ;
:.............: | 1xx xxx | ;
| - ACK | ;
| | ;
v | ;
************* | ;
* * | ;
* Ringing *<->1xx | ;
* * | ;
************* | ;
| | ;
|<-------------+ ;
| ;
v ;
************* ;
xxx <--* * ;
ACK -->* Completed * ;
* * ;
************* ;
; 32s (for proxy);
;;;;;;;;;;;;;;;;;;
event (xxx=status)
message
Figure 12: State transition diagram of client for INVITE method
Handley, et al. Standards Track [Page 93]
RFC 2543 SIP: Session Initiation Protocol March 1999
7 pkts sent +===============+
+-------------->* *
| * Initial *<...............
|;;;;;;;;;;;;;;>* * :
|; +===============+ :
|; CANCEL ! :
|; 200 ! INVITE :
|; ! 1xx :
|; ! :
|; v :
|; ***************** BYE :
|; INVITE -->* * 200 :
|; 1xx <--* Call proceed. *..............>:
|; * * :
|;;;;;;;;;;;;;;;***************** :
|; ! ! :
|: ! ! :
|; failure ! ! picks up :
|; >= 300 ! ! 200 :
|; +-------+ +-------+ :
|; v v :
|; *********** *********** :
|;INVITE<* *<T1*2^n->* *>INVITE :
|;status>* failure *>status<-* success *<status :
|; * * * * :
|;;;;;;;;*********** *********** :
| ! : | | ! : :
| ! : | | ! : :
+-------------!-:-+------------+ ! : :
! :.................!..:.........>:
! ! BYE :
+---------+---------+ 200 :
event ! ACK :
message sent v :
***************** :
V---* * :
ACK * Confirmed * :
|-->* * :
***************** .
:......................>:
Figure 13: State transition diagram of server for INVITE method
Handley, et al. Standards Track [Page 94]
RFC 2543 SIP: Session Initiation Protocol March 1999
be dead since the caller does not know that the callee has
picked up. Thus, the INVITE retransmission interval would
have to be on the order of a second or two to limit the
duration of this state confusion. Retransmitting the
response with an exponential back-off helps ensure that the
response is received, without placing an undue burden on
the network.
10.5.2 TCP
A user agent using TCP MUST NOT retransmit requests, but uses the
same algorithm as for UDP (Section 10.5.1) to retransmit responses
until it receives an ACK.
It is necessary to retransmit 2xx responses as their
reliability is assured end-to-end only. If the chain of
proxies has a UDP link in the middle, it could lose the
response, with no possibility of recovery. For simplicity,
we also retransmit non-2xx responses, although that is not
strictly necessary.
10.6 Reliability for ACK Requests
The ACK request does not generate responses. It is only generated
when a response to an INVITE request arrives (see Section 10.5). This
behavior is independent of the transport protocol. Note that the ACK
request MAY take a different path than the original INVITE request,
and MAY even cause a new TCP connection to be opened in order to send
it.
10.7 ICMP Handling
Handling of ICMP messages in the case of UDP messages is
straightforward. For requests, a host, network, port, or protocol
unreachable error SHOULD be treated as if a 400-class response was
received. For responses, these errors SHOULD cause the server to
cease retransmitting the response.
Source quench ICMP messages SHOULD be ignored. TTL exceeded errors
SHOULD be ignored. Parameter problem errors SHOULD be treated as if a
400-class response was received.
11 Behavior of SIP User Agents
This section describes the rules for user agent client and servers
for generating and processing requests and responses.
Handley, et al. Standards Track [Page 95]
RFC 2543 SIP: Session Initiation Protocol March 1999
11.1 Caller Issues Initial INVITE Request
When a user agent client desires to initiate a call, it formulates an
INVITE request. The To field in the request contains the address of
the callee. The Request-URI contains the same address. The From field
contains the address of the caller. If the From address can appear
in requests generated by other user agent clients for the same call,
the caller MUST insert the tag parameter in the From field. A UAC MAY
optionally add a Contact header containing an address where it would
like to be contacted for transactions from the callee back to the
caller.
11.2 Callee Issues Response
When the initial INVITE request is received at the callee, the callee
can accept, redirect, or reject the call. In all of these cases, it
formulates a response. The response MUST copy the To, From, Call-ID,
CSeq and Via fields from the request. Additionally, the responding
UAS MUST add the tag parameter to the To field in the response if the
request contained more than one Via header field. Since a request
from a UAC may fork and arrive at multiple hosts, the tag parameter
serves to distinguish, at the UAC, multiple responses from different
UAS's. The UAS MAY add a Contact header field in the response. It
contains an address where the callee would like to be contacted for
subsequent transactions, including the ACK for the current INVITE.
The UAS stores the values of the To and From field, including any
tags. These become the local and remote addresses of the call leg,
respectively.
11.3 Caller Receives Response to Initial Request
Multiple responses may arrive at the UAC for a single INVITE request,
due to a forking proxy. Each response is distinguished by the "tag"
parameter in the To header field, and each represents a distinct call
leg. The caller MAY choose to acknowledge or terminate the call with
each responding UAS. To acknowledge, it sends an ACK request, and to
terminate it sends a BYE request. The To header field in the ACK or
BYE MUST be the same as the To field in the 200 response, including
any tag. The From header field MUST be the same as the From header
field in the 200 (OK) response, including any tag. The Request-URI of
the ACK or BYE request MAY be set to whatever address was found in
the Contact header field in the 200 (OK) response, if present.
Alternately, a UAC may copy the address from the To header field into
the Request-URI. The UAC also notes the value of the To and From
header fields in each response. For each call leg, the To header
field becomes the remote address, and the From header field becomes
the local address.
Handley, et al. Standards Track [Page 96]
RFC 2543 SIP: Session Initiation Protocol March 1999
11.4 Caller or Callee Generate Subsequent Requests
Once the call has been established, either the caller or callee MAY
generate INVITE or BYE requests to change or terminate the call.
Regardless of whether the caller or callee is generating the new
request, the header fields in the request are set as follows. For the
desired call leg, the To header field is set to the remote address,
and the From header field is set to the local address (both including
any tags). The Contact header field MAY be different than the Contact
header field sent in a previous response or request. The Request-URI
MAY be set to the value of the Contact header field received in a
previous request or response from the remote party, or to the value
of the remote address.
11.5 Receiving Subsequent Requests
When a request is received subsequently, the following checks are
made:
1. If the Call-ID is new, the request is for a new call,
regardless of the values of the To and From header fields.
2. If the Call-ID exists, the request is for an existing call.
If the To, From, Call-ID, and CSeq values exactly match
(including tags) those of any requests received previously,
the request is a retransmission.
3. If there was no match to the previous step, the To and From
fields are compared against existing call leg local and
remote addresses. If there is a match, and the CSeq in the
request is higher than the last CSeq received on that leg,
the request is a new transaction for an existing call leg.
12 Behavior of SIP Proxy and Redirect Servers
This section describes behavior of SIP redirect and proxy servers in
detail. Proxy servers can "fork" connections, i.e., a single incoming
request spawns several outgoing (client) requests.
12.1 Redirect Server
A redirect server does not issue any SIP requests of its own. After
receiving a request other than CANCEL, the server gathers the list of
alternative locations and returns a final response of class 3xx or it
refuses the request. For well-formed CANCEL requests, it SHOULD
return a 2xx response. This response ends the SIP transaction. The
Handley, et al. Standards Track [Page 97]
RFC 2543 SIP: Session Initiation Protocol March 1999
redirect server maintains transaction state for the whole SIP
transaction. It is up to the client to detect forwarding loops
between redirect servers.
12.2 User Agent Server
User agent servers behave similarly to redirect servers, except that
they also accept requests and can return a response of class 2xx.
12.3 Proxy Server
This section outlines processing rules for proxy servers. A proxy
server can either be stateful or stateless. When stateful, a proxy
remembers the incoming request which generated outgoing requests, and
the outgoing requests. A stateless proxy forgets all information once
an outgoing request is generated. A forking proxy SHOULD be stateful.
Proxies that accept TCP connections MUST be stateful.
Otherwise, if the proxy were to lose a request, the TCP
client would never retransmit it.
A stateful proxy SHOULD NOT become stateless until after it sends a
definitive response upstream, and at least 32 seconds after it
received a definitive response.
A stateful proxy acts as a virtual UAS/UAC. It implements the server
state machine when receiving requests, and the client state machine
for generating outgoing requests, with the exception of receiving a
2xx response to an INVITE. Instead of generating an ACK, the 2xx
response is always forwarded upstream towards the caller.
Furthermore, ACK's for 200 responses to INVITE's are always proxied
downstream towards the UAS, as they would be for a stateless proxy.
A stateless proxy does not act as a virtual UAS/UAC (as this would
require state). Rather, a stateless proxy forwards every request it
receives downstream, and every response it receives upstream.
12.3.1 Proxying Requests
To prevent loops, a server MUST check if its own address is already
contained in the Via header field of the incoming request.
The To, From, Call-ID, and Contact tags are copied exactly from the
original request. The proxy SHOULD change the Request-URI to indicate
the server where it intends to send the request.
Handley, et al. Standards Track [Page 98]
RFC 2543 SIP: Session Initiation Protocol March 1999
A proxy server always inserts a Via header field containing its own
address into those requests that are caused by an incoming request.
Each proxy MUST insert a "branch" parameter (Section 6.40).
12.3.2 Proxying Responses
A proxy only processes a response if the topmost Via field matches
one of its addresses. A response with a non-matching top Via field
MUST be dropped.
12.3.3 Stateless Proxy: Proxying Responses
A stateless proxy removes its own Via field, and checks the address
in the next Via field. In the case of UDP, the response is sent to
the address listed in the "maddr" tag if present, otherwise to the
"received" tag if present, and finally to the address in the "sent-
by" field. A proxy MUST remain stateful when handling requests
received via TCP.
A stateless proxy MUST NOT generate its own provisional responses.
12.3.4 Stateful Proxy: Receiving Requests
When a stateful proxy receives a request, it checks the To, From
(including tags), Call-ID and CSeq against existing request records.
If the tuple exists, the request is a retransmission. The provisional
or final response sent previously is retransmitted, as per the server
state machine. If the tuple does not exist, the request corresponds
to a new transaction, and the request should be proxied.
A stateful proxy server MAY generate its own provisional (1xx)
responses.
12.3.5 Stateful Proxy: Receiving ACKs
When an ACK request is received, it is either processed locally or
proxied. To make this determination, the To, From, CSeq and Call-ID
fields are compared against those in previous requests. If there is
no match, the ACK request is proxied as if it were an INVITE request.
If there is a match, and if the server had ever sent a 200 response
upstream, the ACK is proxied. If the server had never sent any
responses upstream, the ACK is also proxied. If the server had sent a
3xx, 4xx, 5xx or 6xx response, but no 2xx response, the ACK is
processed locally if the tag in the To field of the ACK matches the
tag sent by the proxy in the response.
Handley, et al. Standards Track [Page 99]
RFC 2543 SIP: Session Initiation Protocol March 1999
12.3.6 Stateful Proxy: Receiving Responses
When a proxy server receives a response that has passed the Via
checks, the proxy server checks the To (without the tag), From
(including the tag), Call-ID and CSeq against values seen in previous
requests. If there is no match, the response is forwarded upstream to
the address listed in the Via field. If there is a match, the
"branch" tag in the Via field is examined. If it matches a known
branch identifier, the response is for the given branch, and
processed by the virtual client for the given branch. Otherwise, the
response is dropped.
A stateful proxy should obey the rules in Section 12.4 to determine
if the response should be proxied upstream. If it is to be proxied,
the same rules for stateless proxies above are followed, with the
following addition for TCP. If a request was received via TCP
(indicated by the protocol in the top Via header), the proxy checks
to see if it has a connection currently open to that address. If so,
the response is sent on that connection. Otherwise, a new TCP
connection is opened to the address and port in the Via field, and
the response is sent there. Note that this implies that a UAC or
proxy MUST be prepared to receive responses on the incoming side of a
TCP connection. Definitive non 200-class responses MUST be
retransmitted by the proxy, even over a TCP connection.
12.3.7 Stateless, Non-Forking Proxy
Proxies in this category issue at most a single unicast request for
each incoming SIP request, that is, they do not "fork" requests.
However, servers MAY choose to always operate in a mode that allows
issuing of several requests, as described in Section 12.4.
The server can forward the request and any responses. It does not
have to maintain any state for the SIP transaction. Reliability is
assured by the next redirect or stateful proxy server in the server
chain.
A proxy server SHOULD cache the result of any address translations
and the response to speed forwarding of retransmissions. After the
cache entry has been expired, the server cannot tell whether an
incoming request is actually a retransmission of an older request.
The server will treat it as a new request and commence another
search.
12.4 Forking Proxy
The server MUST respond to the request immediately with a 100
(Trying) response.
Handley, et al. Standards Track [Page 100]
RFC 2543 SIP: Session Initiation Protocol March 1999
Successful responses to an INVITE request MAY contain a Contact
header field so that the following ACK or BYE bypasses the proxy
search mechanism. If the proxy requires future requests to be routed
through it, it adds a Record-Route header to the request (Section
6.29).
The following C-code describes the behavior of a proxy server issuing
several requests in response to an incoming INVITE request. The
function request(r, a, b) sends a SIP request of type r to address a,
with branch id b. await_response() waits until a response is received
and returns the response. close(a) closes the TCP connection to
client with address a. response(r) sends a response to the client.
ismulticast() returns 1 if the location is a multicast address and
zero otherwise. The variable timeleft indicates the amount of time
left until the maximum response time has expired. The variable
recurse indicates whether the server will recursively try addresses
returned through a 3xx response. A server MAY decide to recursively
try only certain addresses, e.g., those which are within the same
domain as the proxy server. Thus, an initial multicast request can
trigger additional unicast requests.
/* request type */
typedef enum {INVITE, ACK, BYE, OPTIONS, CANCEL, REGISTER} Method;
process_request(Method R, int N, address_t address[])
{
struct {
int branch; /* branch id */
int done; /* has responded */
} outgoing[];
int done[]; /* address has responded */
char *location[]; /* list of locations */
int heard = 0; /* number of sites heard from */
int class; /* class of status code */
int timeleft = 120; /* sample timeout value */
int loc = 0; /* number of locations */
struct { /* response */
int status; /* response: CANCEL=-1 */
int locations; /* number of redirect locations */
char *location[]; /* redirect locations */
address_t a; /* address of respondent */
int branch; /* branch identifier */
} r, best; /* response, best response */
int i;
best.status = 1000;
for (i = 0; i < N; i++) {
Handley, et al. Standards Track [Page 101]
RFC 2543 SIP: Session Initiation Protocol March 1999
request(R, address[i], i);
outgoing[i].done = 0;
outgoing[i].branch = i;
}
while (timeleft > 0 && heard < N) {
r = await_response();
class = r.status / 100;
/* If final response, mark branch as done. */
if (class >= 2) {
heard++;
for (i = 0; i < N; i++) {
if (r.branch == outgoing[i].branch) {
outgoing[i].done = 1;
break;
}
}
}
/* CANCEL: respond, fork and wait for responses */
else if (class < 0) {
best.status = 200;
response(best);
for (i = 0; i < N; i++) {
if (!outgoing[i].done)
request(CANCEL, address[i], outgoing[i].branch);
}
best.status = -1;
}
/* Send an ACK */
if (class != 2) {
if (R == INVITE) request(ACK, r.a, r.branch);
}
if (class == 2) {
if (r.status < best.status) best = r;
break;
}
else if (class == 3) {
/* A server MAY optionally recurse. The server MUST check
* whether it has tried this location before and whether
* the location is part of the Via path of the incoming
* request. This check is omitted here for brevity.
* Multicast locations MUST NOT be returned to the client if
* the server is not recursing.
Handley, et al. Standards Track [Page 102]
RFC 2543 SIP: Session Initiation Protocol March 1999
*/
if (recurse) {
multicast = 0;
N += r.locations;
for (i = 0; i < r.locations; i++) {
request(R, r.location[i]);
}
} else if (!ismulticast(r.location)) {
best = r;
}
}
else if (class == 4) {
if (best.status >= 400) best = r;
}
else if (class == 5) {
if (best.status >= 500) best = r;
}
else if (class == 6) {
best = r;
break;
}
}
/* We haven't heard anything useful from anybody. */
if (best.status == 1000) {
best.status = 404;
}
if (best.status/100 != 3) loc = 0;
response(best);
}
Responses are processed as follows. The process completes (and state
can be freed) when all requests have been answered by final status
responses (for unicast) or 60 seconds have elapsed (for multicast). A
proxy MAY send a CANCEL to all branches and return a 408 (Timeout) to
the client after 60 seconds or more.
1xx: The proxy MAY forward the response upstream towards the client.
2xx: The proxy MUST forward the response upstream towards the client,
without sending an ACK downstream. After receiving a 2xx, the
server MAY terminate all other pending requests by sending a
CANCEL request and closing the TCP connection, if applicable.
(Terminating pending requests is advisable as searches consume
resources. Also, INVITE requests could "ring" on a number of
workstations if the callee is currently logged in more than
once.)
Handley, et al. Standards Track [Page 103]
RFC 2543 SIP: Session Initiation Protocol March 1999
3xx: The proxy MUST send an ACK and MAY recurse on the listed Contact
addresses. Otherwise, the lowest-numbered response is returned
if there were no 2xx responses.
Location lists are not merged as that would prevent
forwarding of authenticated responses. Also, responses can
have message bodies, so that merging is not feasible.
4xx, 5xx: The proxy MUST send an ACK and remember the response if it
has a lower status code than any previous 4xx and 5xx responses.
On completion, the lowest-numbered response is returned if there
were no 2xx or 3xx responses.
6xx: The proxy MUST forward the response to the client and send an
ACK. Other pending requests MAY be terminated with CANCEL as
described for 2xx responses.
A proxy server forwards any response for Call-IDs for which it does
not have a pending transaction according to the response's Via
header. User agent servers respond to BYE requests for unknown call
legs with status code 481 (Transaction Does Not Exist); they drop ACK
requests with unknown call legs silently.
Special considerations apply for choosing forwarding destinations for
ACK and BYE requests. In most cases, these requests will bypass
proxies and reach the desired party directly, keeping proxies from
having to make forwarding decisions.
A proxy MAY maintain call state for a period of its choosing. If a
proxy still has list of destinations that it forwarded the last
INVITE to, it SHOULD direct ACK requests only to those downstream
servers.
13 Security Considerations
13.1 Confidentiality and Privacy: Encryption
13.1.1 End-to-End Encryption
SIP requests and responses can contain sensitive information about
the communication patterns and communication content of individuals.
The SIP message body MAY also contain encryption keys for the session
itself. SIP supports three complementary forms of encryption to
protect privacy:
o End-to-end encryption of the SIP message body and certain
sensitive header fields;
Handley, et al. Standards Track [Page 104]
RFC 2543 SIP: Session Initiation Protocol March 1999
o hop-by-hop encryption to prevent eavesdropping that tracks
who is calling whom;
o hop-by-hop encryption of Via fields to hide the route a
request has taken.
Not all of the SIP request or response can be encrypted end-to-end
because header fields such as To and Via need to be visible to
proxies so that the SIP request can be routed correctly. Hop-by-hop
encryption encrypts the entire SIP request or response on the wire so
that packet sniffers or other eavesdroppers cannot see who is calling
whom. Hop-by-hop encryption can also encrypt requests and responses
that have been end-to-end encrypted. Note that proxies can still see
who is calling whom, and this information is also deducible by
performing a network traffic analysis, so this provides a very
limited but still worthwhile degree of protection.
SIP Via fields are used to route a response back along the path taken
by the request and to prevent infinite request loops. However, the
information given by them can also provide useful information to an
attacker. Section 6.22 describes how a sender can request that Via
fields be encrypted by cooperating proxies without compromising the
purpose of the Via field.
End-to-end encryption relies on keys shared by the two user agents
involved in the request. Typically, the message is sent encrypted
with the public key of the recipient, so that only that recipient can
read the message. All implementations SHOULD support PGP-based
encryption [33] and MAY implement other schemes.
A SIP request (or response) is end-to-end encrypted by splitting the
message to be sent into a part to be encrypted and a short header
that will remain in the clear. Some parts of the SIP message, namely
the request line, the response line and certain header fields marked
with "n" in the "enc." column in Table 4 and 5 need to be read and
returned by proxies and thus MUST NOT be encrypted end-to-end.
Possibly sensitive information that needs to be made available as
plaintext include destination address (To) and the forwarding path
(Via) of the call. The Authorization header field MUST remain in the
clear if it contains a digital signature as the signature is
generated after encryption, but MAY be encrypted if it contains
"basic" or "digest" authentication. The From header field SHOULD
normally remain in the clear, but MAY be encrypted if required, in
which case some proxies MAY return a 401 (Unauthorized) status if
they require a From field.
Handley, et al. Standards Track [Page 105]
RFC 2543 SIP: Session Initiation Protocol March 1999
Other header fields MAY be encrypted or MAY travel in the clear as
desired by the sender. The Subject, Allow and Content-Type header
fields will typically be encrypted. The Accept, Accept-Language,
Date, Expires, Priority, Require, Call-ID, Cseq, and Timestamp header
fields will remain in the clear.
All fields that will remain in the clear MUST precede those that will
be encrypted. The message is encrypted starting with the first
character of the first header field that will be encrypted and
continuing through to the end of the message body. If no header
fields are to be encrypted, encrypting starts with the second CRLF
pair after the last header field, as shown below. Carriage return and
line feed characters have been made visible as "$", and the encrypted
part of the message is outlined.
INVITE sip:watson@boston.bell-telephone.com SIP/2.0$
Via: SIP/2.0/UDP 169.130.12.5$
To: T. A. Watson <sip:watson@bell-telephone.com>$
From: A. Bell <sip:a.g.bell@bell-telephone.com>$
Encryption: PGP version=5.0$
Content-Length: 224$
Call-ID: 187602141351@worcester.bell-telephone.com$
CSeq: 488$
$
*******************************************************
* Subject: Mr. Watson, come here.$ *
* Content-Type: application/sdp$ *
* $ *
* v=0$ *
* o=bell 53655765 2353687637 IN IP4 128.3.4.5$ *
* c=IN IP4 135.180.144.94$ *
* m=audio 3456 RTP/AVP 0 3 4 5$ *
*******************************************************
An Encryption header field MUST be added to indicate the encryption
mechanism used. A Content-Length field is added that indicates the
length of the encrypted body. The encrypted body is preceded by a
blank line as a normal SIP message body would be.
Upon receipt by the called user agent possessing the correct
decryption key, the message body as indicated by the Content-Length
field is decrypted, and the now-decrypted body is appended to the
clear-text header fields. There is no need for an additional
Content-Length header field within the encrypted body because the
length of the actual message body is unambiguous after decryption.
Handley, et al. Standards Track [Page 106]
RFC 2543 SIP: Session Initiation Protocol March 1999
Had no SIP header fields required encryption, the message would have
been as below. Note that the encrypted body MUST then include a blank
line (start with CRLF) to disambiguate between any possible SIP
header fields that might have been present and the SIP message body.
INVITE sip:watson@boston.bell-telephone.com SIP/2.0$
Via: SIP/2.0/UDP 169.130.12.5$
To: T. A. Watson <sip:watson@bell-telephone.com>$
From: A. Bell <a.g.bell@bell-telephone.com>$
Encryption: PGP version=5.0$
Content-Type: application/sdp$
Content-Length: 107$
$
*************************************************
* $ *
* v=0$ *
* o=bell 53655765 2353687637 IN IP4 128.3.4.5$ *
* c=IN IP4 135.180.144.94$ *
* m=audio 3456 RTP/AVP 0 3 4 5$ *
*************************************************
13.1.2 Privacy of SIP Responses
SIP requests can be sent securely using end-to-end encryption and
authentication to a called user agent that sends an insecure
response. This is allowed by the SIP security model, but is not a
good idea. However, unless the correct behavior is explicit, it
would not always be possible for the called user agent to infer what
a reasonable behavior was. Thus when end-to-end encryption is used by
the request originator, the encryption key to be used for the
response SHOULD be specified in the request. If this were not done,
it might be possible for the called user agent to incorrectly infer
an appropriate key to use in the response. Thus, to prevent key-
guessing becoming an acceptable strategy, we specify that a called
user agent receiving a request that does not specify a key to be used
for the response SHOULD send that response unencrypted.
Any SIP header fields that were encrypted in a request SHOULD also be
encrypted in an encrypted response. Contact response fields MAY be
encrypted if the information they contain is sensitive, or MAY be
left in the clear to permit proxies more scope for localized
searches.
Handley, et al. Standards Track [Page 107]
RFC 2543 SIP: Session Initiation Protocol March 1999
13.1.3 Encryption by Proxies
Normally, proxies are not allowed to alter end-to-end header fields
and message bodies. Proxies MAY, however, encrypt an unsigned request
or response with the key of the call recipient.
Proxies need to encrypt a SIP request if the end system
cannot perform encryption or to enforce organizational
security policies.
13.1.4 Hop-by-Hop Encryption
SIP requests and responses MAY also be protected by security
mechanisms at the transport or network layer. No particular mechanism
is defined or recommended here. Two possibilities are IPSEC [34] or
TLS [35]. The use of a particular mechanism will generally need to be
specified out of band, through manual configuration, for example.
13.1.5 Via field encryption
When Via header fields are to be hidden, a proxy that receives a
request containing an appropriate "Hide: hop" header field (as
specified in section 6.22) SHOULD encrypt the header field. As only
the proxy that encrypts the field will decrypt it, the algorithm
chosen is entirely up to the proxy implementor. Two methods satisfy
these requirements:
o The server keeps a cache of Via header fields and the
associated To header field, and replaces the Via header field
with an index into the cache. On the reverse path, take the
Via header field from the cache rather than the message.
This is insufficient to prevent message looping, and so an
additional ID MUST be added so that the proxy can detect loops.
This SHOULD NOT normally be the address of the proxy as the goal
is to hide the route, so instead a sufficiently large random
number SHOULD be used by the proxy and maintained in the cache.
It is possible for replies to get directed to the wrong
originator if the cache entry gets reused, so great care needs
to be taken to ensure this does not happen.
o The server MAY use a secret key to encrypt the Via field, a
timestamp and an appropriate checksum in any such message with
the same secret key. The checksum is needed to detect whether
successful decoding has occurred, and the timestamp is
Handley, et al. Standards Track [Page 108]
RFC 2543 SIP: Session Initiation Protocol March 1999
required to prevent possible replay attacks and to ensure that
no two requests from the same previous hop have the same
encrypted Via field. This is the preferred solution.
13.2 Message Integrity and Access Control: Authentication
Protective measures need to be taken to prevent an active attacker
from modifying and replaying SIP requests and responses. The same
cryptographic measures that are used to ensure the authenticity of
the SIP message also serve to authenticate the originator of the
message. However, the "basic" and "digest" authentication mechanism
offer authentication only, without message integrity.
Transport-layer or network-layer authentication MAY be used for hop-
by-hop authentication. SIP also extends the HTTP WWW-Authenticate
(Section 6.42) and Authorization (Section 6.11) header field and
their Proxy counterparts to include cryptographically strong
signatures. SIP also supports the HTTP "basic" and "digest" schemes
(see Section 14) and other HTTP authentication schemes to be defined
that offer a rudimentary mechanism of ascertaining the identity of
the caller.
Since SIP requests are often sent to parties with which no
prior communication relationship has existed, we do not
specify authentication based on shared secrets.
SIP requests MAY be authenticated using the Authorization header
field to include a digital signature of certain header fields, the
request method and version number and the payload, none of which are
modified between client and called user agent. The Authorization
header field is used in requests to authenticate the request
originator end-to-end to proxies and the called user agent, and in
responses to authenticate the called user agent or proxies returning
their own failure codes. If required, hop-by-hop authentication can
be provided, for example, by the IPSEC Authentication Header.
SIP does not dictate which digital signature scheme is used for
authentication, but does define how to provide authentication using
PGP in Section 15. As indicated above, SIP implementations MAY also
use "basic" and "digest" authentication and other authentication
mechanisms defined for HTTP. Note that "basic" authentication has
severe security limitations. The following does not apply to these
schemes.
To cryptographically sign a SIP request, the order of the SIP header
fields is important. When an Authorization header field is present,
it indicates that all header fields following the Authorization
Handley, et al. Standards Track [Page 109]
RFC 2543 SIP: Session Initiation Protocol March 1999
header field have been included in the signature. Therefore, hop-
by-hop header fields which MUST or SHOULD be modified by proxies MUST
precede the Authorization header field as they will generally be
modified or added-to by proxy servers. Hop-by-hop header fields
which MAY be modified by a proxy MAY appear before or after the
Authorization header. When they appear before, they MAY be modified
by a proxy. When they appear after, they MUST NOT be modified by a
proxy. To sign a request, a client constructs a message from the
request method (in upper case) followed, without LWS, by the SIP
version number, followed, again without LWS, by the request headers
to be signed and the message body. The message thus constructed is
then signed.
For example, if the SIP request is to be:
INVITE sip:watson@boston.bell-telephone.com SIP/2.0
Via: SIP/2.0/UDP 169.130.12.5
Authorization: PGP version=5.0, signature=...
From: A. Bell <sip:a.g.bell@bell-telephone.com>
To: T. A. Watson <sip:watson@bell-telephone.com>
Call-ID: 187602141351@worcester.bell-telephone.com
Subject: Mr. Watson, come here.
Content-Type: application/sdp
Content-Length: ...
v=0
o=bell 53655765 2353687637 IN IP4 128.3.4.5
c=IN IP4 135.180.144.94
m=audio 3456 RTP/AVP 0 3 4 5
Then the data block that is signed is:
INVITESIP/2.0From: A. Bell <sip:a.g.bell@bell-telephone.com>
To: T. A. Watson <sip:watson@bell-telephone.com>
Call-ID: 187602141351@worcester.bell-telephone.com
Subject: Mr. Watson, come here.
Content-Type: application/sdp
Content-Length: ...
v=0
o=bell 53655765 2353687637 IN IP4 128.3.4.5
c=IN IP4 135.180.144.94
m=audio 3456 RTP/AVP 0 3 4 5
Handley, et al. Standards Track [Page 110]
RFC 2543 SIP: Session Initiation Protocol March 1999
Clients wishing to authenticate requests MUST construct the portion
of the message below the Authorization header using a canonical form.
This allows a proxy to parse the message, take it apart, and
reconstruct it, without causing an authentication failure due to
extra white space, for example. Canonical form consists of the
following rules:
o No short form header fields
o Header field names are capitalized as shown in this document
o No white space between the header name and the colon
o A single space after the colon
o Line termination with a CRLF
o No line folding
o No comma separated lists of header values; each must appear
as a separate header
o Only a single SP between tokens, between tokens and quoted
strings, and between quoted strings; no SP after last token or
quoted string
o No LWS between tokens and separators, except as described
above for after the colon in header fields
Note that if a message is encrypted and authenticated using a digital
signature, when the message is generated encryption is performed
before the digital signature is generated. On receipt, the digital
signature is checked before decryption.
A client MAY require that a server sign its response by including a
Require: org.ietf.sip.signed-response request header field. The
client indicates the desired authentication method via the WWW-
Authenticate header.
The correct behavior in handling unauthenticated responses to a
request that requires authenticated responses is described in section
13.2.1.
Handley, et al. Standards Track [Page 111]
RFC 2543 SIP: Session Initiation Protocol March 1999
13.2.1 Trusting responses
There is the possibility that an eavesdropper listens to requests and
then injects unauthenticated responses that terminate, redirect or
otherwise interfere with a call. (Even encrypted requests contain
enough information to fake a response.)
Clients need to be particularly careful with 3xx redirection
responses. Thus a client receiving, for example, a 301 (Moved
Permanently) which was not authenticated when the public key of the
called user agent is known to the client, and authentication was
requested in the request SHOULD be treated as suspicious. The correct
behavior in such a case would be for the called-user to form a dated
response containing the Contact field to be used, to sign it, and
give this signed stub response to the proxy that will provide the
redirection. Thus the response can be authenticated correctly. A
client SHOULD NOT automatically redirect such a request to the new
location without alerting the user to the authentication failure
before doing so.
Another problem might be responses such as 6xx failure responses
which would simply terminate a search, or "4xx" and "5xx" response
failures.
If TCP is being used, a proxy SHOULD treat 4xx and 5xx responses as
valid, as they will not terminate a search. However, fake 6xx
responses from a rogue proxy terminate a search incorrectly. 6xx
responses SHOULD be authenticated if requested by the client, and
failure to do so SHOULD cause such a client to ignore the 6xx
response and continue a search.
With UDP, the same problem with 6xx responses exists, but also an
active eavesdropper can generate 4xx and 5xx responses that might
cause a proxy or client to believe a failure occurred when in fact it
did not. Typically 4xx and 5xx responses will not be signed by the
called user agent, and so there is no simple way to detect these
rogue responses. This problem is best prevented by using hop-by-hop
encryption of the SIP request, which removes any additional problems
that UDP might have over TCP.
These attacks are prevented by having the client require response
authentication and dropping unauthenticated responses. A server user
agent that cannot perform response authentication responds using the
normal Require response of 420 (Bad Extension).
Handley, et al. Standards Track [Page 112]
RFC 2543 SIP: Session Initiation Protocol March 1999
13.3 Callee Privacy
User location and SIP-initiated calls can violate a callee's privacy.
An implementation SHOULD be able to restrict, on a per-user basis,
what kind of location and availability information is given out to
certain classes of callers.
13.4 Known Security Problems
With either TCP or UDP, a denial of service attack exists by a rogue
proxy sending 6xx responses. Although a client SHOULD choose to
ignore such responses if it requested authentication, a proxy cannot
do so. It is obliged to forward the 6xx response back to the client.
The client can then ignore the response, but if it repeats the
request it will probably reach the same rogue proxy again, and the
process will repeat.
14 SIP Authentication using HTTP Basic and Digest Schemes
SIP implementations MAY use HTTP's basic and digest authentication
mechanisms to provide a rudimentary form of security. This section
overviews usage of these mechanisms in SIP. The basic operation is
almost completely identical to that for HTTP [36]. This section
outlines this operation, pointing to [36] for details, and noting the
differences when used in SIP.
14.1 Framework
The framework for SIP authentication parallels that for HTTP [36]. In
particular, the BNF for auth-scheme, auth-param, challenge, realm,
realm-value, and credentials is identical. The 401 response is used
by user agent servers in SIP to challenge the authorization of a user
agent client. Additionally, registrars and redirect servers MAY make
use of 401 responses for authorization, but proxies MUST NOT, and
instead MAY use the 407 response. The requirements for inclusion of
the Proxy-Authenticate, Proxy-Authorization, WWW-Authenticate, and
Authorization in the various messages is identical to [36].
Since SIP does not have the concept of a canonical root URL, the
notion of protections spaces are interpreted differently for SIP. The
realm is a protection domain for all SIP URIs with the same value for
the userinfo, host and port part of the SIP Request-URI. For example:
INVITE sip:alice.wonderland@example.com SIP/2.0
WWW-Authenticate: Basic realm="business"
Handley, et al. Standards Track [Page 113]
RFC 2543 SIP: Session Initiation Protocol March 1999
and
INVITE sip:aw@example.com SIP/2.0
WWW-Authenticate: Basic realm="business"
define different protection realms according to this rule.
When a UAC resubmits a request with its credentials after receiving a
401 or 407 response, it MUST increment the CSeq header field as it
would normally do when sending an updated request.
14.2 Basic Authentication
The rules for basic authentication follow those defined in [36], but
with the words "origin server" replaced with "user agent server,
redirect server , or registrar".
Since SIP URIs are not hierarchical, the paragraph in [36] that
states that "all paths at or deeper than the depth of the last
symbolic element in the path field of the Request-URI also are within
the protection space specified by the Basic realm value of the
current challenge" does not apply for SIP. SIP clients MAY
preemptively send the corresponding Authorization header with
requests for SIP URIs within the same protection realm (as defined
above) without receipt of another challenge from the server.
14.3 Digest Authentication
The rules for digest authentication follow those defined in [36],
with "HTTP 1.1" replaced by "SIP/2.0" in addition to the following
differences:
1. The URI included in the challenge has the following BNF:
URI = SIP-URL
2. The BNF for digest-uri-value is:
digest-uri-value = Request-URI ; a defined in Section
4.3
Handley, et al. Standards Track [Page 114]
RFC 2543 SIP: Session Initiation Protocol March 1999
3. The example procedure for choosing a nonce based on Etag
does not work for SIP.
4. The Authentication-Info and Proxy-Authentication-Info
fields are not used in SIP.
5. The text in [36] regarding cache operation does not apply
to SIP.
6. [36] requires that a server check that the URI in the
request line, and the URI included in the Authorization
header, point to the same resource. In a SIP context, these
two URI's may actually refer to different users, due to
forwarding at some proxy. Therefore, in SIP, a server MAY
check that the request-uri in the Authorization header
corresponds to a user that the server is willing to accept
forwarded or direct calls for.
14.4 Proxy-Authentication
The use of the Proxy-Authentication and Proxy-Authorization parallel
that as described in [36], with one difference. Proxies MUST NOT add
the Proxy-Authorization header. 407 responses MUST be forwarded
upstream towards the client following the procedures for any other
response. It is the client's responsibility to add the Proxy-
Authorization header containing credentials for the proxy which has
asked for authentication.
If a proxy were to resubmit a request with a Proxy-
Authorization header field, it would need to increment the
CSeq in the new request. However, this would mean that the
UAC which submitted the original request would discard a
response from the UAS, as the CSeq value would be
different.
See sections 6.26 and 6.27 for additional information on usage of
these fields as they apply to SIP.
15 SIP Security Using PGP
15.1 PGP Authentication Scheme
The "pgp" authentication scheme is based on the model that the client
authenticates itself with a request signed with the client's private
key. The server can then ascertain the origin of the request if it
has access to the public key, preferably signed by a trusted third
party.
Handley, et al. Standards Track [Page 115]
RFC 2543 SIP: Session Initiation Protocol March 1999
15.1.1 The WWW-Authenticate Response Header
WWW-Authenticate = "WWW-Authenticate" ":" "pgp" pgp-challenge
pgp-challenge = * (";" pgp-params )
pgp-params = realm | pgp-version | pgp-algorithm | nonce
realm = "realm" "=" realm-value
realm-value = quoted-string
pgp-version = "version" "="
<"> digit *( "." digit ) *letter <">
pgp-algorithm = "algorithm" "=" ( "md5" | "sha1" | token )
nonce = "nonce" "=" nonce-value
nonce-value = quoted-string
The meanings of the values of the parameters used above are as
follows:
realm: A string to be displayed to users so they know which identity
to use. This string SHOULD contain at least the name of the host
performing the authentication and MAY additionally indicate the
collection of users who might have access. An example might be "
Users with call-out privileges ".
pgp-algorithm: The value of this parameter indicates the PGP message
integrity check (MIC) to be used to produce the signature. If
this not present it is assumed to be "md5". The currently
defined values are "md5" for the MD5 checksum, and "sha1" for
the SHA.1 algorithm.
pgp-version: The version of PGP that the client MUST use. Common
values are "2.6.2" and "5.0". The default is 5.0.
nonce: A server-specified data string which should be uniquely
generated each time a 401 response is made. It is RECOMMENDED
that this string be base64 or hexadecimal data. Specifically,
since the string is passed in the header lines as a quoted
string, the double-quote character is not allowed. The contents
of the nonce are implementation dependent. The quality of the
implementation depends on a good choice. Since the nonce is used
only to prevent replay attacks and is signed, a time stamp in
units convenient to the server is sufficient.
Handley, et al. Standards Track [Page 116]
RFC 2543 SIP: Session Initiation Protocol March 1999
Replay attacks within the duration of the call setup are of
limited interest, so that timestamps with a resolution of a
few seconds are often should be sufficient. In that case,
the server does not have to keep a record of the nonces.
Example:
WWW-Authenticate: pgp ;version="5.0"
;realm="Your Startrek identity, please" ;algorithm=md5
;nonce="913082051"
15.1.2 The Authorization Request Header
The client is expected to retry the request, passing an Authorization
header line, which is defined as follows.
Authorization = "Authorization" ":" "pgp" *( ";" pgp-response )
pgp-response = realm | pgp-version | pgp-signature
| signed-by | nonce
pgp-signature = "signature" "=" quoted-string
signed-by = "signed-by" "=" <"> URI <">
The client MUST increment the CSeq header before resubmitting the
request. The signature MUST correspond to the From header of the
request unless the signed-by parameter is provided.
pgp-signature: The PGP ASCII-armored signature [33], as it appears
between the "BEGIN PGP MESSAGE" and "END PGP MESSAGE"
delimiters, without the version indication. The signature is
included without any linebreaks.
The signature is computed across the nonce (if present), request
method, request version and header fields following the Authorization
header and the message body, in the same order as they appear in the
message. The request method and version are prepended to the header
fields without any white space. The signature is computed across the
headers as sent, and the terminating CRLF. The CRLF following the
Authorization header is NOT included in the signature.
A server MAY be configured not to generate nonces only if replay
attacks are not a concern.
Handley, et al. Standards Track [Page 117]
RFC 2543 SIP: Session Initiation Protocol March 1999
Not generating nonces avoids the additional set of request,
401 response and possibly ACK messages and reduces delay by
one round-trip time.
Using the ASCII-armored version is about 25% less space-
efficient than including the binary signature, but it is
significantly easier for the receiver to piece together.
Versions of the PGP program always include the full
(compressed) signed text in their output unless ASCII-
armored mode ( -sta ) is specified. Typical signatures are
about 200 bytes long. -- The PGP signature mechanism allows
the client to simply pass the request to an external PGP
program. This relies on the requirement that proxy servers
are not allowed to reorder or change header fields.
realm: The realm is copied from the corresponding WWW-Authenticate
header field parameter.
signed-by: If and only if the request was not signed by the entity
listed in the From header, the signed-by header indicates the
name of the signing entity, expressed as a URI.
Receivers of signed SIP messages SHOULD discard any end-to-end header
fields above the Authorization header, as they may have been
maliciously added en route by a proxy.
Example:
Authorization: pgp version="5.0"
;realm="Your Startrek identity, please"
;nonce="913082051"
;signature="iQB1AwUBNNJiUaYBnHmiiQh1AQFYsgL/Wt3dk6TWK81/b0gcNDf
VAUGU4rhEBW972IPxFSOZ94L1qhCLInTPaqhHFw1cb3lB01rA0RhpV4t5yCdUt
SRYBSkOK29o5e1KlFeW23EzYPVUm2TlDAhbcjbMdfC+KLFX
=aIrx"
15.2 PGP Encryption Scheme
The PGP encryption scheme uses the following syntax:
Encryption = "Encryption" ":" "pgp" pgp-eparams
pgp-eparams = 1# ( pgp-version | pgp-encoding )
pgp-encoding = "encoding" "=" "ascii" | token
Handley, et al. Standards Track [Page 118]
RFC 2543 SIP: Session Initiation Protocol March 1999
encoding: Describes the encoding or "armor" used by PGP. The value
"ascii" refers to the standard PGP ASCII armor, without the
lines containing "BEGIN PGP MESSAGE" and "END PGP MESSAGE" and
without the version identifier. By default, the encrypted part
is included as binary.
Example:
Encryption: pgp version="2.6.2", encoding="ascii"
15.3 Response-Key Header Field for PGP
Response-Key = "Response-Key" ":" "pgp" pgp-eparams
pgp-eparams = 1# ( pgp-version | pgp-encoding | pgp-key)
pgp-key = "key" "=" quoted-string
If ASCII encoding has been requested via the encoding parameter, the
key parameter contains the user's public key as extracted from the
pgp key ring with the "pgp -kxa user ".
Example:
Response-Key: pgp version="2.6.2", encoding="ascii",
key="mQBtAzNWHNYAAAEDAL7QvAdK2utY05wuUG+ItYK5tCF8HNJM60sU4rLaV+eUnkMk
mOmJWtc2wXcZx1XaXb2lkydTQOesrUR75IwNXBuZXPEIMThEa5WLsT7VLme7njnx
sE86SgWmAZx5ookIdQAFEbQxSGVubmluZyBTY2h1bHpyaW5uZSA8c2NodWx6cmlu
bmVAY3MuY29sdW1iaWEuZWR1Pg==
=+y19"
16 Examples
In the following examples, we often omit the message body and the
corresponding Content-Length and Content-Type headers for brevity.
16.1 Registration
A user at host saturn.bell-tel.com registers on start-up, via
multicast, with the local SIP server named bell-tel.com. In the
example, the user agent on saturn expects to receive SIP requests on
UDP port 3890.
Handley, et al. Standards Track [Page 119]
RFC 2543 SIP: Session Initiation Protocol March 1999
C->S: REGISTER sip:bell-tel.com SIP/2.0
Via: SIP/2.0/UDP saturn.bell-tel.com
From: sip:watson@bell-tel.com
To: sip:watson@bell-tel.com
Call-ID: 70710@saturn.bell-tel.com
CSeq: 1 REGISTER
Contact: <sip:watson@saturn.bell-tel.com:3890;transport=udp>
Expires: 7200
The registration expires after two hours. Any future invitations for
watson@bell-tel.com arriving at sip.bell-tel.com will now be
redirected to watson@saturn.bell-tel.com, UDP port 3890.
If Watson wants to be reached elsewhere, say, an on-line service he
uses while traveling, he updates his reservation after first
cancelling any existing locations:
C->S: REGISTER sip:bell-tel.com SIP/2.0
Via: SIP/2.0/UDP saturn.bell-tel.com
From: sip:watson@bell-tel.com
To: sip:watson@bell-tel.com
Call-ID: 70710@saturn.bell-tel.com
CSeq: 2 REGISTER
Contact: *
Expires: 0
C->S: REGISTER sip:bell-tel.com SIP/2.0
Via: SIP/2.0/UDP saturn.bell-tel.com
From: sip:watson@bell-tel.com
To: sip:watson@bell-tel.com
Call-ID: 70710@saturn.bell-tel.com
CSeq: 3 REGISTER
Contact: sip:tawatson@example.com
Now, the server will forward any request for Watson to the server at
example.com, using the Request-URI tawatson@example.com. For the
server at example.com to reach Watson, he will need to send a
REGISTER there, or inform the server of his current location through
some other means.
It is possible to use third-party registration. Here, the secretary
jon.diligent registers his boss, T. Watson:
Handley, et al. Standards Track [Page 120]
RFC 2543 SIP: Session Initiation Protocol March 1999
C->S: REGISTER sip:bell-tel.com SIP/2.0
Via: SIP/2.0/UDP pluto.bell-tel.com
From: sip:jon.diligent@bell-tel.com
To: sip:watson@bell-tel.com
Call-ID: 17320@pluto.bell-tel.com
CSeq: 1 REGISTER
Contact: sip:tawatson@example.com
The request could be sent to either the registrar at bell-tel.com or
the server at example.com. In the latter case, the server at
example.com would proxy the request to the address indicated in the
Request-URI. Then, Max-Forwards header could be used to restrict the
registration to that server.
16.2 Invitation to a Multicast Conference
The first example invites schooler@vlsi.cs.caltech.edu to a multicast
session. All examples use the Session Description Protocol (SDP) (RFC
2327 [6]) as the session description format.
16.2.1 Request
C->S: INVITE sip:schooler@cs.caltech.edu SIP/2.0
Via: SIP/2.0/UDP csvax.cs.caltech.edu;branch=8348
;maddr=239.128.16.254;ttl=16
Via: SIP/2.0/UDP north.east.isi.edu
From: Mark Handley <sip:mjh@isi.edu>
To: Eve Schooler <sip:schooler@caltech.edu>
Call-ID: 2963313058@north.east.isi.edu
CSeq: 1 INVITE
Subject: SIP will be discussed, too
Content-Type: application/sdp
Content-Length: 187
v=0
o=user1 53655765 2353687637 IN IP4 128.3.4.5
s=Mbone Audio
i=Discussion of Mbone Engineering Issues
e=mbone@somewhere.com
c=IN IP4 224.2.0.1/127
t=0 0
m=audio 3456 RTP/AVP 0
Handley, et al. Standards Track [Page 121]
RFC 2543 SIP: Session Initiation Protocol March 1999
The From request header above states that the request was initiated
by mjh@isi.edu and addressed to schooler@caltech.edu (From header
fields). The Via fields list the hosts along the path from invitation
initiator (the last element of the list) towards the callee. In the
example above, the message was last multicast to the administratively
scoped group 239.128.16.254 with a ttl of 16 from the host
csvax.cs.caltech.edu. The second Via header field indicates that it
was originally sent from the host north.east.isi.edu. The Request-URI
indicates that the request is currently being being addressed to
schooler@cs.caltech.edu, the local address that csvax looked up for
the callee.
In this case, the session description is using the Session
Description Protocol (SDP), as stated in the Content-Type header.
The header is terminated by an empty line and is followed by a
message body containing the session description.
16.2.2 Response
The called user agent, directly or indirectly through proxy servers,
indicates that it is alerting ("ringing") the called party:
S->C: SIP/2.0 180 Ringing
Via: SIP/2.0/UDP csvax.cs.caltech.edu;branch=8348
;maddr=239.128.16.254;ttl=16
Via: SIP/2.0/UDP north.east.isi.edu
From: Mark Handley <sip:mjh@isi.edu>
To: Eve Schooler <sip:schooler@caltech.edu> ;tag=9883472
Call-ID: 2963313058@north.east.isi.edu
CSeq: 1 INVITE
A sample response to the invitation is given below. The first line of
the response states the SIP version number, that it is a 200 (OK)
response, which means the request was successful. The Via headers are
taken from the request, and entries are removed hop by hop as the
response retraces the path of the request. A new authentication field
MAY be added by the invited user's agent if required. The Call-ID is
taken directly from the original request, along with the remaining
fields of the request message. The original sense of From field is
preserved (i.e., it is the session initiator).
In addition, the Contact header gives details of the host where the
user was located, or alternatively the relevant proxy contact point
which should be reachable from the caller's host.
Handley, et al. Standards Track [Page 122]
RFC 2543 SIP: Session Initiation Protocol March 1999
S->C: SIP/2.0 200 OK
Via: SIP/2.0/UDP csvax.cs.caltech.edu;branch=8348
;maddr=239.128.16.254;ttl=16
Via: SIP/2.0/UDP north.east.isi.edu
From: Mark Handley <sip:mjh@isi.edu>
To: Eve Schooler <sip:schooler@caltech.edu> ;tag=9883472
Call-ID: 2963313058@north.east.isi.edu
CSeq: 1 INVITE
Contact: sip:es@jove.cs.caltech.edu
The caller confirms the invitation by sending an ACK request to the
location named in the Contact header:
C->S: ACK sip:es@jove.cs.caltech.edu SIP/2.0
Via: SIP/2.0/UDP north.east.isi.edu
From: Mark Handley <sip:mjh@isi.edu>
To: Eve Schooler <sip:schooler@caltech.edu> ;tag=9883472
Call-ID: 2963313058@north.east.isi.edu
CSeq: 1 ACK
16.3 Two-party Call
For two-party Internet phone calls, the response must contain a
description of where to send the data. In the example below, Bell
calls Watson. Bell indicates that he can receive RTP audio codings 0
(PCMU), 3 (GSM), 4 (G.723) and 5 (DVI4).
C->S: INVITE sip:watson@boston.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP kton.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:watson@bell-tel.com>
Call-ID: 3298420296@kton.bell-tel.com
CSeq: 1 INVITE
Subject: Mr. Watson, come here.
Content-Type: application/sdp
Content-Length: ...
v=0
o=bell 53655765 2353687637 IN IP4 128.3.4.5
s=Mr. Watson, come here.
c=IN IP4 kton.bell-tel.com
m=audio 3456 RTP/AVP 0 3 4 5
Handley, et al. Standards Track [Page 123]
RFC 2543 SIP: Session Initiation Protocol March 1999
S->C: SIP/2.0 100 Trying
Via: SIP/2.0/UDP kton.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:watson@bell-tel.com> ;tag=37462311
Call-ID: 3298420296@kton.bell-tel.com
CSeq: 1 INVITE
Content-Length: 0
S->C: SIP/2.0 180 Ringing
Via: SIP/2.0/UDP kton.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:watson@bell-tel.com> ;tag=37462311
Call-ID: 3298420296@kton.bell-tel.com
CSeq: 1 INVITE
Content-Length: 0
S->C: SIP/2.0 182 Queued, 2 callers ahead
Via: SIP/2.0/UDP kton.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:watson@bell-tel.com> ;tag=37462311
Call-ID: 3298420296@kton.bell-tel.com
CSeq: 1 INVITE
Content-Length: 0
S->C: SIP/2.0 182 Queued, 1 caller ahead
Via: SIP/2.0/UDP kton.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:watson@bell-tel.com> ;tag=37462311
Call-ID: 3298420296@kton.bell-tel.com
CSeq: 1 INVITE
Content-Length: 0
S->C: SIP/2.0 200 OK
Via: SIP/2.0/UDP kton.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: <sip:watson@bell-tel.com> ;tag=37462311
Call-ID: 3298420296@kton.bell-tel.com
CSeq: 1 INVITE
Contact: sip:watson@boston.bell-tel.com
Content-Type: application/sdp
Content-Length: ...
v=0
o=watson 4858949 4858949 IN IP4 192.1.2.3
s=I'm on my way
c=IN IP4 boston.bell-tel.com
m=audio 5004 RTP/AVP 0 3
Handley, et al. Standards Track [Page 124]
RFC 2543 SIP: Session Initiation Protocol March 1999
The example illustrates the use of informational status responses.
Here, the reception of the call is confirmed immediately (100), then,
possibly after some database mapping delay, the call rings (180) and
is then queued, with periodic status updates.
Watson can only receive PCMU and GSM. Note that Watson's list of
codecs may or may not be a subset of the one offered by Bell, as each
party indicates the data types it is willing to receive. Watson will
send audio data to port 3456 at c.bell-tel.com, Bell will send to
port 5004 at boston.bell-tel.com.
By default, the media session is one RTP session. Watson will receive
RTCP packets on port 5005, while Bell will receive them on port 3457.
Since the two sides have agreed on the set of media, Bell confirms
the call without enclosing another session description:
C->S: ACK sip:watson@boston.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP kton.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:watson@bell-tel.com> ;tag=37462311
Call-ID: 3298420296@kton.bell-tel.com
CSeq: 1 ACK
16.4 Terminating a Call
To terminate a call, caller or callee can send a BYE request:
C->S: BYE sip:watson@boston.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP kton.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. A. Watson <sip:watson@bell-tel.com> ;tag=37462311
Call-ID: 3298420296@kton.bell-tel.com
CSeq: 2 BYE
If the callee wants to abort the call, it simply reverses the To and
From fields. Note that it is unlikely that a BYE from the callee will
traverse the same proxies as the original INVITE.
Handley, et al. Standards Track [Page 125]
RFC 2543 SIP: Session Initiation Protocol March 1999
16.5 Forking Proxy
In this example, Bell (a.g.bell@bell-tel.com) (C), currently seated
at host c.bell-tel.com wants to call Watson (t.watson@ieee.org). At
the time of the call, Watson is logged in at two workstations,
t.watson@x.bell-tel.com (X) and watson@y.bell-tel.com (Y), and has
registered with the IEEE proxy server (P) called sip.ieee.org. The
IEEE server also has a registration for the home machine of Watson,
at watson@h.bell-tel.com (H), as well as a permanent registration at
watson@acm.org (A). For brevity, the examples omit the session
description and Via header fields.
Bell's user agent sends the invitation to the SIP server for the
ieee.org domain:
C->P: INVITE sip:t.watson@ieee.org SIP/2.0
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>
Call-ID: 31415@c.bell-tel.com
CSeq: 1 INVITE
The SIP server at ieee.org tries the four addresses in parallel. It
sends the following message to the home machine:
P->H: INVITE sip:watson@h.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP sip.ieee.org ;branch=1
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>
Call-ID: 31415@c.bell-tel.com
CSeq: 1 INVITE
This request immediately yields a 404 (Not Found) response, since
Watson is not currently logged in at home:
H->P: SIP/2.0 404 Not Found
Via: SIP/2.0/UDP sip.ieee.org ;branch=1
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>;tag=87454273
Handley, et al. Standards Track [Page 126]
RFC 2543 SIP: Session Initiation Protocol March 1999
Call-ID: 31415@c.bell-tel.com
CSeq: 1 INVITE
The proxy ACKs the response so that host H can stop retransmitting
it:
P->H: ACK sip:watson@h.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP sip.ieee.org ;branch=1
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>;tag=87454273
Call-ID: 31415@c.bell-tel.com
CSeq: 1 ACK
Also, P attempts to reach Watson through the ACM server:
P->A: INVITE sip:watson@acm.org SIP/2.0
Via: SIP/2.0/UDP sip.ieee.org ;branch=2
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>
Call-ID: 31415@c.bell-tel.com
CSeq: 1 INVITE
In parallel, the next attempt proceeds, with an INVITE to X and Y:
P->X: INVITE sip:t.watson@x.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP sip.ieee.org ;branch=3
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>
Call-ID: 31415@c.bell-tel.com
CSeq: 1 INVITE
P->Y: INVITE sip:watson@y.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP sip.ieee.org ;branch=4
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>
Call-ID: 31415@c.bell-tel.com
CSeq: 1 INVITE
Handley, et al. Standards Track [Page 127]
RFC 2543 SIP: Session Initiation Protocol March 1999
As it happens, both Watson at X and a colleague in the other lab at
host Y hear the phones ringing and pick up. Both X and Y return 200s
via the proxy to Bell.
X->P: SIP/2.0 200 OK
Via: SIP/2.0/UDP sip.ieee.org ;branch=3
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org> ;tag=192137601
Call-ID: 31415@c.bell-tel.com
CSeq: 1 INVITE
Contact: sip:t.watson@x.bell-tel.com
Y->P: SIP/2.0 200 OK
Via: SIP/2.0/UDP sip.ieee.org ;branch=4
Via: SIP/2.0/UDP c.bell-tel.com
Contact: sip:t.watson@y.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org> ;tag=35253448
Call-ID: 31415@c.bell-tel.com
CSeq: 1 INVITE
Both responses are forwarded to Bell, using the Via information. At
this point, the ACM server is still searching its database. P can now
cancel this attempt:
P->A: CANCEL sip:watson@acm.org SIP/2.0
Via: SIP/2.0/UDP sip.ieee.org ;branch=2
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>
Call-ID: 31415@c.bell-tel.com
CSeq: 1 CANCEL
The ACM server gladly stops its neural-network database search and
responds with a 200. The 200 will not travel any further, since P is
the last Via stop.
A->P: SIP/2.0 200 OK
Via: SIP/2.0/UDP sip.ieee.org ;branch=2
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>
Handley, et al. Standards Track [Page 128]
RFC 2543 SIP: Session Initiation Protocol March 1999
Call-ID: 31415@c.bell-tel.com
CSeq: 1 CANCEL
Bell gets the two 200 responses from X and Y in short order. Bell's
reaction now depends on his software. He can either send an ACK to
both if human intelligence is needed to determine who he wants to
talk to or he can automatically reject one of the two calls. Here, he
acknowledges both, separately and directly to the final destination:
C->X: ACK sip:t.watson@x.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>;tag=192137601
Call-ID: 31415@c.bell-tel.com
CSeq: 1 ACK
C->Y: ACK sip:watson@y.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>;tag=35253448
Call-ID: 31415@c.bell-tel.com
CSeq: 1 ACK
After a brief discussion between Bell with X and Y, it becomes clear
that Watson is at X. (Note that this is not a three-way call; only
Bell can talk to X and Y, but X and Y cannot talk to each other.)
Thus, Bell sends a BYE to Y, which is replied to:
C->Y: BYE sip:watson@y.bell-tel.com SIP/2.0
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>;tag=35253448
Call-ID: 31415@c.bell-tel.com
CSeq: 2 BYE
Y->C: SIP/2.0 200 OK
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>;tag=35253448
Call-ID: 31415@c.bell-tel.com
CSeq: 2 BYE
Handley, et al. Standards Track [Page 129]
RFC 2543 SIP: Session Initiation Protocol March 1999
16.6 Redirects
Replies with status codes 301 (Moved Permanently) or 302 (Moved
Temporarily) specify another location using the Contact field.
Continuing our earlier example, the server P at ieee.org decides to
redirect rather than proxy the request:
P->C: SIP/2.0 302 Moved temporarily
Via: SIP/2.0/UDP c.bell-tel.com
From: A. Bell <sip:a.g.bell@bell-tel.com>
To: T. Watson <sip:t.watson@ieee.org>;tag=72538263
Call-ID: 31415@c.bell-tel.com
CSeq: 1 INVITE
Contact: sip:watson@h.bell-tel.com,
sip:watson@acm.org, sip:t.watson@x.bell-tel.com,
sip:watson@y.bell-tel.com
CSeq: 1 INVITE
As another example, assume Alice (A) wants to delegate her calls to
Bob (B) while she is on vacation until July 29th, 1998. Any calls
meant for her will reach Bob with Alice's To field, indicating to him
what role he is to play. Charlie (C) calls Alice (A), whose server
returns:
A->C: SIP/2.0 302 Moved temporarily
From: Charlie <sip:charlie@caller.com>
To: Alice <sip:alice@anywhere.com> ;tag=2332462
Call-ID: 27182@caller.com
Contact: sip:bob@anywhere.com
Expires: Wed, 29 Jul 1998 9:00:00 GMT
CSeq: 1 INVITE
Charlie then sends the following request to the SIP server of the
anywhere.com domain. Note that the server at anywhere.com forwards
the request to Bob based on the Request-URI.
C->B: INVITE sip:bob@anywhere.com SIP/2.0
From: sip:charlie@caller.com
To: sip:alice@anywhere.com
Call-ID: 27182@caller.com
CSeq: 2 INVITE
Handley, et al. Standards Track [Page 130]
RFC 2543 SIP: Session Initiation Protocol March 1999
In the third redirection example, we assume that all outgoing
requests are directed through a local firewall F at caller.com, with
Charlie again inviting Alice:
C->F: INVITE sip:alice@anywhere.com SIP/2.0
From: sip:charlie@caller.com
To: Alice <sip:alice@anywhere.com>
Call-ID: 27182@caller.com
CSeq: 1 INVITE
The local firewall at caller.com happens to be overloaded and thus
redirects the call from Charlie to a secondary server S:
F->C: SIP/2.0 302 Moved temporarily
From: sip:charlie@caller.com
To: Alice <sip:alice@anywhere.com>
Call-ID: 27182@caller.com
CSeq: 1 INVITE
Contact: <sip:alice@anywhere.com:5080;maddr=spare.caller.com>
Based on this response, Charlie directs the same invitation to the
secondary server spare.caller.com at port 5080, but maintains the
same Request-URI as before:
C->S: INVITE sip:alice@anywhere.com SIP/2.0
From: sip:charlie@caller.com
To: Alice <sip:alice@anywhere.com>
Call-ID: 27182@caller.com
CSeq: 2 INVITE
16.7 Negotiation
An example of a 606 (Not Acceptable) response is:
S->C: SIP/2.0 606 Not Acceptable
From: sip:mjh@isi.edu
To: <sip:schooler@cs.caltech.edu> ;tag=7434264
Call-ID: 14142@north.east.isi.edu
Handley, et al. Standards Track [Page 131]
RFC 2543 SIP: Session Initiation Protocol March 1999
CSeq: 1 INVITE
Contact: sip:mjh@north.east.isi.edu
Warning: 370 "Insufficient bandwidth (only have ISDN)",
305 "Incompatible media format",
330 "Multicast not available"
Content-Type: application/sdp
Content-Length: 50
v=0
s=Let's talk
b=CT:128
c=IN IP4 north.east.isi.edu
m=audio 3456 RTP/AVP 5 0 7
m=video 2232 RTP/AVP 31
In this example, the original request specified a bandwidth that was
higher than the access link could support, requested multicast, and
requested a set of media encodings. The response states that only 128
kb/s is available and that (only) DVI, PCM or LPC audio could be
supported in order of preference.
The response also states that multicast is not available. In such a
case, it might be appropriate to set up a transcoding gateway and
re-invite the user.
16.8 OPTIONS Request
A caller Alice can use an OPTIONS request to find out the
capabilities of a potential callee Bob, without "ringing" the
designated address. Bob returns a description indicating that he is
capable of receiving audio encodings PCM Ulaw (payload type 0), 1016
(payload type 1), GSM (payload type 3), and SX7300/8000 (dynamic
payload type 99), and video encodings H.261 (payload type 31) and
H.263 (payload type 34).
C->S: OPTIONS sip:bob@example.com SIP/2.0
From: Alice <sip:alice@anywhere.org>
To: Bob <sip:bob@example.com>
Call-ID: 6378@host.anywhere.org
CSeq: 1 OPTIONS
Accept: application/sdp
S->C: SIP/2.0 200 OK
From: Alice <sip:alice@anywhere.org>
To: Bob <sip:bob@example.com> ;tag=376364382
Handley, et al. Standards Track [Page 132]
RFC 2543 SIP: Session Initiation Protocol March 1999
Call-ID: 6378@host.anywhere.org
Content-Length: 81
Content-Type: application/sdp
v=0
m=audio 0 RTP/AVP 0 1 3 99
m=video 0 RTP/AVP 31 34
a=rtpmap:99 SX7300/8000
Handley, et al. Standards Track [Page 133]
RFC 2543 SIP: Session Initiation Protocol March 1999
A Minimal Implementation
A.1 Client
All clients MUST be able to generate the INVITE and ACK requests.
Clients MUST generate and parse the Call-ID, Content-Length,
Content-Type, CSeq, From and To headers. Clients MUST also parse the
Require header. A minimal implementation MUST understand SDP (RFC
2327, [6]). It MUST be able to recognize the status code classes 1
through 6 and act accordingly.
The following capability sets build on top of the minimal
implementation described in the previous paragraph. In general, each
capability listed below builds on the ones above it:
Basic: A basic implementation adds support for the BYE method to
allow the interruption of a pending call attempt. It includes a
User-Agent header in its requests and indicates its preferred
language in the Accept-Language header.
Redirection: To support call forwarding, a client needs to be able to
understand the Contact header, but only the SIP-URL part, not
the parameters.
Firewall-friendly: A firewall-friendly client understands the Route
and Record-Route header fields and can be configured to use a
local proxy for all outgoing requests.
Negotiation: A client MUST be able to request the OPTIONS method and
understand the 380 (Alternative Service) status and the Contact
parameters to participate in terminal and media negotiation. It
SHOULD be able to parse the Warning response header to provide
useful feedback to the caller.
Authentication: If a client wishes to invite callees that require
caller authentication, it MUST be able to recognize the 401
(Unauthorized) status code, MUST be able to generate the
Authorization request header and MUST understand the WWW-
Authenticate response header.
If a client wishes to use proxies that require caller authentication,
it MUST be able to recognize the 407 (Proxy Authentication Required)
status code, MUST be able to generate the Proxy-Authorization request
header and understand the Proxy-Authenticate response header.
Handley, et al. Standards Track [Page 134]
RFC 2543 SIP: Session Initiation Protocol March 1999
A.2 Server
A minimally compliant server implementation MUST understand the
INVITE, ACK, OPTIONS and BYE requests. A proxy server MUST also
understand CANCEL. It MUST parse and generate, as appropriate, the
Call-ID, Content-Length, Content-Type, CSeq, Expires, From, Max-
Forwards, Require, To and Via headers. It MUST echo the CSeq and
Timestamp headers in the response. It SHOULD include the Server
header in its responses.
A.3 Header Processing
Table 6 lists the headers that different implementations support. UAC
refers to a user-agent client (calling user agent), UAS to a user-
agent server (called user-agent).
The fields in the table have the following meaning. Type is as in
Table 4 and 5. "-" indicates the field is not meaningful to this
system (although it might be generated by it). "m" indicates the
field MUST be understood. "b" indicates the field SHOULD be
understood by a Basic implementation. "r" indicates the field SHOULD
be understood if the system claims to understand redirection. "a"
indicates the field SHOULD be understood if the system claims to
support authentication. "e" indicates the field SHOULD be understood
if the system claims to support encryption. "o" indicates support of
the field is purely optional. Headers whose support is optional for
all implementations are not shown.
Handley, et al. Standards Track [Page 135]
RFC 2543 SIP: Session Initiation Protocol March 1999
type UAC proxy UAS registrar
_____________________________________________________
Accept R - o m m
Accept-Encoding R - - m m
Accept-Language R - b b b
Allow 405 o - - -
Authorization R a o a a
Call-ID g m m m m
Content-Encoding g m - m m
Content-Length g m m m m
Content-Type g m - m m
CSeq g m m m m
Encryption g e - e e
Expires g - o o m
From g m o m m
Hide R - m - -
Contact R - - - m
Contact r r r - -
Max-Forwards R - b - -
Proxy-Authenticate 407 a - - -
Proxy-Authorization R - a - -
Proxy-Require R - m - -
Require R m - m m
Response-Key R - - e e
Route R - m - -
Timestamp g o o m m
To g m m m m
Unsupported r b b - -
User-Agent g b - b -
Via g m m m m
WWW-Authenticate 401 a - - -
Table 6: Header Field Processing Requirements
B Usage of the Session Description Protocol (SDP)
This section describes the use of the Session Description Protocol
(SDP) (RFC 2327 [6]).
B.1 Configuring Media Streams
The caller and callee align their media descriptions so that the nth
media stream ("m=" line) in the caller's session description
corresponds to the nth media stream in the callee's description.
Handley, et al. Standards Track [Page 136]
RFC 2543 SIP: Session Initiation Protocol March 1999
All media descriptions SHOULD contain "a=rtpmap" mappings from RTP
payload types to encodings.
This allows easier migration away from static payload
types.
If the callee wants to neither send nor receive a stream offered by
the caller, the callee sets the port number of that stream to zero in
its media description.
There currently is no other way than port zero for the
callee to refuse a bidirectional stream offered by the
caller. Both caller and callee need to be aware what media
tools are to be started.
For example, assume that the caller Alice has included the following
description in her INVITE request. It includes an audio stream and
two bidirectional video streams, using H.261 (payload type 31) and
MPEG (payload type 32).
v=0
o=alice 2890844526 2890844526 IN IP4 host.anywhere.com
c=IN IP4 host.anywhere.com
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 51372 RTP/AVP 31
a=rtpmap:31 H261/90000
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000
The callee, Bob, does not want to receive or send the first video
stream, so it returns the media description below:
v=0
o=bob 2890844730 2890844730 IN IP4 host.example.com
c=IN IP4 host.example.com
m=audio 47920 RTP/AVP 0 1
a=rtpmap:0 PCMU/8000
a=rtpmap:1 1016/8000
m=video 0 RTP/AVP 31
m=video 53000 RTP/AVP 32
a=rtpmap:32 MPV/90000
Handley, et al. Standards Track [Page 137]
RFC 2543 SIP: Session Initiation Protocol March 1999
B.2 Setting SDP Values for Unicast
If a session description from a caller contains a media stream which
is listed as send (receive) only, it means that the caller is only
willing to send (receive) this stream, not receive (send). The same
is true for the callee.
For receive-only and send-or-receive streams, the port number and
address in the session description indicate where the media stream
should be sent to by the recipient of the session description, either
caller or callee. For send-only streams, the address and port number
have no significance and SHOULD be set to zero.
The list of payload types for each media stream conveys two pieces of
information, namely the set of codecs that the caller or callee is
capable of sending or receiving, and the RTP payload type numbers
used to identify those codecs. For receive-only or send-and-receive
media streams, a caller SHOULD list all of the codecs it is capable
of supporting in the session description in an INVITE or ACK. For
send-only streams, the caller SHOULD indicate only those it wishes to
send for this session. For receive-only streams, the payload type
numbers indicate the value of the payload type field in RTP packets
the caller is expecting to receive for that codec type. For send-only
streams, the payload type numbers indicate the value of the payload
type field in RTP packets the caller is planning to send for that
codec type. For send-and-receive streams, the payload type numbers
indicate the value of the payload type field the caller expects to
both send and receive.
If a media stream is listed as receive-only by the caller, the callee
lists, in the response, those codecs it intends to use from among the
ones listed in the request. If a media stream is listed as send-only
by the caller, the callee lists, in the response, those codecs it is
willing to receive among the ones listed in the the request. If the
media stream is listed as both send and receive, the callee lists
those codecs it is capable of sending or receiving among the ones
listed by the caller in the INVITE. The actual payload type numbers
in the callee's session description corresponding to a particular
codec MUST be the same as the caller's session description.
If caller and callee have no media formats in common for a particular
stream, the callee MUST return a session description containing the
particular "m=" line, but with the port number set to zero, and no
payload types listed.
If there are no media formats in common for all streams, the callee
SHOULD return a 400 response, with a 304 Warning header field.
Handley, et al. Standards Track [Page 138]
RFC 2543 SIP: Session Initiation Protocol March 1999
B.3 Multicast Operation
The interpretation of send-only and receive-only for multicast media
sessions differs from that for unicast sessions. For multicast,
send-only means that the recipient of the session description (caller
or callee) SHOULD only send media streams to the address and port
indicated. Receive-only means that the recipient of the session
description SHOULD only receive media on the address and port
indicated.
For multicast, receive and send multicast addresses are the same and
all parties use the same port numbers to receive media data. If the
session description provided by the caller is acceptable to the
callee, the callee can choose not to include a session description or
MAY echo the description in the response.
A callee MAY, in the response, return a session description with some
of the payload types removed, or port numbers set to zero (but no
other value). This indicates to the caller that the callee does not
support the given stream or media types which were removed. A callee
MUST NOT change whether a given stream is send-only, receive-only, or
send-and-receive.
If a callee does not support multicast at all, it SHOULD return a 400
status response and include a 330 Warning.
B.4 Delayed Media Streams
In some cases, a caller may not know the set of media formats which
it can support at the time it would like to issue an invitation. This
is the case when the caller is actually a gateway to another protocol
which performs media format negotiation after call setup. When this
occurs, a caller MAY issue an INVITE with a session description that
contains no media lines. The callee SHOULD interpret this to mean
that the caller wishes to participate in a multimedia session
described by the session description, but that the media streams are
not yet known. The callee SHOULD return a session description
indicating the streams and media formats it is willing to support,
however. The caller MAY update the session description either in the
ACK request or in a re-INVITE at a later time, once the streams are
known.
B.5 Putting Media Streams on Hold
If a party in a call wants to put the other party "on hold", i.e.,
request that it temporarily stops sending one or more media streams,
a party re-invites the other by sending an INVITE request with a
modified session description. The session description is the same as
Handley, et al. Standards Track [Page 139]
RFC 2543 SIP: Session Initiation Protocol March 1999
in the original invitation (or response), but the "c" destination
addresses for the media streams to be put on hold are set to zero
(0.0.0.0).
B.6 Subject and SDP "s=" Line
The SDP "s=" line and the SIP Subject header field have different
meanings when inviting to a multicast session. The session
description line describes the subject of the multicast session,
while the SIP Subject header field describes the reason for the
invitation. The example in Section 16.2 illustrates this point. For
invitations to two-party sessions, the SDP "s=" line MAY be left
empty.
B.7 The SDP "o=" Line
The "o=" line is not strictly necessary for two-party sessions, but
MUST be present to allow re-use of SDP-based tools.
Handley, et al. Standards Track [Page 140]
RFC 2543 SIP: Session Initiation Protocol March 1999
C Summary of Augmented BNF
All of the mechanisms specified in this document are described in
both prose and an augmented Backus-Naur Form (BNF) similar to that
used by RFC 822 [9]. Implementors will need to be familiar with the
notation in order to understand this specification. The augmented BNF
includes the following constructs:
name = definition
The name of a rule is simply the name itself (without any enclosing
"<" and ">") and is separated from its definition by the equal "="
character. White space is only significant in that indentation of
continuation lines is used to indicate a rule definition that spans
more than one line. Certain basic rules are in uppercase, such as SP,
LWS, HT, CRLF, DIGIT, ALPHA, etc. Angle brackets are used within
definitions whenever their presence will facilitate discerning the
use of rule names.
"literal"
Quotation marks surround literal text. Unless stated otherwise, the
text is case-insensitive.
rule1 | rule2
Elements separated by a bar ("|") are alternatives, e.g., "yes | no"
will accept yes or no.
(rule1 rule2)
Elements enclosed in parentheses are treated as a single element.
Thus, "(elem (foo | bar) elem)" allows the token sequences "elem foo
elem" and "elem bar elem".
Handley, et al. Standards Track [Page 141]
RFC 2543 SIP: Session Initiation Protocol March 1999
*rule
The character "*" preceding an element indicates repetition. The full
form is "<n>*<m>element" indicating at least <n> and at most <m>
occurrences of element. Default values are 0 and infinity so that
"*(element)" allows any number, including zero; "1*element" requires
at least one; and "1*2element" allows one or two.
[rule]
Square brackets enclose optional elements; "[foo bar]" is equivalent
to "*1(foo bar)".
N rule
Specific repetition: "<n>(element)" is equivalent to
"<n>*<n>(element)"; that is, exactly <n> occurrences of (element).
Thus 2DIGIT is a 2-digit number, and 3ALPHA is a string of three
alphabetic characters.
#rule
A construct "#" is defined, similar to "*", for defining lists of
elements. The full form is "<n>#<m> element" indicating at least <n>
and at most <m> elements, each separated by one or more commas (",")
and OPTIONAL linear white space (LWS). This makes the usual form of
lists very easy; a rule such as
( *LWS element *( *LWS "," *LWS element ))
can be shown as 1# element. Wherever this construct is used, null
elements are allowed, but do not contribute to the count of elements
present. That is, "(element), , (element)" is permitted, but counts
as only two elements. Therefore, where at least one element is
required, at least one non-null element MUST be present. Default
values are 0 and infinity so that "#element" allows any number,
including zero; "1#element" requires at least one; and "1#2element"
allows one or two.
Handley, et al. Standards Track [Page 142]
RFC 2543 SIP: Session Initiation Protocol March 1999
; comment
A semi-colon, set off some distance to the right of rule text, starts
a comment that continues to the end of line. This is a simple way of
including useful notes in parallel with the specifications.
implied *LWS
The grammar described by this specification is word-based. Except
where noted otherwise, linear white space (LWS) can be included
between any two adjacent words (token or quoted-string), and between
adjacent tokens and separators, without changing the interpretation
of a field. At least one delimiter (LWS and/or separators) MUST exist
between any two tokens (for the definition of "token" below), since
they would otherwise be interpreted as a single token.
C.1 Basic Rules
The following rules are used throughout this specification to
describe basic parsing constructs. The US-ASCII coded character set
is defined by ANSI X3.4-1986.
OCTET = <any 8-bit sequence of data>
CHAR = <any US-ASCII character (octets 0 - 127)>
upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" |
"J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" |
"S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"
lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" |
"j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" |
"s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"
alpha = lowalpha | upalpha
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
"8" | "9"
alphanum = alpha | digit
CTL = <any US-ASCII control character
(octets 0 -- 31) and DEL (127)>
CR = %d13 ; US-ASCII CR, carriage return character
LF = %d10 ; US-ASCII LF, line feed character
SP = %d32 ; US-ASCII SP, space character
HT = %d09 ; US-ASCII HT, horizontal tab character
CRLF = CR LF ; typically the end of a line
The following are defined in RFC 2396 [12] for the SIP URI:
Handley, et al. Standards Track [Page 143]
RFC 2543 SIP: Session Initiation Protocol March 1999
unreserved = alphanum | mark
mark = "-" | "_" | "." | "!" | "~" | "*" | "'"
| "(" | ")"
escaped = "%" hex hex
SIP header field values can be folded onto multiple lines if the
continuation line begins with a space or horizontal tab. All linear
white space, including folding, has the same semantics as SP. A
recipient MAY replace any linear white space with a single SP before
interpreting the field value or forwarding the message downstream.
LWS = [CRLF] 1*( SP | HT ) ; linear whitespace
The TEXT-UTF8 rule is only used for descriptive field contents and
values that are not intended to be interpreted by the message parser.
Words of *TEXT-UTF8 contain characters from the UTF-8 character set
(RFC 2279 [21]). In this regard, SIP differs from HTTP, which uses
the ISO 8859-1 character set.
TEXT-UTF8 = <any UTF-8 character encoding, except CTLs,
but including LWS>
A CRLF is allowed in the definition of TEXT-UTF8 only as part of a
header field continuation. It is expected that the folding LWS will
be replaced with a single SP before interpretation of the TEXT-UTF8
value.
Hexadecimal numeric characters are used in several protocol elements.
hex = "A" | "B" | "C" | "D" | "E" | "F"
| "a" | "b" | "c" | "d" | "e" | "f" | digit
Many SIP header field values consist of words separated by LWS or
special characters. These special characters MUST be in a quoted
string to be used within a parameter value.
Handley, et al. Standards Track [Page 144]
RFC 2543 SIP: Session Initiation Protocol March 1999
token = 1*< any CHAR except CTL's or separators>
separators = "(" | ")" | "<" | ">" | "@" |
"," | ";" | ":" | "\" | <"> |
"/" | "[" | "]" | "?" | "=" |
"{" | "}" | SP | HT
Comments can be included in some SIP header fields by surrounding the
comment text with parentheses. Comments are only allowed in fields
containing "comment" as part of their field value definition. In all
other fields, parentheses are considered part of the field value.
comment = "(" *(ctext | quoted-pair | comment) ")"
ctext = < any TEXT-UTF8 excluding "(" and ")">
A string of text is parsed as a single word if it is quoted using
double-quote marks.
quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
qdtext = <any TEXT-UTF8 except <">>
The backslash character ("\") MAY be used as a single-character
quoting mechanism only within quoted-string and comment constructs.
quoted-pair = " \ " CHAR
Handley, et al. Standards Track [Page 145]
RFC 2543 SIP: Session Initiation Protocol March 1999
D Using SRV DNS Records
The following procedure is experimental and relies on DNS SRV records
(RFC 2052 [14]). The steps listed below are used in place of the two
steps in section 1.4.2.
If a step elicits no addresses, the client continues to the next
step. However if a step elicits one or more addresses, but no SIP
server at any of those addresses responds, then the client concludes
the server is down and doesn't continue on to the next step.
When SRV records are to be used, the protocol to use when querying
for the SRV record is "sip". SRV records contain port numbers for
servers, in addition to IP addresses; the client always uses this
port number when contacting the SIP server. Otherwise, the port
number in the SIP URI is used, if present. If there is no port number
in the URI, the default port, 5060, is used.
1. If the host portion of the Request-URI is an IP address,
the client contacts the server at the given address. If the
host portion of the Request-URI is not an IP address, the
client proceeds to the next step.
2. The Request-URI is examined. If it contains an explicit
port number, the next two steps are skipped.
3. The Request-URI is examined. If it does not specify a
protocol (TCP or UDP), the client queries the name server
for SRV records for both UDP (if supported by the client)
and TCP (if supported by the client) SIP servers. The
format of these queries is defined in RFC 2052 [14]. The
results of the query or queries are merged together and
ordered based on priority. Then, the searching technique
outlined in RFC 2052 [14] is used to select servers in
order. If DNS doesn't return any records, the user goes to
the last step. Otherwise, the user attempts to contact
each server in the order listed. If no server is
contacted, the user gives up.
4. If the Request-URI specifies a protocol (TCP or UDP) that
is supported by the client, the client queries the name
server for SRV records for SIP servers of that protocol
type only. If the client does not support the protocol
specified in the Request-URI, it gives up. The searching
technique outlined in RFC 2052 [14] is used to select
servers from the DNS response in order. If DNS doesn't
Handley, et al. Standards Track [Page 146]
RFC 2543 SIP: Session Initiation Protocol March 1999
return any records, the user goes to the last step.
Otherwise, the user attempts to contact each server in the
order listed. If no server is contacted, the user gives up.
5. The client queries the name server for address records for
the host portion of the Request-URI. If there were no
address records, the client stops, as it has been unable to
locate a server. By address record, we mean A RR's, AAAA
RR's, or their most modern equivalent.
A client MAY cache a successful DNS query result. A successful query
is one which contained records in the answer, and a server was
contacted at one of the addresses from the answer. When the client
wishes to send a request to the same host, it starts the search as if
it had just received this answer from the name server. The server
uses the procedures specified in RFC1035 [15] regarding cache
invalidation when the time-to-live of the DNS result expires. If the
client does not find a SIP server among the addresses listed in the
cached answer, it starts the search at the beginning of the sequence
described above.
For example, consider a client that wishes to send a SIP request. The
Request-URI for the destination is sip:user@company.com. The client
only supports UDP. It would follow these steps:
1. The host portion is not an IP address, so the client goes
to step 2 above.
2. The client does a DNS query of QNAME="sip.udp.company.com",
QCLASS=IN, QTYPE=SRV. Since it doesn't support TCP, it
omits the TCP query. There were no addresses in the DNS
response, so the client goes to the next step.
3. The client does a DNS query for A records for
"company.com". An address is found, so that client attempts
to contact a server at that address at port 5060.
Handley, et al. Standards Track [Page 147]
RFC 2543 SIP: Session Initiation Protocol March 1999
E IANA Considerations
Section 4.4 describes a name space and mechanism for registering SIP
options.
Section 6.41 describes the name space for registering SIP warn-codes.
Handley, et al. Standards Track [Page 148]
RFC 2543 SIP: Session Initiation Protocol March 1999
F Acknowledgments
We wish to thank the members of the IETF MMUSIC WG for their comments
and suggestions. Detailed comments were provided by Anders
Kristensen, Jim Buller, Dave Devanathan, Yaron Goland, Christian
Huitema, Gadi Karmi, Jonathan Lennox, Keith Moore, Vern Paxson, Moshe
J. Sambol, and Eric Tremblay.
This work is based, inter alia, on [37,38].
G Authors' Addresses
Mark Handley
AT&T Center for Internet Research at ISCI (ACIRI)
1947 Center St., Suite 600
Berkeley, CA 94704-119
USA
Email: mjh@aciri.org
Henning Schulzrinne
Dept. of Computer Science
Columbia University
1214 Amsterdam Avenue
New York, NY 10027
USA
Email: schulzrinne@cs.columbia.edu
Eve Schooler
Computer Science Department 256-80
California Institute of Technology
Pasadena, CA 91125
USA
Email: schooler@cs.caltech.edu
Jonathan Rosenberg
Lucent Technologies, Bell Laboratories
Rm. 4C-526
101 Crawfords Corner Road
Holmdel, NJ 07733
USA
Email: jdrosen@bell-labs.com
Handley, et al. Standards Track [Page 149]
RFC 2543 SIP: Session Initiation Protocol March 1999
H Bibliography
[1] Pandya, R., "Emerging mobile and personal communication systems,"
IEEE Communications Magazine , vol. 33, pp. 44--52, June 1995.
[2] Braden, B., Zhang, L., Berson, S., Herzog, S. and S. Jamin,
"Resource ReSerVation protocol (RSVP) -- version 1 functional
specification", RFC 2205, October 1997.
[3] Schulzrinne, H., Casner, S., Frederick, R. and V. Jacobson, "RTP:
a transport protocol for real-time applications", RFC 1889,
Internet Engineering Task Force, Jan. 1996.
[4] Schulzrinne, H., Lanphier, R. and A. Rao, "Real time streaming
protocol (RTSP)", RFC 2326, April 1998.
[5] Handley, M., "SAP: Session announcement protocol," Internet
Draft, Internet Engineering Task Force, Nov. 1996. Work in
progress.
[6] Handley, M. and V. Jacobson, "SDP: session description protocol",
RFC 2327, April 1998.
[7] International Telecommunication Union, "Visual telephone systems
and equipment for local area networks which provide a non-
guaranteed quality of service," Recommendation H.323,
Telecommunication Standardization Sector of ITU, Geneva,
Switzerland, May 1996.
[8] International Telecommunication Union, "Control protocol for
multimedia communication," Recommendation H.245,
Telecommunication Standardization Sector of ITU, Geneva,
Switzerland, Feb. 1998.
[9] International Telecommunication Union, "Media stream
packetization and synchronization on non-guaranteed quality of
service LANs," Recommendation H.225.0, Telecommunication
Standardization Sector of ITU, Geneva, Switzerland, Nov. 1996.
[10] Bradner, S., "Key words for use in RFCs to indicate requirement
levels", BCP 14, RFC 2119, Mardch 1997.
[11] Fielding, R., Gettys, J., Mogul, J., Nielsen, H. and T.
Berners-Lee, "Hypertext transfer protocol -- HTTP/1.1", RFC
2068, January 1997.
[12] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform resource
identifiers (URI): generic syntax", RFC 2396, August 1998.
Handley, et al. Standards Track [Page 150]
RFC 2543 SIP: Session Initiation Protocol March 1999
[13] Berners-Lee, T., Masinter, L. and M. McCahill, "Uniform resource
locators (URL)", RFC 1738, December 1994.
[14] Gulbrandsen, A. and P. Vixie, "A DNS RR for specifying the
location of services (DNS SRV)", RFC 2052, October 1996.
[15] Mockapetris, P., "Domain names - implementation and
specification", STD 13, RFC 1035, Noveberm 1997.
[16] Hamilton, M. and R. Wright, "Use of DNS aliases for network
services", RFC 2219, October 1997.
[17] Zimmerman, D., "The finger user information protocol", RFC 1288,
December 1991.
[18] Williamson, S., Kosters, M., Blacka, D., Singh, J. and K.
Zeilstra, "Referral whois (rwhois) protocol V1.5", RFC 2167,
June 1997.
[19] Yeong, W., Howes, T. and S. Kille, "Lightweight directory access
protocol", RFC 1777, March 1995.
[20] Schooler, E., "A multicast user directory service for
synchronous rendezvous," Master's Thesis CS-TR-96-18, Department
of Computer Science, California Institute of Technology,
Pasadena, California, Aug. 1996.
[21] Yergeau, F., "UTF-8, a transformation format of ISO 10646", RFC
2279, January 1998.
[22] Stevens, W., TCP/IP illustrated: the protocols , vol. 1.
Reading, Massachusetts: Addison-Wesley, 1994.
[23] Mogul, J. and S. Deering, "Path MTU discovery", RFC 1191,
November 1990.
[24] Crocker, D., "Standard for the format of ARPA internet text
messages", RFC STD 11, RFC 822, August 1982.
[25] Meyer, D., "Administratively scoped IP multicast", RFC 2365,
July 1998.
[26] Schulzrinne, H., "RTP profile for audio and video conferences
with minimal control", RFC 1890, January 1996
[27] Eastlake, D., Crocker, S. and J. Schiller, "Randomness
recommendations for security", RFC 1750, December 1994.
Handley, et al. Standards Track [Page 151]
RFC 2543 SIP: Session Initiation Protocol March 1999
[28] Hoffman, P., Masinter, L. and J. Zawinski, "The mailto URL
scheme", RFC 2368, July 1998.
[29] Braden, B., "Requirements for internet hosts - application and
support", STD 3, RFC 1123, October 1989.
[30] Palme, J., "Common internet message headers", RFC 2076, February
1997.
[31] Alvestrand, H., "IETF policy on character sets and languages",
RFC 2277, January 1998.
[32] Elkins, M., "MIME security with pretty good privacy (PGP)", RFC
2015, October 1996.
[33] Atkins, D., Stallings, W. and P. Zimmermann, "PGP message
exchange formats", RFC 1991, August 1996.
[34] Atkinson, R., "Security architecture for the internet protocol",
RFC 2401, November 1998.
[35] Allen, C. and T. Dierks, "The TLS protocol version 1.0," RFC
2246, January 1999.
[36] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, S.,
Leach, P., Luotonen, A. and L. Stewart, "HTTP authentication:
Basic and digest access authentication," Internet Draft,
Internet Engineering Task Force, Sept. 1998. Work in progress.
[37] Schooler, E., "Case study: multimedia conference control in a
packet-switched teleconferencing system," Journal of
Internetworking: Research and Experience , vol. 4, pp. 99--120,
June 1993. ISI reprint series ISI/RS-93-359.
[38] Schulzrinne, H., "Personal mobility for multimedia services in
the Internet," in European Workshop on Interactive Distributed
Multimedia Systems and Services (IDMS) , (Berlin, Germany), Mar.
1996.
Handley, et al. Standards Track [Page 152]
RFC 2543 SIP: Session Initiation Protocol March 1999
Full Copyright Statement
Copyright (C) The Internet Society (1999). All Rights Reserved.
This document and translations of it may be copied and furnished to
others, and derivative works that comment on or otherwise explain it
or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any
kind, provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be
revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Handley, et al. Standards Track [Page 153]
|