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
|
dialog Module
Bogdan-Andrei Iancu
Voice Sistem SRL
Carsten Bock
ng-voice.com
Edited by
Bogdan-Andrei Iancu
Edited by
Carsten Bock
Edited by
Alex Balashov
<abalashov@evaristesys.com>
Copyright 2006 Voice Sistem SRL
Copyright 2011 Carsten Bock, http://www.ng-voice.com
__________________________________________________________________
Table of Contents
1. Admin Guide
1. Overview
2. How it works
3. Dialog profiling
4. Dependencies
4.1. Kamailio Modules
4.2. External Libraries or Applications
5. Parameters
5.1. enable_stats (integer)
5.2. hash_size (integer)
5.3. rr_param (string)
5.4. dlg_flag (integer)
5.5. timeout_avp (string)
5.6. default_timeout (integer)
5.7. dlg_extra_hdrs (string)
5.8. dlg_match_mode (integer)
5.9. detect_spirals (integer)
5.10. db_url (string)
5.11. db_mode (integer)
5.12. db_update_period (integer)
5.13. db_fetch_rows (integer)
5.14. table_name (string)
5.15. callid_column (string)
5.16. from_uri_column (string)
5.17. from_tag_column (string)
5.18. to_uri_column (string)
5.19. to_tag_column (string)
5.20. from_cseq_column (string)
5.21. to_cseq_column (string)
5.22. from_route_column (string)
5.23. to_route_column (string)
5.24. from_contact_column (string)
5.25. to_contact_column (string)
5.26. from_sock_column (string)
5.27. to_sock_column (string)
5.28. h_id_column (string)
5.29. h_entry_column (string)
5.30. state_column (string)
5.31. start_time_column (string)
5.32. timeout_column (string)
5.33. sflags_column (string)
5.34. toroute_column (string)
5.35. vars_table_name (string)
5.36. vars_h_id_column (string)
5.37. vars_h_entry_column (string)
5.38. vars_key_column (string)
5.39. vars_value_column (string)
5.40. profiles_with_value (string)
5.41. profiles_no_value (string)
5.42. bridge_controller (string)
5.43. bridge_contact (string)
5.44. initial_cbs_inscript (int)
5.45. send_bye (int)
5.46. wait_ack (int)
5.47. ka_timer (int)
5.48. ka_interval (int)
5.49. timeout_noreset (int)
5.50. timer_procs (int)
5.51. track_cseq_updates (int)
6. Functions
6.1. set_dlg_profile(profile,[value])
6.2. unset_dlg_profile(profile,[value])
6.3. is_in_profile(profile,[value])
6.4. get_profile_size(profile,[value],size)
6.5. dlg_isflagset(flag)
6.6. dlg_setflag(flag)
6.7. dlg_resetflag(flag)
6.8. dlg_bye(side)
6.9. dlg_refer(side, address)
6.10. dlg_manage()
6.11. dlg_bridge(from, to, op)
6.12. dlg_get(callid, ftag, ttag)
6.13. is_known_dlg()
6.14. dlg_set_timeout(timeout [, h_entry, h_id])
6.15. dlg_set_timeout_by_profile(profile, [value], timeout)
6.16. dlg_set_property(attr)
6.17. dlg_remote_profile(cmd, profile, value, uid, expires)
7. Statistics
7.1. active_dialogs
7.2. early_dialogs
7.3. processed_dialogs
7.4. expired_dialogs
7.5. failed_dialogs
8. MI Commands
8.1. dlg_list
8.2. dlg_list_ctx
8.3. dlg_end_dlg
8.4. dlg_terminate_dlg
8.5. profile_get_size
8.6. profile_list_dlgs
8.7. dlg_bridge
9. Exported RPC Functions
9.1. dlg.list
9.2. dlg.list_ctx
9.3. dlg.dlg_list
9.4. dlg.dlg_list_ctx
9.5. dlg.end_dlg
9.6. dlg.profile_get_size
9.7. dlg.profile_list
9.8. dlg.bridge_dlg
10. Exported pseudo-variables
10.1. $DLG_count
10.2. $DLG_status
10.3. $DLG_lifetime
10.4. $dlg(...)
10.5. $dlg_ctx(...)
10.6. $dlg_var(key)
11. Event Routes
11.1. event_route[dialog:start]
11.2. event_route[dialog:end]
11.3. event_route[dialog:failed]
2. Developer Guide
1. Available Functions
1.1. register_dlgcb (dialog, type, cb, param, free_param_cb)
1.2. terminate_dlg (dlg, hdrs)
3. Frequently Asked Questions
List of Examples
1.1. Set enable_stats parameter
1.2. Set hash_size parameter
1.3. Set rr_param parameter
1.4. Set dlg_flag parameter
1.5. Set timeout_avp parameter
1.6. Set default_timeout parameter
1.7. Set dlf_extra_hdrs parameter
1.8. Set dlg_match_mode parameter
1.9. Set detect_spirals parameter
1.10. Set db_url parameter
1.11. Set db_mode parameter
1.12. Set db_update_period parameter
1.13. Set db_fetch_rows parameter
1.14. Set table_name parameter
1.15. Set callid_column parameter
1.16. Set from_uri_column parameter
1.17. Set from_tag_column parameter
1.18. Set to_uri_column parameter
1.19. Set to_tag_column parameter
1.20. Set from_cseq_column parameter
1.21. Set to_cseq_column parameter
1.22. Set from_route_column parameter
1.23. Set to_route_column parameter
1.24. Set from_contact_column parameter
1.25. Set to_contact_column parameter
1.26. Set from_sock_column parameter
1.27. Set to_sock_column parameter
1.28. Set h_id_column parameter
1.29. Set h_entry_column parameter
1.30. Set state_column parameter
1.31. Set start_time_column parameter
1.32. Set timeout_column parameter
1.33. Set sflags_column parameter
1.34. Set toroute_column parameter
1.35. Set vars_table_name parameter
1.36. Set vars_h_id_column parameter
1.37. Set vars_h_entry_column parameter
1.38. Set vars_key_column parameter
1.39. Set vars_value_column parameter
1.40. Set profiles_with_value parameter
1.41. Set profiles_no_value parameter
1.42. Set bridge_controller parameter
1.43. Set bridge_contact parameter
1.44. Set initial_cbs_inscript parameter
1.45. Set send_bye parameter
1.46. Set wait_ack parameter
1.47. Set ka_timer parameter
1.48. Set ka_interval parameter
1.49. Set timeout_noreset parameter
1.50. Set timer_procs parameter
1.51. Set track_cseq_updates parameter
1.52. set_dlg_profile usage
1.53. unset_dlg_profile usage
1.54. is_in_profile usage
1.55. get_profile_size usage
1.56. dlg_isflagset usage
1.57. dlg_setflag usage
1.58. dlg_resetflag usage
1.59. dlg_bye usage
1.60. dlg_refer usage
1.61. dlg_manage usage
1.62. dlg_bridge usage
1.63. dlg_get usage
1.64. is_known_dlg() usage
1.65. dlg_set_timeout usage
1.66. dlg_set_timeout_by_profile usage
1.67. dlg_set_property usage
1.68. dlg_remote_profile usage
Chapter 1. Admin Guide
Table of Contents
1. Overview
2. How it works
3. Dialog profiling
4. Dependencies
4.1. Kamailio Modules
4.2. External Libraries or Applications
5. Parameters
5.1. enable_stats (integer)
5.2. hash_size (integer)
5.3. rr_param (string)
5.4. dlg_flag (integer)
5.5. timeout_avp (string)
5.6. default_timeout (integer)
5.7. dlg_extra_hdrs (string)
5.8. dlg_match_mode (integer)
5.9. detect_spirals (integer)
5.10. db_url (string)
5.11. db_mode (integer)
5.12. db_update_period (integer)
5.13. db_fetch_rows (integer)
5.14. table_name (string)
5.15. callid_column (string)
5.16. from_uri_column (string)
5.17. from_tag_column (string)
5.18. to_uri_column (string)
5.19. to_tag_column (string)
5.20. from_cseq_column (string)
5.21. to_cseq_column (string)
5.22. from_route_column (string)
5.23. to_route_column (string)
5.24. from_contact_column (string)
5.25. to_contact_column (string)
5.26. from_sock_column (string)
5.27. to_sock_column (string)
5.28. h_id_column (string)
5.29. h_entry_column (string)
5.30. state_column (string)
5.31. start_time_column (string)
5.32. timeout_column (string)
5.33. sflags_column (string)
5.34. toroute_column (string)
5.35. vars_table_name (string)
5.36. vars_h_id_column (string)
5.37. vars_h_entry_column (string)
5.38. vars_key_column (string)
5.39. vars_value_column (string)
5.40. profiles_with_value (string)
5.41. profiles_no_value (string)
5.42. bridge_controller (string)
5.43. bridge_contact (string)
5.44. initial_cbs_inscript (int)
5.45. send_bye (int)
5.46. wait_ack (int)
5.47. ka_timer (int)
5.48. ka_interval (int)
5.49. timeout_noreset (int)
5.50. timer_procs (int)
5.51. track_cseq_updates (int)
6. Functions
6.1. set_dlg_profile(profile,[value])
6.2. unset_dlg_profile(profile,[value])
6.3. is_in_profile(profile,[value])
6.4. get_profile_size(profile,[value],size)
6.5. dlg_isflagset(flag)
6.6. dlg_setflag(flag)
6.7. dlg_resetflag(flag)
6.8. dlg_bye(side)
6.9. dlg_refer(side, address)
6.10. dlg_manage()
6.11. dlg_bridge(from, to, op)
6.12. dlg_get(callid, ftag, ttag)
6.13. is_known_dlg()
6.14. dlg_set_timeout(timeout [, h_entry, h_id])
6.15. dlg_set_timeout_by_profile(profile, [value], timeout)
6.16. dlg_set_property(attr)
6.17. dlg_remote_profile(cmd, profile, value, uid, expires)
7. Statistics
7.1. active_dialogs
7.2. early_dialogs
7.3. processed_dialogs
7.4. expired_dialogs
7.5. failed_dialogs
8. MI Commands
8.1. dlg_list
8.2. dlg_list_ctx
8.3. dlg_end_dlg
8.4. dlg_terminate_dlg
8.5. profile_get_size
8.6. profile_list_dlgs
8.7. dlg_bridge
9. Exported RPC Functions
9.1. dlg.list
9.2. dlg.list_ctx
9.3. dlg.dlg_list
9.4. dlg.dlg_list_ctx
9.5. dlg.end_dlg
9.6. dlg.profile_get_size
9.7. dlg.profile_list
9.8. dlg.bridge_dlg
10. Exported pseudo-variables
10.1. $DLG_count
10.2. $DLG_status
10.3. $DLG_lifetime
10.4. $dlg(...)
10.5. $dlg_ctx(...)
10.6. $dlg_var(key)
11. Event Routes
11.1. event_route[dialog:start]
11.2. event_route[dialog:end]
11.3. event_route[dialog:failed]
1. Overview
Kamailio can behave as a stateful proxy through the TM module. However,
"stateful" in this context refers to transaction state, not dialog
state. Certain applications benefit from the proxy's awareness of
"calls", not just SIP transactions.
For example, a common need is to limit the number of calls that can be
made concurrently by an endpoint, account, user group, etc. In order to
count the number of calls in progress, it is necessary for the proxy to
be aware of whole dialogs, not just transactions, and to provide some
means of programmatically classifying these dialogs. This is just one
common application discussed for illustrative purposes; there are many
others.
The dialog module provides dialog awareness for the Kamailio proxy. Its
functionality is to keep track of the current dialogs, to offer
information about them (e.g. how many dialogs are active), and to
manage various characteristics of dialogs. The module exports several
functions that could be used directly from the configuration route
script.
This module also provides a foundational API on which to build more
complex dialog-oriented functionality in other Kamailio modules.
2. How it works
To create the dialog associated with an initial request, the flag
"dlg_flag" (Section 5.4, "dlg_flag (integer)") must be set before
creating the corresponding transaction.
The dialog is automatically destroyed when a "BYE" is received. In case
of no "BYE", the dialog lifetime is controlled via the default timeout
(see "default_timeout" - Section 5.6, "default_timeout (integer)") and
custom timeout (see "timeout_avp" - Section 5.5, "timeout_avp
(string)"). The dialog timeout is reset each time a sequential request
is processed.
3. Dialog profiling
Dialog profiling is a mechanism that helps in classifying, sorting and
keeping track of certain types of dialogs. The classification criteria
can be any attributes desired by the user; they can come from SIP
message attributes, other pseudo-variables, custom values, etc. Dialogs
can be dynamically added into one or more profile tables. Logically,
each profile table can have a special meaning (like dialogs outside the
domain, dialogs terminated to the PSTN, etc.).
There are two types of profiles:
* with no value - a dialog simply belongs to a profile (for instance,
an outbound calls profile). There is no other additional
information to describe the dialog beyond its membership in the
profile per se.
* with value - a dialog belongs to a profile having a certain value
(like in a caller profile, where the value is the caller ID). The
membership of the dialog in the profile is strictly related to the
value. For example, if the account ID of the caller is stored in
the pseudo-variable $var(account_id), you can use $var(account_id)
as a value/key by which to group dialogs so that you can count the
number of open dialogs for each account, enforce concurrent call
limits as necessary, etc.
A dialog can be added to multiple profiles at the same time.
Profiles are visible (at the moment) in the request route (for initial
and sequential requests) and in the branch, failure and reply routes of
the original request.
4. Dependencies
4.1. Kamailio Modules
4.2. External Libraries or Applications
4.1. Kamailio Modules
The following modules must be loaded before this module:
* TM - Transaction module
* RR - Record-Route module
4.2. External Libraries or Applications
The following libraries or applications must be installed before
running Kamailio with this module loaded:
* None.
5. Parameters
5.1. enable_stats (integer)
5.2. hash_size (integer)
5.3. rr_param (string)
5.4. dlg_flag (integer)
5.5. timeout_avp (string)
5.6. default_timeout (integer)
5.7. dlg_extra_hdrs (string)
5.8. dlg_match_mode (integer)
5.9. detect_spirals (integer)
5.10. db_url (string)
5.11. db_mode (integer)
5.12. db_update_period (integer)
5.13. db_fetch_rows (integer)
5.14. table_name (string)
5.15. callid_column (string)
5.16. from_uri_column (string)
5.17. from_tag_column (string)
5.18. to_uri_column (string)
5.19. to_tag_column (string)
5.20. from_cseq_column (string)
5.21. to_cseq_column (string)
5.22. from_route_column (string)
5.23. to_route_column (string)
5.24. from_contact_column (string)
5.25. to_contact_column (string)
5.26. from_sock_column (string)
5.27. to_sock_column (string)
5.28. h_id_column (string)
5.29. h_entry_column (string)
5.30. state_column (string)
5.31. start_time_column (string)
5.32. timeout_column (string)
5.33. sflags_column (string)
5.34. toroute_column (string)
5.35. vars_table_name (string)
5.36. vars_h_id_column (string)
5.37. vars_h_entry_column (string)
5.38. vars_key_column (string)
5.39. vars_value_column (string)
5.40. profiles_with_value (string)
5.41. profiles_no_value (string)
5.42. bridge_controller (string)
5.43. bridge_contact (string)
5.44. initial_cbs_inscript (int)
5.45. send_bye (int)
5.46. wait_ack (int)
5.47. ka_timer (int)
5.48. ka_interval (int)
5.49. timeout_noreset (int)
5.50. timer_procs (int)
5.51. track_cseq_updates (int)
5.1. enable_stats (integer)
If statistics support should be enabled or not. Via statistics
variables, the module provide information about the dialog processing.
Set it to zero to disable or to non-zero to enable it.
Default value is "1 (enabled)".
Example 1.1. Set enable_stats parameter
...
modparam("dialog", "enable_stats", 0)
...
5.2. hash_size (integer)
The size of the hash table internally used to keep the dialogs. A
larger table is much faster but consumes more memory. The hash size
must be a power of two.
IMPORTANT: If dialogs' information should be stored in a database, a
constant hash_size should be used, otherwise the restoring process will
not take place. If you really want to modify the hash_size, you must
delete all table's rows before restarting the server.
Default value is "4096".
Example 1.2. Set hash_size parameter
...
modparam("dialog", "hash_size", 1024)
...
5.3. rr_param (string)
Name of the Record-Route parameter used to store the dialog cookie. It
is used for the fast matching of sequential requests to tracked
dialogs.
Default value is "did".
Example 1.3. Set rr_param parameter
...
modparam("dialog", "rr_param", "xyz")
...
5.4. dlg_flag (integer)
Flag to be used for marking if a dialog should be constructed for the
current request (this make sense only for initial requests).
Default value is "none".
Example 1.4. Set dlg_flag parameter
...
modparam("dialog", "dlg_flag", 4)
...
5.5. timeout_avp (string)
The specification of an AVP that contains a custom timeout value (in
seconds) for the dialog. It may be used only in a request (initial or
sequential) context.
Default value is "none".
Example 1.5. Set timeout_avp parameter
...
modparam("dialog", "timeout_avp", "$avp(i:10)")
...
5.6. default_timeout (integer)
The default dialog timeout (in seconds), in the absence of a custom
value provided in an AVP.
Default value is "43200 (12 hours)".
Example 1.6. Set default_timeout parameter
...
modparam("dialog", "default_timeout", 21600)
...
5.7. dlg_extra_hdrs (string)
A string containing the extra headers (full format, with EOH) to be
added to requests generated locally by the module (like BYEs).
Default value is "NULL".
Example 1.7. Set dlf_extra_hdrs parameter
...
modparam("dialog", "dlg_extra_hdrs", "Hint: credit expired\r\n")
...
5.8. dlg_match_mode (integer)
How the sequential requests should be matched against the known
dialogs. The modes are a combination of matching based on a cookie
(DID) stored as cookie in Record-Route header and matching based on SIP
elements (as in RFC 3261).
Note: DID-based matching does not replace callid/fromtag/totag
comparison. It will speed up dialog matching by not iterating over the
whole dialog list for callid/fromtag/totag comparison, but instead it
uses a hash table to find the respective dialog and then doing only one
callid/fromtag/totag comparison. Thus, there is no security issue when
using DID based matching. Use DID_FALLBACK for maximum interoperability
or use DID_ONLY to reject buggy clients or hacking attempts. DID_NONE
is only useful, when you want to hide dialog-tracking from the users
(preventing the DID Record-Route cookie).
The supported modes are:
* 0 - DID_ONLY - the match is done exclusively based on DID;
* 1 - DID_FALLBACK - the match is first tried based on DID and if not
present, it will fall back to SIP matching;
* 2 - DID_NONE - the match is done exclusively based on SIP elements;
no DID information is added in RR.
Default value is "0 (DID_ONLY)".
Example 1.8. Set dlg_match_mode parameter
...
modparam("dialog", "dlg_match_mode", 1)
...
5.9. detect_spirals (integer)
Whether spirals (i.e., messages routed through the proxy multiple
times) should be detected.
If set to 0, spirals will not be detected and result in the generation
of a new, possibly dangling dialog structure per occurring spiral. If
set to 1, spirals are detected and internally mapped to existing dialog
structures.
Default value is 1.
Example 1.9. Set detect_spirals parameter
...
modparam("dialog", "detect_spirals", 1)
...
5.10. db_url (string)
If you want to store the information about the dialogs in a database, a
database URL must be specified.
Default value is "mysql://kamailio:kamailiorw@localhost/kamailio".
Example 1.10. Set db_url parameter
...
modparam("dialog", "db_url", "dbdriver://username:password@dbhost/dbname")
...
5.11. db_mode (integer)
Mode of synchronisation of dialog information from memory to an
underlying database (if desired):
The supported modes are:
* 0 - NO_DB - the memory content is not flushed into DB;
* 1 - REALTIME - any dialog information changes will be reflected
into the database immediatly.
* 2 - DELAYED - the dialog information changes will be flushed into
DB periodically, based on a timer routine.
* 3 - SHUTDOWN - the dialog information will be flushed into DB only
at shutdown - no runtime updates.
Default value is "0".
Example 1.11. Set db_mode parameter
...
modparam("dialog", "db_mode", 1)
...
5.12. db_update_period (integer)
The interval (seconds) at which to update dialogs' information, if you
chose to store the dialogs' info at a given interval. Too short an
interval will generate intensive database operations, while an
excessively long one will miss dialogs with a short lifetime.
Default value is "60".
Example 1.12. Set db_update_period parameter
...
modparam("dialog", "db_update_period", 120)
...
5.13. db_fetch_rows (integer)
The number of the rows to be fetched at once from database when loading
the dialog records at startup from the database. This value can be used
to tune the load time at startup. For 1MB of private memory (default),
it should be below 400. The database driver must support the
fetch_result() capability. A value of 0 means the functionality is
disabled.
Default value is "200".
Example 1.13. Set db_fetch_rows parameter
...
modparam("dialog", "db_fetch_rows", 500)
...
5.14. table_name (string)
If you want to store the information about the dialogs in a database a
table name must be specified.
Default value is "dialog".
Example 1.14. Set table_name parameter
...
modparam("dialog", "table_name", "my_dialog")
...
5.15. callid_column (string)
The column name in the database to store the dialogs' callid.
Default value is "callid".
Example 1.15. Set callid_column parameter
...
modparam("dialog", "callid_column", "callid_c_name")
...
5.16. from_uri_column (string)
The column name in the database to store the caller's sip address.
Default value is "from_uri".
Example 1.16. Set from_uri_column parameter
...
modparam("dialog", "from_uri_column", "from_uri_c_name")
...
5.17. from_tag_column (string)
The column name in the database to store the From tag from the INVITE
request.
Default value is "from_tag".
Example 1.17. Set from_tag_column parameter
...
modparam("dialog", "from_tag_column", "from_tag_c_name")
...
5.18. to_uri_column (string)
The column name in the database to store the callee's sip address.
Default value is "to_uri".
Example 1.18. Set to_uri_column parameter
...
modparam("dialog", "to_uri_column", "to_uri_c_name")
...
5.19. to_tag_column (string)
The column name in the database to store the To tag from the 200 OK
response to the INVITE request, if present.
Default value is "to_tag".
Example 1.19. Set to_tag_column parameter
...
modparam("dialog", "to_tag_column", "to_tag_c_name")
...
5.20. from_cseq_column (string)
The column name in the database to store the cseq from caller side.
Default value is "caller_cseq".
Example 1.20. Set from_cseq_column parameter
...
modparam("dialog", "from_cseq_column", "column_name")
...
5.21. to_cseq_column (string)
The column name in the database to store the cseq from callee side.
Default value is "callee_cseq".
Example 1.21. Set to_cseq_column parameter
...
modparam("dialog", "to_cseq_column", "column_name")
...
5.22. from_route_column (string)
The column name in the database to store the route records from caller
side (proxy to caller).
Default value is "caller_route_set".
Example 1.22. Set from_route_column parameter
...
modparam("dialog", "from_route_column", "column_name")
...
5.23. to_route_column (string)
The column name in the database to store the route records from callee
side (proxy to callee).
Default value is "callee_route_set".
Example 1.23. Set to_route_column parameter
...
modparam("dialog", "to_route_column", "column_name")
...
5.24. from_contact_column (string)
The column name in the database to store the caller's contact uri.
Default value is "caller_contact".
Example 1.24. Set from_contact_column parameter
...
modparam("dialog", "from_contact_column", "column_name")
...
5.25. to_contact_column (string)
The column name in the database to store the callee's contact uri.
Default value is "callee_contact".
Example 1.25. Set to_contact_column parameter
...
modparam("dialog", "to_contact_column", "column_name")
...
5.26. from_sock_column (string)
The column name in the database to store the information about the
local interface receiving the traffic from caller.
Default value is "caller_sock".
Example 1.26. Set from_sock_column parameter
...
modparam("dialog", "from_sock_column", "column_name")
...
5.27. to_sock_column (string)
The column name in the database to store information about the local
interface receiving the traffic from callee.
Default value is "callee_sock".
Example 1.27. Set to_sock_column parameter
...
modparam("dialog", "to_sock_column", "column_name")
...
5.28. h_id_column (string)
The column name in the database to store the dialogs' hash id
information.
Default value is "hash_id".
Example 1.28. Set h_id_column parameter
...
modparam("dialog", "h_id_column", "hash_id_c_name")
...
5.29. h_entry_column (string)
The column name in the database to store the dialogs' hash entry
information.
Default value is "hash_entry".
Example 1.29. Set h_entry_column parameter
...
modparam("dialog", "h_entry_column", "h_entry_c_name")
...
5.30. state_column (string)
The column name in the database to store the dialogs' state
information.
Default value is "state".
Example 1.30. Set state_column parameter
...
modparam("dialog", "state_column", "state_c_name")
...
5.31. start_time_column (string)
The column name in the database to store the dialogs' start time
information.
Default value is "start_time".
Example 1.31. Set start_time_column parameter
...
modparam("dialog", "start_time_column", "start_time_c_name")
...
5.32. timeout_column (string)
The column name in the database to store the dialogs' timeout.
Default value is "timeout".
Example 1.32. Set timeout_column parameter
...
modparam("dialog", "timeout_column", "timeout_c_name")
...
5.33. sflags_column (string)
The column name in the database to store the script flags.
Default value is "sflags".
Example 1.33. Set sflags_column parameter
...
modparam("dialog", "sflags_column", "s_flags")
...
5.34. toroute_column (string)
The column name in the database to store the index of the route to be
executed at timeout.
Default value is "toroute".
Example 1.34. Set toroute_column parameter
...
modparam("dialog", "toroute_column", "timeout_route")
...
5.35. vars_table_name (string)
If you want to store the variables for a dialog in a database a table
name must be specified.
Default value is "dialog_vars".
Example 1.35. Set vars_table_name parameter
...
modparam("dialog", "vars_table_name", "my_dialog_vars")
...
5.36. vars_h_id_column (string)
The column name in the database to store the dialogs' hash id
information (as a reference to the dialog table).
Default value is "hash_id".
Example 1.36. Set vars_h_id_column parameter
...
modparam("dialog", "vars_h_id_column", "vars_h_id_name")
...
5.37. vars_h_entry_column (string)
The column name in the database to store the dialogs' hash entry
information (as a reference to the dialog table).
Default value is "hash_entry".
Example 1.37. Set vars_h_entry_column parameter
...
modparam("dialog", "vars_h_entry_column", "vars_h_entry_name")
...
5.38. vars_key_column (string)
The column name in the database to store the keys of a variable.
Default value is "dialog_key".
Example 1.38. Set vars_key_column parameter
...
modparam("dialog", "vars_key_column", "vars_key_name")
...
5.39. vars_value_column (string)
The column name in the database to store the keys of a variable.
Default value is "dialog_value".
Example 1.39. Set vars_value_column parameter
...
modparam("dialog", "vars_value_column", "vars_value_name")
...
5.40. profiles_with_value (string)
List of names for profiles with values.
Default value is "empty".
Example 1.40. Set profiles_with_value parameter
...
modparam("dialog", "profiles_with_value", "caller ; my_profile")
...
5.41. profiles_no_value (string)
List of names for profiles without values.
Default value is "empty".
Example 1.41. Set profiles_no_value parameter
...
modparam("dialog", "profiles_no_value", "inbound ; outbound")
...
5.42. bridge_controller (string)
SIP address to be used in From header when initiating a call bridge.
Default value is "sip:controller@kamailio.org".
Example 1.42. Set bridge_controller parameter
...
modparam("dialog", "bridge_controller", "sip:ctd@kamailio.org")
...
5.43. bridge_contact (string)
SIP address to be used in Contact header when doing a call bridge.
Default value is "sip:controller@kamailio.org:5060".
Example 1.43. Set bridge_contact parameter
...
modparam("dialog", "bridge_contact", "sip:ctd@127.0.0.1:5060")
...
5.44. initial_cbs_inscript (int)
If the initial dialog callbacks (i.e., DLGCB_CREATED and
DLGCB_SPIRALED) should be executed in-script or post-script. If
dlg_manage() is not used, the setting of this parameter does not
matter; otherwise, initial callbacks will be executed directly after
dlg_manage() is called if this parameter is enabled. If it is disabled,
initial callback execution will be postponed until configuration script
execution completes.
The supported values are:
* 0 - POST-SCRIPT - execute initial callbacks after the script
completes;
* 1 - IN-SCRIPT - execute initial callbacks during script execution,
i.e., right after dlg_manage() is called;
Default value is "1".
Example 1.44. Set initial_cbs_inscript parameter
...
modparam("dialog", "initial_cbs_inscript", 0)
...
5.45. send_bye (int)
If set to 1, BYE requests will be sent out for each dialog that timed
out. It is an alternative to $dlg_ctx(timeout_bye)=1 for all dialogs.
Default value is "0".
Example 1.45. Set send_bye parameter
...
modparam("dialog", "send_bye", 1)
...
5.46. wait_ack (int)
If set to 1, dialog will be keept a bit longer in memory in order to
absorb the ACK negative replies of initial INVITE. If not, the dialog
is destroyed when negative reply is sent out (less internal
complexity).
Default value is "1".
Example 1.46. Set wait_ack parameter
...
modparam("dialog", "wait_ack", 0)
...
5.47. ka_timer (int)
Keep-alive timer step - how often to execute the callback to send
dialog keep alives (SIP OPTIONS requests within dialog). The value
represents the number of seconds.
Default value is "0" (no keep alive).
Example 1.47. Set ka_timer parameter
...
modparam("dialog", "ka_timer", 10)
...
5.48. ka_interval (int)
The interval between keep alives within dialog (SIP OPTIONS requests),
sent to caller or callee. The keep alive request will be sent by the
first callback fired by KA timer after the ka_interval elapsed from
dialog setup or previous keep-alive. The value represents the number of
seconds.
Default value is "0" (no keep alive).
Example 1.48. Set ka_interval parameter
...
modparam("dialog", "ka_interval", 300)
...
5.49. timeout_noreset (int)
If set to 1, the dialog timeout won't be reset each time a sequential
request is processed. It is an alternative to
dlg_set_property("timeout-noreset") for all dialogs.
Default value is "0".
Example 1.49. Set timeout_noreset parameter
...
modparam("dialog", "timeout_noreset", 1)
...
5.50. timer_procs (int)
If set to 1, the dialog will run own timer process to execute dialog
timeout tasks.
Default value is "0" (use core time process).
Example 1.50. Set timer_procs parameter
...
modparam("dialog", "timer_procs", 1)
...
5.51. track_cseq_updates (int)
Enable the callbacks for tracking if CSeq number needs to be updated.
It is the case when the INVITE has to be authenticated to downstream
provider using uac_auth() from uac module.
This is done only for requests in downstream direction. The CSeq
difference is stored in $dlg_var(cseq_diff), be sure this variable is
not overwritten via config operation.
Default value is "0" (disabled).
Example 1.51. Set track_cseq_updates parameter
...
modparam("dialog", "track_cseq_updates", 1)
...
6. Functions
6.1. set_dlg_profile(profile,[value])
6.2. unset_dlg_profile(profile,[value])
6.3. is_in_profile(profile,[value])
6.4. get_profile_size(profile,[value],size)
6.5. dlg_isflagset(flag)
6.6. dlg_setflag(flag)
6.7. dlg_resetflag(flag)
6.8. dlg_bye(side)
6.9. dlg_refer(side, address)
6.10. dlg_manage()
6.11. dlg_bridge(from, to, op)
6.12. dlg_get(callid, ftag, ttag)
6.13. is_known_dlg()
6.14. dlg_set_timeout(timeout [, h_entry, h_id])
6.15. dlg_set_timeout_by_profile(profile, [value], timeout)
6.16. dlg_set_property(attr)
6.17. dlg_remote_profile(cmd, profile, value, uid, expires)
6.1. set_dlg_profile(profile,[value])
Inserts the current dialog into a profile. Note that if the profile
does not support values, they will be silently discarded. Also, there
is no check for inserting the same dialog into the same profile
multiple times.
Meaning of the parameters is as follows:
* profile - name of the profile to be added to;
* value (optional) - string value to define the membership of the
dialog in the profile. Note that the profile must support values.
Pseudo-variables are supported.
This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE
and FAILURE_ROUTE.
Example 1.52. set_dlg_profile usage
...
set_dlg_profile("inbound_call");
set_dlg_profile("caller","$fu");
...
6.2. unset_dlg_profile(profile,[value])
Removes the current dialog from a profile.
Meaning of the parameters is as follows:
* profile - name of the profile to be removed from;
* value (optional) - string value to define the belonging of the
dialog to the profile - note that the profile must support values.
Pseudo-variables are supported.
This function can be used from BRANCH_ROUTE, REPLY_ROUTE and
FAILURE_ROUTE.
Example 1.53. unset_dlg_profile usage
...
unset_dlg_profile("inbound_call");
unset_dlg_profile("caller","$fu");
...
6.3. is_in_profile(profile,[value])
Checks if the current dialog belongs to a profile. If the profile
supports values, the check can be reinforced to take into account a
specific value, if the dialog was inserted into the profile for a
specific value. If no value is passed, only the membership of the
dialog in the profile per se is checked. Note that if the profile does
not support values, the value parameter will be silently discarded.
Meaning of the parameters is as follows:
* profile - name of the profile to be checked against;
* value (optional) - string value to further restrict the check.
Pseudo-variables are supported.
This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE
and FAILURE_ROUTE.
Example 1.54. is_in_profile usage
...
if (is_in_profile("inbound_call")) {
log("this request belongs to a inbound call\n");
}
...
if (is_in_profile("caller","XX")) {
log("this request belongs to a call of user XX\n");
}
...
6.4. get_profile_size(profile,[value],size)
Returns the number of dialogs belonging to a profile. If the profile
supports values, the check can be reinforced to take into account a
specific value, i.e. how many dialogs were inserted into the profile
with a specific value. If no value is passed, only the membersip of the
dialog in the profile per se is checked. Note that if the profile does
not support values, the value parameter will be silently discarded.
Meaning of the parameters is as follows:
* profile - name of the profile to get the size for;
* value (optional) - string value to further restrict the check.
Pseudo-variables are supported;
* size - an AVP or script variable to return the profile size in.
This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE
and FAILURE_ROUTE.
Example 1.55. get_profile_size usage
...
if(get_profile_size("inbound_call","$avp(size)"))
xlog("currently there are $avp(size) inbound calls\n");
...
if(get_profile_size("caller","$fu","$avp(size)"))
xlog("currently, the user $fu has $avp(size) active outgoing calls\n");
...
6.5. dlg_isflagset(flag)
Check if the dialog flag is set or not.
Meaning of the parameters is as follows:
* flag - index of the flag - can be pseudo-variable.
This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
ONREPLY_ROUTE and FAILURE_ROUTE.
Example 1.56. dlg_isflagset usage
...
if(dlg_isflagset("1"))
{
...
}
...
6.6. dlg_setflag(flag)
Set the dialog flag.
Meaning of the parameters is as follows:
* flag - index of the flag - can be pseudo-variable.
This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
ONREPLY_ROUTE and FAILURE_ROUTE.
Example 1.57. dlg_setflag usage
...
dlg_setflag("1");
...
6.7. dlg_resetflag(flag)
Reset the dialog flag.
Meaning of the parameters is as follows:
* flag - index of the flag - can be pseudo-variable.
This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
ONREPLY_ROUTE and FAILURE_ROUTE.
Example 1.58. dlg_resetflag usage
...
redlg_setflag("1");
...
6.8. dlg_bye(side)
Send BYE to both parties of a dialog.
Meaning of the parameters is as follows:
* side - where to send the BYE. It can be: 'caller', 'callee', or
both.
This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
ONREPLY_ROUTE and FAILURE_ROUTE.
Example 1.59. dlg_bye usage
...
dlg_bye("all");
...
6.9. dlg_refer(side, address)
Refer the 'side' to a new SIP 'address'.
Meaning of the parameters is as follows:
* side - which side of the dialog to REFER. It can be: 'caller' or
'callee'.
* address - SIP address to refer to.
This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
ONREPLY_ROUTE and FAILURE_ROUTE.
Example 1.60. dlg_refer usage
...
dlg_refer("caller", "sip:announcement@kamailio.org");
...
6.10. dlg_manage()
Process current SIP request with dialog module. It is an alternative to
setting dialog flag for initial INVITE and Route-parameter-callback
execution for within-dialog requests.
This function can be used from REQUEST_ROUTE.
Example 1.61. dlg_manage usage
...
modparam("dialog", "default_timeout", 100)
...
route {
...
if(is_method("INVITE") && !has_totag())
{
$dlg_ctx(timeout_route) = 12;
$dlg_ctx(timeout_bye) = 1;
}
dlg_manage();
...
}
...
6.11. dlg_bridge(from, to, op)
Bridge 'from' SIP address to 'to' SIP address via outbound proxy 'op'.
Meaning of the parameters is as follows:
* from - SIP address of first side to call.
* to - SIP address to refer "from" to.
* op - outbound proxy SIP address.
This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
ONREPLY_ROUTE and FAILURE_ROUTE.
Example 1.62. dlg_bridge usage
...
dlg_bridge("sip:user@kamailio.org", "sip:annoucement@kamailio.org",
"sip:kamailio.org:5080");
...
6.12. dlg_get(callid, ftag, ttag)
Search and set current dialog based on Call-ID, From-Tag and To-Tag
parameters.
Meaning of the parameters is as follows:
* callid - SIP call-id.
* ftag - SIP From tag.
* ttag - SIP To tag.
This function can be used from BRANCH_ROUTE, REQUEST_ROUTE,
ONREPLY_ROUTE and FAILURE_ROUTE.
Example 1.63. dlg_get usage
...
if(dlg_get("abcdef", "123", "456"))
{
dlg_bye("all");
}
...
6.13. is_known_dlg()
This function checks if the current SIP message being processed belongs
to any transaction within an active dialog that the dialog module is
currently tracking. This is a check for tracking of any kind, without
regard to profiles.
This function has numerous potential applications, among which is that
it can be used to strengthen security for loose-routing sequential
(in-dialog) requests or responses to them, as by providing a
preventative check against spoofing on the proxy level instead of
leaving the issue purely to the receiving UA.
This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE
and FAILURE_ROUTE.
Example 1.64. is_known_dlg() usage
...
if(!uri == myself) {
if(is_known_dlg()) {
xlog("Request $rm from $ci is in-dialog\n");
}
}
...
6.14. dlg_set_timeout(timeout [, h_entry, h_id])
Set the dialog timeout. Dialog timeout will be updated if it was
already set. If h_entry and h_id parameters are not provided, the
dialog will be searched based on (callid, fromtag, totag) of currently
processed SIP message.
Meaning of the parameters is as follows:
* timeout - the interval in seconds after which the dialog will time
out.
* h_entry - h_entry value of the iternal dialog identifier.
* h_id - h_id valye if the internal dialog identifier.
This function can be used from ANY_ROUTE.
Example 1.65. dlg_set_timeout usage
...
if(dlg_set_timeout("180", "123", "456"))
{
...
}
...
6.15. dlg_set_timeout_by_profile(profile, [value], timeout)
Like dlg_set_timeout(), but simultaneously sets the timeout of all
dialogs in a given profile. Can be constrained by profile value.
Meaning of the parameters is as follows:
* profile - The dialog profile across which to apply the timeout.
value (optional) - The profile value to use when applying the
dialog timeout.
timeout - the interval in seconds after which the dialog will time
out.
This function can be used from ANY_ROUTE.
Example 1.66. dlg_set_timeout_by_profile usage
...
# All dialogs belonging to user abc123 (tracked via set_dlg_profile())
# will be timed out in 3 seconds.
dlg_set_timeout_by_profile("users", "abc123", "3");
...
6.16. dlg_set_property(attr)
Set a dialog property - an attribute that enable/disable various
behaviours (e.g., sending keep alive requests).
Meaning of the parameters is as follows:
* attr - name of property. It can be:
+ 'ka-src' - send keep alive OPTION requests to caller
+ 'ka-dst' - send keep alive OPTION requests to callee
+ 'timeout-noreset' - don't reset timeout on in-dialog messages
reception
If keep alive is enabled for a dialog, the module will send SIP OPTIONS
requests with CSeq lower or equal than last request within dialog, with
the scope of detecting if the destination is still in the call. If the
keep alive request results in a local timeout or '481 Call
Leg/Transaction Does Not Exist', then the dialog is ended from the
server.
If 'timeout-noreset' is set, dialog timeout won't be reset upon
reception of in-dialog messages (default behavior).
This function can be used from ANY_ROUTE.
Example 1.67. dlg_set_property usage
...
dlg_set_property("ka-src");
dlg_set_property("ka-dst");
dlg_set_property("timeout-noreset");
...
6.17. dlg_remote_profile(cmd, profile, value, uid, expires)
Manage remote profile via config file. A remote profile item is
considered when the dialog is not managed by this server instance. The
notification to add/remove can be received via SIP or a RPC command,
the operation can be then triggered from configuration file. This
should allow counting active dialogs in a profile that are managed by
multiple SIP server instances.
Meaning of the parameters is as follows:
* cmd - the operations to do: add - add an item in profile; rm -
remove an item from profile
* profile - name of profile
* value - value for profile (if no value is needed for that profile,
use an empty string.
* expires - absolute time (unix timestamp) when this profile item
should be removed automatically (time based), if still in the
profile
This function can be used from ANY_ROUTE.
Example 1.68. dlg_remote_profile usage
...
$var(exp) = 3600 + $Ts;
dlg_remote_profile("add", "caller", "test", "$sruid", "$var(exp)");
...
7. Statistics
7.1. active_dialogs
7.2. early_dialogs
7.3. processed_dialogs
7.4. expired_dialogs
7.5. failed_dialogs
7.1. active_dialogs
Returns the number of current active dialogs (may be confirmed or not).
7.2. early_dialogs
Returns the number of early dialogs.
7.3. processed_dialogs
Returns the total number of processed dialogs (terminated, expired or
active) from the startup.
7.4. expired_dialogs
Returns the total number of expired dialogs from the startup.
7.5. failed_dialogs
Returns the number of failed dialogs.
8. MI Commands
8.1. dlg_list
8.2. dlg_list_ctx
8.3. dlg_end_dlg
8.4. dlg_terminate_dlg
8.5. profile_get_size
8.6. profile_list_dlgs
8.7. dlg_bridge
8.1. dlg_list
Lists the description of a dialog or of all dialogs (calls). If only
one dialogs is to be listed, the dialog identifiers are to be passed as
parameter (callid and fromtag).
Name: dlg_list
Parameters:
* callid (optional) - callid if a single dialog to be listed.
* from_tag (optional, but cannot be present without the callid
parameter) - from tag (as per initial request) of the dialog to be
listed. Note that if the from_tag is not specified, only dialogs
created by a request without a from tag are matched, which will
only occur with broken clients and is thus a very rare situation.
MI FIFO Command Format:
:dlg_list:_reply_fifo_file_
_empty_line_
:dlg_list:_reply_fifo_file_
abcdrssfrs122444@192.168.1.1
AAdfeEFF33
8.2. dlg_list_ctx
The same as the "dlg_list" but including in the dialog description the
associated context from modules sitting on top of the dialog module.
Name: dlg_list_ctx
Parameters: see "dlg_list"
MI FIFO Command Format:
:dlg_list_ctx:_reply_fifo_file_
_empty_line_
8.3. dlg_end_dlg
Terminates a confirmed dialog by sending BYE requests in both
directions.
Name: dlg_end_dlg
Parameters:
* h_entry - hash entry of the dialog in the internal dialog table
* h_id - hash id of the dialog on the hash entry
* extra_hdrs - (optional) string containg extra headers (full format)
to be added to the BYE requests.
The values for the h_entry and h_id can be get via the dlg_list MI
command.
Note: Works only for confirmed dialogs.
MI FIFO Command Format:
:dlg_end_dlg:_reply_fifo_file_
342
56
_empty_line_
8.4. dlg_terminate_dlg
Terminates a singe dialog, identified by a Call-ID.
Name: dlg_terminate_dlg
Parameters:
* callid - callid of the dialog to be terminated.
* from_tag (optional, but cannot be present without the callid
parameter) - from tag (as per initial request) of the dialog to be
terminated. Note that if the from_tag is not specified, only
dialogs created by a request without a from tag are matched, which
will only occur with broken clients and is thus a very rare
situation.
Note: Works only for confirmed dialogs.
MI FIFO Command Format:
:dlg_terminate_dlg:_reply_fifo_file_
abcdrssfrs122444@192.168.1.1
AAdfeEFF33
8.5. profile_get_size
Returns the number of dialogs belonging to a profile. If the profile
supports values, the check can be reinforced to take into account a
specific value - how many dialogs were inserted into the profile with a
specific value. If no value is passed, only the simply belonging of the
dialog to the profile is checked. Note that if the profile does not
supports values, this will be silently discarded.
Name: profile_get_size
Parameters:
* profile - name of the profile to get the value for.
* value (optional)- string value to further restrict the check;
MI FIFO Command Format:
:profile_get_size:_reply_fifo_file_
inbound_calls
_empty_line_
8.6. profile_list_dlgs
Lists all the dialogs belonging to a profile. If the profile supports
values, the check can be reinforced to take into account a specific
value - list only the dialogs that were inserted into the profile with
that specific value. If no value is passed, all dialogs belonging to
the profile will be listed. Note that if the profile does not supports
values, this will be silently discarded.
Name: profile_list_dlgs
Parameters:
* profile - name of the profile to list the dialog for.
* value (optional)- string value to further restrict the check;
MI FIFO Command Format:
:profile_list_dlgs:_reply_fifo_file_
inbound_calls
_empty_line_
8.7. dlg_bridge
Bridge two SIP addresses in a call using INVITE(hold)-REFER-BYE
mechanism.
Name: dlg_bridge
Parameters:
* from - SIP address to initiate the call
* to - SIP address to refer 'from' to
* op (optional) - outbound proxy SIP address
MI FIFO Command Format:
:dlg_bridge:_reply_fifo_file_
from
to
op
_empty_line_
9. Exported RPC Functions
9.1. dlg.list
9.2. dlg.list_ctx
9.3. dlg.dlg_list
9.4. dlg.dlg_list_ctx
9.5. dlg.end_dlg
9.6. dlg.profile_get_size
9.7. dlg.profile_list
9.8. dlg.bridge_dlg
9.1. dlg.list
Lists the description of all dialogs (calls).
Name: dlg.list
RPC Command Format:
serctl dlg_list
9.2. dlg.list_ctx
The same as the "dlg_list" but including in the dialog description the
associated context from modules sitting on top of the dialog module.
Name: dlg.list_ctx
RPC Command Format:
serctl dlg.list_ctx
9.3. dlg.dlg_list
Lists the description of one dialog. The dialog identifiers are to be
passed as parameter (callid and fromtag).
Name: dlg.dlg_list
Parameters:
* callid callid of the dialog to be listed.
* from_tag from tag (as per initial request) of the dialog to be
listed.
RPC Command Format:
serctl dlg.list abcdrssfrs122444@192.168.1.1 AAdfeEFF33
9.4. dlg.dlg_list_ctx
The same as the "dlg.list_ctx" but including in the dialog description
the associated context from modules sitting on top of the dialog
module.
Name: dlg.dlg_list_ctx
Parameters: see "dlg_list"
RPC Command Format:
serctl dlg.list_ctx abcdrssfrs122444@192.168.1.1 AAdfeEFF33
9.5. dlg.end_dlg
Terminates an ongoing dialog by sending BYE in both directions.
Name: dlg.end_dlg
Parameters:
* h_entry - hash entry of the dialog in the internal dialog table
* h_id - hash id of the dialog on the hash entry
* extra_hdrs - (optional) string containg extra headers (full format)
to be added to the BYE requests.
The values for the h_entry and h_id can be get via the dlg_list RPC
command.
RPC Command Format:
serctl dlg.end_dlg 342 56
9.6. dlg.profile_get_size
Returns the number of dialogs belonging to a profile. If the profile
supports values, the check can be reinforced to take into account a
specific value - how many dialogs were inserted into the profile with a
specific value. If no value is passed, only the simply belonging of the
dialog to the profile is checked. Note that if the profile does not
support values, the value parameter will be silently discarded.
Name: dlg.profile_get_size
Parameters:
* profile - name of the profile to get the value for.
* value (optional)- string value to further restrict the check;
RPC Command Format:
serctl dlg.dlg.profile_get_size inbound_calls
9.7. dlg.profile_list
Lists all the dialogs belonging to a profile. If the profile supports
values, the check can be reinforced to take into account a specific
value, i.e. list only the dialogs that were inserted into the profile
with that specific value. If no value is passed, all dialogs belonging
to the profile will be listed. Note that if the profile does not
supports values, this will be silently discarded.
Name: dlg.profile_list
Parameters:
* profile - name of the profile to list the dialog for.
* value (optional)- string value to further restrict the check;
RPC Command Format:
serctl dlg.profile_list inbound_calls
9.8. dlg.bridge_dlg
Bridge two SIP addresses into a call using INVITE(hold)-REFER-BYE
mechanism.
Name: dlg.bridge_dlg
Parameters:
* from - SIP address to initiate the call
* to - SIP address to refer 'from' to
* op (optional) - outbound proxy SIP address
RPC Command Format:
serctl dlg.list from to op
10. Exported pseudo-variables
10.1. $DLG_count
10.2. $DLG_status
10.3. $DLG_lifetime
10.4. $dlg(...)
10.5. $dlg_ctx(...)
10.6. $dlg_var(key)
10.1. $DLG_count
Returns the number of current active dialogs (may be confirmed or not).
10.2. $DLG_status
Returns the status of the dialog corresponding to the processed
sequential request. This PV will be available only for sequential
requests, after doing loose_route().
Value may be:
* NULL - Dialog not found.
* 3 - Confirmed by a final reply but no ACK received yet.
* 4 - Confirmed by a final reply and ACK received.
* 5 - Dialog ended.
10.3. $DLG_lifetime
Returns the duration (in seconds) of the dialog corresponding to the
processed sequential request. The duration is calculated from the
dialog confirmation and the current moment. This PV will be available
only for sequential requests, after doing loose_route().
NULL will be returned if there is no dialog for the request.
10.4. $dlg(...)
Access to dialog attributes.
10.5. $dlg_ctx(...)
Access to dialog context attributes.
10.6. $dlg_var(key)
This is a read/write variable that can be used to store custom values
assigned with a dialog (e.g. the URI of a billing-server, an assigned
emergency-server). This pseudo-variable will be available only for
subsequential requests after doing loose_route().
Note: You will receive "NULL", if there is no dialog for this request.
11. Event Routes
11.1. event_route[dialog:start]
11.2. event_route[dialog:end]
11.3. event_route[dialog:failed]
11.1. event_route[dialog:start]
Executed when 200OK for INVITE is processed.
11.2. event_route[dialog:end]
Executed when BYE is processed or dialog timed out.
11.3. event_route[dialog:failed]
Executed when dialog is not completed (+300 reply to INVITE).
Chapter 2. Developer Guide
Table of Contents
1. Available Functions
1.1. register_dlgcb (dialog, type, cb, param, free_param_cb)
1.2. terminate_dlg (dlg, hdrs)
1. Available Functions
1.1. register_dlgcb (dialog, type, cb, param, free_param_cb)
1.2. terminate_dlg (dlg, hdrs)
1.1. register_dlgcb (dialog, type, cb, param, free_param_cb)
Register a new callback to the dialog.
Meaning of the parameters is as follows:
* struct dlg_cell* dlg - dialog to register callback to. If maybe
NULL only for DLGCB_CREATED callback type, which is not a per
dialog type.
* int type - types of callbacks; more types may be register for the
same callback function; only DLGCB_CREATED must be register alone.
Possible types:
+ DLGCB_LOADED
+ DLGCB_CREATED - called when a new dialog is created - it's a
global type (not associated to any dialog)
+ DLGCB_FAILED - called when the dialog was negatively replied
(non-2xx) - it's a per dialog type.
+ DLGCB_CONFIRMED_NA - called when the dialog is confirmed (2xx
replied) but the setup-concluding ACK message from the caller
is yet pending - it's a per dialog type.
+ DLGCB_CONFIRMED - called when the dialog is confirmed (2xx
replied) and the setup-concluding ACK message from the caller
has been seen - it's a per dialog type.
+ DLGCB_REQ_WITHIN - called when the dialog matches a sequential
request (excluding setup-concluding ACK messages which are
handled in DLGCB_CONFIRMED) - it's a per dialog type.
+ DLGCB_TERMINATED - called when the dialog is terminated via
BYE - it's a per dialog type.
+ DLGCB_TERMINATED_CONFIRMED - called when response to a BYE
request is received - it's a per dialog type.
+ DLGCB_EXPIRED - called when the dialog expires without
receiving a BYE - it's a per dialog type.
+ DLGCB_EARLY - called when the dialog is created in an early
state (18x replied) - it's a per dialog type.
+ DLGCB_RESPONSE_FWDED - called when the dialog matches a reply
to the initial INVITE request - it's a per dialog type.
+ DLGCB_RESPONSE_WITHIN - called when the dialog matches a reply
to a subsequent in dialog request - it's a per dialog type.
+ DLGCB_MI_CONTEXT - called when the mi dlg_list_ctx command is
invoked - it's a per dialog type.
+ DLGCB_SPIRALED - called when the dialog matches a spiraling
request - it's a per dialog type.
+ DLGCB_DESTROY
* dialog_cb cb - callback function to be called. Prototype is: "void
(dialog_cb) (struct dlg_cell* dlg, int type, struct dlg_cb_params *
params); "
* void *param - parameter to be passed to the callback function.
* param_free callback_param_free - callback function to be called to
free the param. Prototype is: "void (param_free_cb) (void *param);"
1.2. terminate_dlg (dlg, hdrs)
Terminate a Dialog
Meaning of parameters is as follows:
* struct dlg_cell* dlg - dialog to terminate.
* str* hdrs - string containg extra headers (full format) to be added
to the BYE requests of the dialog.
Chapter 3. Frequently Asked Questions
3.1. What happend with "use_tight_match" parameter?
3.2. Where can I find more about Kamailio?
3.3. Where can I post a question about this module?
3.4. How can I report a bug?
3.1.
What happend with "use_tight_match" parameter?
The parameter was removed with version 1.3 as the option of tight
matching became mandatory and not configurable. Now, the tight matching
is done all the time (when using DID matching).
3.2.
Where can I find more about Kamailio?
Take a look at http://www.kamailio.org/.
3.3.
Where can I post a question about this module?
First at all check if your question was already answered on one of our
mailing lists:
* User Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
* Developer Mailing List -
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
E-mails regarding any stable Kamailio release should be sent to
<sr-users@lists.sip-router.org> and e-mails regarding development
versions should be sent to <sr-dev@lists.sip-router.org>.
If you want to keep the mail private, send it to
<sr-users@lists.sip-router.org>.
3.4.
How can I report a bug?
Please follow the guidelines provided at:
http://sip-router.org/tracker.
|