diff --git a/src/modules/tm/README b/src/modules/tm/README index 19f4a9a3781..216533fbfb6 100644 --- a/src/modules/tm/README +++ b/src/modules/tm/README @@ -95,53 +95,54 @@ Daniel-Constantin Mierla 4.9. t_on_branch(branch_route) 4.10. t_newtran() 4.11. t_reply(code, reason_phrase) - 4.12. t_send_reply(code, reason) - 4.13. t_lookup_request() - 4.14. t_retransmit_reply() - 4.15. t_release() - 4.16. t_forward_nonack([ip, port]) - 4.17. t_forward_nonack_udp(ip, port) - 4.18. t_forward_nonack_tcp(ip, port) - 4.19. t_forward_nonack_tls(ip, port) - 4.20. t_forward_nonack_sctp(ip, port) - 4.21. t_set_fr(fr_inv_timeout [, fr_timeout]) - 4.22. t_reset_fr() - 4.23. t_set_max_lifetime(inv_lifetime, noninv_lifetime) - 4.24. t_reset_max_lifetime() - 4.25. t_set_retr(retr_t1_interval, retr_t2_interval) - 4.26. t_reset_retr() - 4.27. t_set_auto_inv_100(0|1) - 4.28. t_branch_timeout() - 4.29. t_branch_replied() - 4.30. t_any_timeout() - 4.31. t_any_replied() - 4.32. t_grep_status("code") - 4.33. t_is_canceled() - 4.34. t_is_expired() - 4.35. t_relay_cancel() - 4.36. t_lookup_cancel([1]) - 4.37. t_drop_replies([mode]) - 4.38. t_save_lumps() - 4.39. t_load_contacts([mode]) - 4.40. t_next_contacts() - 4.41. t_next_contact_flow() - 4.42. t_check_status(re) - 4.43. t_check_trans() - 4.44. t_set_disable_6xx(0|1) - 4.45. t_set_disable_failover(0|1) - 4.46. t_set_disable_internal_reply(0|1) - 4.47. t_replicate([params]) - 4.48. t_relay_to(proxy, flags) - 4.49. t_set_no_e2e_cancel_reason(0|1) - 4.50. t_is_set(target) - 4.51. t_use_uac_headers() - 4.52. t_is_retr_async_reply() - 4.53. t_uac_send(method, ruri, nexthop, socket, headers, + 4.12. t_reply_error() + 4.13. t_send_reply(code, reason) + 4.14. t_lookup_request() + 4.15. t_retransmit_reply() + 4.16. t_release() + 4.17. t_forward_nonack([ip, port]) + 4.18. t_forward_nonack_udp(ip, port) + 4.19. t_forward_nonack_tcp(ip, port) + 4.20. t_forward_nonack_tls(ip, port) + 4.21. t_forward_nonack_sctp(ip, port) + 4.22. t_set_fr(fr_inv_timeout [, fr_timeout]) + 4.23. t_reset_fr() + 4.24. t_set_max_lifetime(inv_lifetime, noninv_lifetime) + 4.25. t_reset_max_lifetime() + 4.26. t_set_retr(retr_t1_interval, retr_t2_interval) + 4.27. t_reset_retr() + 4.28. t_set_auto_inv_100(0|1) + 4.29. t_branch_timeout() + 4.30. t_branch_replied() + 4.31. t_any_timeout() + 4.32. t_any_replied() + 4.33. t_grep_status("code") + 4.34. t_is_canceled() + 4.35. t_is_expired() + 4.36. t_relay_cancel() + 4.37. t_lookup_cancel([1]) + 4.38. t_drop_replies([mode]) + 4.39. t_save_lumps() + 4.40. t_load_contacts([mode]) + 4.41. t_next_contacts() + 4.42. t_next_contact_flow() + 4.43. t_check_status(re) + 4.44. t_check_trans() + 4.45. t_set_disable_6xx(0|1) + 4.46. t_set_disable_failover(0|1) + 4.47. t_set_disable_internal_reply(0|1) + 4.48. t_replicate([params]) + 4.49. t_relay_to(proxy, flags) + 4.50. t_set_no_e2e_cancel_reason(0|1) + 4.51. t_is_set(target) + 4.52. t_use_uac_headers() + 4.53. t_is_retr_async_reply() + 4.54. t_uac_send(method, ruri, nexthop, socket, headers, body) - 4.54. t_get_status_code() - 4.55. t_clean() - 4.56. t_exists() + 4.55. t_get_status_code() + 4.56. t_clean() + 4.57. t_exists() 5. RPC Commands @@ -245,50 +246,51 @@ Daniel-Constantin Mierla 1.61. t_on_branch usage 1.62. t_newtran usage 1.63. t_reply usage - 1.64. t_send_reply usage - 1.65. t_lookup_request usage - 1.66. t_retransmit_reply usage - 1.67. t_release usage - 1.68. t_forward_nonack usage - 1.69. t_set_fr usage - 1.70. t_reset_fr usage - 1.71. t_set_max_lifetime usage - 1.72. t_reset_max_lifetime usage - 1.73. t_set_retr usage - 1.74. t_reset_retr usage - 1.75. t_set_auto_inv_100 usage - 1.76. t_branch_timeout usage - 1.77. t_branch_replied usage - 1.78. t_any_timeout usage - 1.79. t_any_replied usage - 1.80. t_grep_status usage - 1.81. t_is_canceled usage - 1.82. t_is_expired usage - 1.83. t_relay_cancel usage - 1.84. t_lookup_cancel usage - 1.85. t_drop_replies() usage - 1.86. t_save_lumps() usage - 1.87. t_load_contacts usage - 1.88. t_next_contacts usage - 1.89. t_next_contact_flow usage - 1.90. t_check_status usage - 1.91. t_check_trans usage - 1.92. t_set_disable_6xx usage - 1.93. t_set_disable_failover usage - 1.94. t_set_disable_internal_reply usage - 1.95. t_replicate usage - 1.96. t_relay_to usage - 1.97. t_set_no_e2e_cancel_reason usage - 1.98. t_replicate usage - 1.99. t_use_uac_headers usage - 1.100. t_is_retr_async_reply usage - 1.101. t_uac_send usage - 1.102. t_get_status_code usage - 1.103. t_clean usage - 1.104. t_exists usage - 1.105. event_route[tm:branch-failure:id] usage - 1.106. event_route[tm:local-request] usage - 1.107. event_route[tm:local-response] usage + 1.64. t_reply_error usage + 1.65. t_send_reply usage + 1.66. t_lookup_request usage + 1.67. t_retransmit_reply usage + 1.68. t_release usage + 1.69. t_forward_nonack usage + 1.70. t_set_fr usage + 1.71. t_reset_fr usage + 1.72. t_set_max_lifetime usage + 1.73. t_reset_max_lifetime usage + 1.74. t_set_retr usage + 1.75. t_reset_retr usage + 1.76. t_set_auto_inv_100 usage + 1.77. t_branch_timeout usage + 1.78. t_branch_replied usage + 1.79. t_any_timeout usage + 1.80. t_any_replied usage + 1.81. t_grep_status usage + 1.82. t_is_canceled usage + 1.83. t_is_expired usage + 1.84. t_relay_cancel usage + 1.85. t_lookup_cancel usage + 1.86. t_drop_replies() usage + 1.87. t_save_lumps() usage + 1.88. t_load_contacts usage + 1.89. t_next_contacts usage + 1.90. t_next_contact_flow usage + 1.91. t_check_status usage + 1.92. t_check_trans usage + 1.93. t_set_disable_6xx usage + 1.94. t_set_disable_failover usage + 1.95. t_set_disable_internal_reply usage + 1.96. t_replicate usage + 1.97. t_relay_to usage + 1.98. t_set_no_e2e_cancel_reason usage + 1.99. t_replicate usage + 1.100. t_use_uac_headers usage + 1.101. t_is_retr_async_reply usage + 1.102. t_uac_send usage + 1.103. t_get_status_code usage + 1.104. t_clean usage + 1.105. t_exists usage + 1.106. event_route[tm:branch-failure:id] usage + 1.107. event_route[tm:local-request] usage + 1.108. event_route[tm:local-response] usage Chapter 1. Admin Guide @@ -366,51 +368,52 @@ Chapter 1. Admin Guide 4.9. t_on_branch(branch_route) 4.10. t_newtran() 4.11. t_reply(code, reason_phrase) - 4.12. t_send_reply(code, reason) - 4.13. t_lookup_request() - 4.14. t_retransmit_reply() - 4.15. t_release() - 4.16. t_forward_nonack([ip, port]) - 4.17. t_forward_nonack_udp(ip, port) - 4.18. t_forward_nonack_tcp(ip, port) - 4.19. t_forward_nonack_tls(ip, port) - 4.20. t_forward_nonack_sctp(ip, port) - 4.21. t_set_fr(fr_inv_timeout [, fr_timeout]) - 4.22. t_reset_fr() - 4.23. t_set_max_lifetime(inv_lifetime, noninv_lifetime) - 4.24. t_reset_max_lifetime() - 4.25. t_set_retr(retr_t1_interval, retr_t2_interval) - 4.26. t_reset_retr() - 4.27. t_set_auto_inv_100(0|1) - 4.28. t_branch_timeout() - 4.29. t_branch_replied() - 4.30. t_any_timeout() - 4.31. t_any_replied() - 4.32. t_grep_status("code") - 4.33. t_is_canceled() - 4.34. t_is_expired() - 4.35. t_relay_cancel() - 4.36. t_lookup_cancel([1]) - 4.37. t_drop_replies([mode]) - 4.38. t_save_lumps() - 4.39. t_load_contacts([mode]) - 4.40. t_next_contacts() - 4.41. t_next_contact_flow() - 4.42. t_check_status(re) - 4.43. t_check_trans() - 4.44. t_set_disable_6xx(0|1) - 4.45. t_set_disable_failover(0|1) - 4.46. t_set_disable_internal_reply(0|1) - 4.47. t_replicate([params]) - 4.48. t_relay_to(proxy, flags) - 4.49. t_set_no_e2e_cancel_reason(0|1) - 4.50. t_is_set(target) - 4.51. t_use_uac_headers() - 4.52. t_is_retr_async_reply() - 4.53. t_uac_send(method, ruri, nexthop, socket, headers, body) - 4.54. t_get_status_code() - 4.55. t_clean() - 4.56. t_exists() + 4.12. t_reply_error() + 4.13. t_send_reply(code, reason) + 4.14. t_lookup_request() + 4.15. t_retransmit_reply() + 4.16. t_release() + 4.17. t_forward_nonack([ip, port]) + 4.18. t_forward_nonack_udp(ip, port) + 4.19. t_forward_nonack_tcp(ip, port) + 4.20. t_forward_nonack_tls(ip, port) + 4.21. t_forward_nonack_sctp(ip, port) + 4.22. t_set_fr(fr_inv_timeout [, fr_timeout]) + 4.23. t_reset_fr() + 4.24. t_set_max_lifetime(inv_lifetime, noninv_lifetime) + 4.25. t_reset_max_lifetime() + 4.26. t_set_retr(retr_t1_interval, retr_t2_interval) + 4.27. t_reset_retr() + 4.28. t_set_auto_inv_100(0|1) + 4.29. t_branch_timeout() + 4.30. t_branch_replied() + 4.31. t_any_timeout() + 4.32. t_any_replied() + 4.33. t_grep_status("code") + 4.34. t_is_canceled() + 4.35. t_is_expired() + 4.36. t_relay_cancel() + 4.37. t_lookup_cancel([1]) + 4.38. t_drop_replies([mode]) + 4.39. t_save_lumps() + 4.40. t_load_contacts([mode]) + 4.41. t_next_contacts() + 4.42. t_next_contact_flow() + 4.43. t_check_status(re) + 4.44. t_check_trans() + 4.45. t_set_disable_6xx(0|1) + 4.46. t_set_disable_failover(0|1) + 4.47. t_set_disable_internal_reply(0|1) + 4.48. t_replicate([params]) + 4.49. t_relay_to(proxy, flags) + 4.50. t_set_no_e2e_cancel_reason(0|1) + 4.51. t_is_set(target) + 4.52. t_use_uac_headers() + 4.53. t_is_retr_async_reply() + 4.54. t_uac_send(method, ruri, nexthop, socket, headers, body) + 4.55. t_get_status_code() + 4.56. t_clean() + 4.57. t_exists() 5. RPC Commands @@ -1816,51 +1819,52 @@ modparam("tm", "failover_reply_codes", "code=403;code=488;class=5") 4.9. t_on_branch(branch_route) 4.10. t_newtran() 4.11. t_reply(code, reason_phrase) - 4.12. t_send_reply(code, reason) - 4.13. t_lookup_request() - 4.14. t_retransmit_reply() - 4.15. t_release() - 4.16. t_forward_nonack([ip, port]) - 4.17. t_forward_nonack_udp(ip, port) - 4.18. t_forward_nonack_tcp(ip, port) - 4.19. t_forward_nonack_tls(ip, port) - 4.20. t_forward_nonack_sctp(ip, port) - 4.21. t_set_fr(fr_inv_timeout [, fr_timeout]) - 4.22. t_reset_fr() - 4.23. t_set_max_lifetime(inv_lifetime, noninv_lifetime) - 4.24. t_reset_max_lifetime() - 4.25. t_set_retr(retr_t1_interval, retr_t2_interval) - 4.26. t_reset_retr() - 4.27. t_set_auto_inv_100(0|1) - 4.28. t_branch_timeout() - 4.29. t_branch_replied() - 4.30. t_any_timeout() - 4.31. t_any_replied() - 4.32. t_grep_status("code") - 4.33. t_is_canceled() - 4.34. t_is_expired() - 4.35. t_relay_cancel() - 4.36. t_lookup_cancel([1]) - 4.37. t_drop_replies([mode]) - 4.38. t_save_lumps() - 4.39. t_load_contacts([mode]) - 4.40. t_next_contacts() - 4.41. t_next_contact_flow() - 4.42. t_check_status(re) - 4.43. t_check_trans() - 4.44. t_set_disable_6xx(0|1) - 4.45. t_set_disable_failover(0|1) - 4.46. t_set_disable_internal_reply(0|1) - 4.47. t_replicate([params]) - 4.48. t_relay_to(proxy, flags) - 4.49. t_set_no_e2e_cancel_reason(0|1) - 4.50. t_is_set(target) - 4.51. t_use_uac_headers() - 4.52. t_is_retr_async_reply() - 4.53. t_uac_send(method, ruri, nexthop, socket, headers, body) - 4.54. t_get_status_code() - 4.55. t_clean() - 4.56. t_exists() + 4.12. t_reply_error() + 4.13. t_send_reply(code, reason) + 4.14. t_lookup_request() + 4.15. t_retransmit_reply() + 4.16. t_release() + 4.17. t_forward_nonack([ip, port]) + 4.18. t_forward_nonack_udp(ip, port) + 4.19. t_forward_nonack_tcp(ip, port) + 4.20. t_forward_nonack_tls(ip, port) + 4.21. t_forward_nonack_sctp(ip, port) + 4.22. t_set_fr(fr_inv_timeout [, fr_timeout]) + 4.23. t_reset_fr() + 4.24. t_set_max_lifetime(inv_lifetime, noninv_lifetime) + 4.25. t_reset_max_lifetime() + 4.26. t_set_retr(retr_t1_interval, retr_t2_interval) + 4.27. t_reset_retr() + 4.28. t_set_auto_inv_100(0|1) + 4.29. t_branch_timeout() + 4.30. t_branch_replied() + 4.31. t_any_timeout() + 4.32. t_any_replied() + 4.33. t_grep_status("code") + 4.34. t_is_canceled() + 4.35. t_is_expired() + 4.36. t_relay_cancel() + 4.37. t_lookup_cancel([1]) + 4.38. t_drop_replies([mode]) + 4.39. t_save_lumps() + 4.40. t_load_contacts([mode]) + 4.41. t_next_contacts() + 4.42. t_next_contact_flow() + 4.43. t_check_status(re) + 4.44. t_check_trans() + 4.45. t_set_disable_6xx(0|1) + 4.46. t_set_disable_failover(0|1) + 4.47. t_set_disable_internal_reply(0|1) + 4.48. t_replicate([params]) + 4.49. t_relay_to(proxy, flags) + 4.50. t_set_no_e2e_cancel_reason(0|1) + 4.51. t_is_set(target) + 4.52. t_use_uac_headers() + 4.53. t_is_retr_async_reply() + 4.54. t_uac_send(method, ruri, nexthop, socket, headers, body) + 4.55. t_get_status_code() + 4.56. t_clean() + 4.57. t_exists() 4.1. t_relay([host, port]) @@ -2102,7 +2106,19 @@ if (t_newtran()) { t_reply("404", "Not found"); ... -4.12. t_send_reply(code, reason) +4.12. t_reply_error() + + Sends a stateful reply based in internal error code, similar to + sl_send_error() from sl module. + + This function can be used from REQUEST_ROUTE. + + Example 1.64. t_reply_error usage +... +t_reply_error(); +... + +4.13. t_send_reply(code, reason) Creates the transaction if it does not exist (executing internally t_newtran()) and sends a stateful reply (executing internally @@ -2115,12 +2131,12 @@ t_reply("404", "Not found"); * code - Reply code number. * reason - Reason string. - Example 1.64. t_send_reply usage + Example 1.65. t_send_reply usage ... t_send_reply("404", "Not found"); ... -4.13. t_lookup_request() +4.14. t_lookup_request() Checks if a transaction exists. Returns a positive value if so, negative otherwise. Most likely you will not want to use it, as a @@ -2128,33 +2144,33 @@ t_send_reply("404", "Not found"); none was found. However this is safely (atomically) done using t_newtran. - Example 1.65. t_lookup_request usage + Example 1.66. t_lookup_request usage ... if (t_lookup_request()) { ... }; ... -4.14. t_retransmit_reply() +4.15. t_retransmit_reply() Retransmits a reply sent previously by UAS transaction. - Example 1.66. t_retransmit_reply usage + Example 1.67. t_retransmit_reply usage ... t_retransmit_reply(); ... -4.15. t_release() +4.16. t_release() Remove transaction from memory (it will be first put on a wait timer to absorb delayed messages). - Example 1.67. t_release usage + Example 1.68. t_release usage ... t_release(); ... -4.16. t_forward_nonack([ip, port]) +4.17. t_forward_nonack([ip, port]) Mainly for internal usage -- forward a non-ACK request statefully. Variants of this functions can enforce a specific transport protocol. @@ -2163,28 +2179,28 @@ t_release(); * ip - IP address where the message should be sent. * port - Port number. - Example 1.68. t_forward_nonack usage + Example 1.69. t_forward_nonack usage ... t_forward_nonack("1.2.3.4", "5060"); ... -4.17. t_forward_nonack_udp(ip, port) +4.18. t_forward_nonack_udp(ip, port) See function t_forward_nonack([ip, port]). -4.18. t_forward_nonack_tcp(ip, port) +4.19. t_forward_nonack_tcp(ip, port) See function t_forward_nonack([ip, port]). -4.19. t_forward_nonack_tls(ip, port) +4.20. t_forward_nonack_tls(ip, port) See function t_forward_nonack([ip, port]). -4.20. t_forward_nonack_sctp(ip, port) +4.21. t_forward_nonack_sctp(ip, port) See function t_forward_nonack([ip, port]). -4.21. t_set_fr(fr_inv_timeout [, fr_timeout]) +4.22. t_set_fr(fr_inv_timeout [, fr_timeout]) Sets the fr_inv_timeout and optionally fr_timeout for the current transaction or for transactions created during the same script @@ -2202,7 +2218,7 @@ t_forward_nonack("1.2.3.4", "5060"); See also: fr_timer, fr_inv_timer, t_reset_fr(). - Example 1.69. t_set_fr usage + Example 1.70. t_set_fr usage ... route { t_set_fr(10000); # set only fr invite timeout to 10s @@ -2218,7 +2234,7 @@ branch_route[1] { } } -4.22. t_reset_fr() +4.23. t_reset_fr() Resets the fr_inv_timer and fr_timer for the current transaction to the default values (set using the tm module parameters fr_inv_timer and @@ -2229,7 +2245,7 @@ branch_route[1] { See also: fr_timer, fr_inv_timer, t_set_fr. - Example 1.70. t_reset_fr usage + Example 1.71. t_reset_fr usage ... route { ... @@ -2237,7 +2253,7 @@ route { ... } -4.23. t_set_max_lifetime(inv_lifetime, noninv_lifetime) +4.24. t_set_max_lifetime(inv_lifetime, noninv_lifetime) Sets the maximum lifetime for the current INVITE or non-INVITE transaction, or for transactions created during the same script @@ -2255,7 +2271,7 @@ route { See also: max_inv_lifetime, max_noninv_lifetime, t_reset_max_lifetime. - Example 1.71. t_set_max_lifetime usage + Example 1.72. t_set_max_lifetime usage ... route { if (src_ip=1.2.3.4) @@ -2266,7 +2282,7 @@ route { # INVITE and to 15s if not } -4.24. t_reset_max_lifetime() +4.25. t_reset_max_lifetime() Resets the maximum lifetime for the current INVITE or non-INVITE transaction to the default value (set using the tm module parameter @@ -2277,7 +2293,7 @@ route { See also: max_inv_lifetime, max_noninv_lifetime, t_set_max_lifetime. - Example 1.72. t_reset_max_lifetime usage + Example 1.73. t_reset_max_lifetime usage ... route { ... @@ -2285,7 +2301,7 @@ route { ... } -4.25. t_set_retr(retr_t1_interval, retr_t2_interval) +4.26. t_set_retr(retr_t1_interval, retr_t2_interval) Sets the retr_t1_interval and retr_t2_interval for the current transaction or for transactions created during the same script @@ -2312,7 +2328,7 @@ route { See also: retr_timer1, retr_timer2, t_reset_retr(). - Example 1.73. t_set_retr usage + Example 1.74. t_set_retr usage ... route { t_set_retr(250, 0); # set only T1 to 250 ms @@ -2328,7 +2344,7 @@ branch_route[1] { } } -4.26. t_reset_retr() +4.27. t_reset_retr() Resets the retr_timer1 and retr_timer2 for the current transaction to the default values (set using the tm module parameters retr_timer1 and @@ -2339,7 +2355,7 @@ branch_route[1] { See also: retr_timer1, retr_timer2, t_set_retr. - Example 1.74. t_reset_retr usage + Example 1.75. t_reset_retr usage ... route { ... @@ -2347,7 +2363,7 @@ route { ... } -4.27. t_set_auto_inv_100(0|1) +4.28. t_set_auto_inv_100(0|1) Switch automatically sending 100 replies to INVITEs on/off on a per transaction basis. It overrides the auto_inv_100 value for the current @@ -2355,7 +2371,7 @@ route { See also: auto_inv_100. - Example 1.75. t_set_auto_inv_100 usage + Example 1.76. t_set_auto_inv_100 usage ... route { ... @@ -2364,13 +2380,13 @@ route { ... } -4.28. t_branch_timeout() +4.29. t_branch_timeout() Returns true if the failure route is executed for a branch that did timeout. It can be used from FAILURE_ROUTE and BRANCH_FAILURE_ROUTE event route. - Example 1.76. t_branch_timeout usage + Example 1.77. t_branch_timeout usage ... failure_route[0]{ if (t_branch_timeout()){ @@ -2379,14 +2395,14 @@ failure_route[0]{ } } -4.29. t_branch_replied() +4.30. t_branch_replied() Returns true if the failure route is executed for a branch that did receive at least one reply in the past (the "current" reply is not taken into account). It can be used from failure_route and branch-failure event route. - Example 1.77. t_branch_replied usage + Example 1.78. t_branch_replied usage ... failure_route[0]{ if (t_branch_timeout()){ @@ -2398,12 +2414,12 @@ failure_route[0]{ } } -4.30. t_any_timeout() +4.31. t_any_timeout() Returns true if at least one of the current transactions branches did timeout. - Example 1.78. t_any_timeout usage + Example 1.79. t_any_timeout usage ... failure_route[0]{ if (!t_branch_timeout()){ @@ -2414,13 +2430,13 @@ failure_route[0]{ } } -4.31. t_any_replied() +4.32. t_any_replied() Returns true if at least one of the current transactions branches did receive some reply in the past. If called from a failure or onreply route, the "current" reply is not taken into account. - Example 1.79. t_any_replied usage + Example 1.80. t_any_replied usage ... onreply_route[0]{ if (!t_any_replied()){ @@ -2429,12 +2445,12 @@ onreply_route[0]{ } } -4.32. t_grep_status("code") +4.33. t_grep_status("code") Returns true if "code" is the final reply received (or locally generated) in at least one of the current transactions branches. - Example 1.80. t_grep_status usage + Example 1.81. t_grep_status usage ... onreply_route[0]{ if (t_grep_status("486")){ @@ -2443,11 +2459,11 @@ onreply_route[0]{ } } -4.33. t_is_canceled() +4.34. t_is_canceled() Returns true if the current transaction was canceled. - Example 1.81. t_is_canceled usage + Example 1.82. t_is_canceled usage ... failure_route[0]{ if (t_is_canceled()){ @@ -2456,12 +2472,12 @@ failure_route[0]{ } } -4.34. t_is_expired() +4.35. t_is_expired() Returns true if the current transaction has already expired, i.e. the max_inv_lifetime/max_noninv_lifetime interval has already elapsed. - Example 1.82. t_is_expired usage + Example 1.83. t_is_expired usage ... failure_route[0]{ if (t_is_expired()){ @@ -2470,7 +2486,7 @@ failure_route[0]{ } } -4.35. t_relay_cancel() +4.36. t_relay_cancel() Forwards the CANCEL if the corresponding INVITE transaction exists. The function is supposed to be used at the very beginning of the script, @@ -2482,7 +2498,7 @@ failure_route[0]{ CANCELs were successfully sent to the pending branches, true if the INVITE was not found, and false in case of any error. - Example 1.83. t_relay_cancel usage + Example 1.84. t_relay_cancel usage if (method == CANCEL) { if (!t_relay_cancel()) { # implicit drop if relaying was successful, # nothing to do @@ -2495,7 +2511,7 @@ if (method == CANCEL) { # do the same as for INVITEs } -4.36. t_lookup_cancel([1]) +4.37. t_lookup_cancel([1]) Returns true if the corresponding INVITE transaction exists for a CANCEL request. The function can be called at the beginning of the @@ -2509,7 +2525,7 @@ if (method == CANCEL) { overwritten with the flags of the INVITE. isflagset() can be used to check the flags of the previously forwarded INVITE in this case. - Example 1.84. t_lookup_cancel usage + Example 1.85. t_lookup_cancel usage if (method == CANCEL) { if (t_lookup_cancel()) { log("INVITE transaction exists"); @@ -2527,7 +2543,7 @@ if (method == CANCEL) { # do the same as for INVITEs } -4.37. t_drop_replies([mode]) +4.38. t_drop_replies([mode]) Drops all the previously received replies in failure_route block to make sure that none of them is picked up again. @@ -2539,7 +2555,7 @@ if (method == CANCEL) { Dropping replies works only if a new branch is added to the transaction, or it is explicitly replied in the script! - Example 1.85. t_drop_replies() usage + Example 1.86. t_drop_replies() usage ... failure_route[0]{ if (t_check_status("5[0-9][0-9]")){ @@ -2555,7 +2571,7 @@ failure_route[0]{ } } -4.38. t_save_lumps() +4.39. t_save_lumps() Forces the modifications of the processed SIP message to be saved in shared memory before t_relay() is called. The new branches which are @@ -2570,7 +2586,7 @@ failure_route[0]{ The transaction must be created by t_newtran() before calling t_save_lumps(). - Example 1.86. t_save_lumps() usage + Example 1.87. t_save_lumps() usage route { ... t_newtran(); @@ -2595,7 +2611,7 @@ failure_route[1] { t_relay(); } -4.39. t_load_contacts([mode]) +4.40. t_load_contacts([mode]) This is the first of the three functions that can be used to implement serial/parallel forking based on q and +sip.instance values of @@ -2644,7 +2660,7 @@ failure_route[1] { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.87. t_load_contacts usage + Example 1.88. t_load_contacts usage ... if (!t_load_contacts()) { sl_send_reply("500", "Server Internal Error - Cannot load contacts"); @@ -2652,7 +2668,7 @@ if (!t_load_contacts()) { }; ... -4.40. t_next_contacts() +4.41. t_next_contacts() Function t_next_contacts() is the second of the three functions that can be used to implement serial/parallel forking based on the q value @@ -2685,7 +2701,7 @@ if (!t_load_contacts()) { contact_flows_avp are not anymore set. Based on that test, you can then use t_set_fr() function to set timers according to your needs. - Example 1.88. t_next_contacts usage + Example 1.89. t_next_contacts usage ... # First call after t_load_contacts() when transaction does not exist yet # and contacts should be available @@ -2704,7 +2720,7 @@ if (!t_next_contacts()) { }; ... -4.41. t_next_contact_flow() +4.42. t_next_contact_flow() Function t_next_contact_flow() is the last of the three functions that can be used to implement serial/parallel forking based on the q value @@ -2723,7 +2739,7 @@ if (!t_next_contacts()) { syslog). This function can be used from a BRANCH_FAILURE_ROUTE event route. - Example 1.89. t_next_contact_flow usage + Example 1.90. t_next_contact_flow usage ... event_route[tm:branch-failure:outbound] { @@ -2735,7 +2751,7 @@ event_route[tm:branch-failure:outbound] } ... -4.42. t_check_status(re) +4.43. t_check_status(re) Returns true if the regular expression “re” match the reply code of the response message as follows: @@ -2746,14 +2762,14 @@ event_route[tm:branch-failure:outbound] This function can be used from ANY_ROUTE . - Example 1.90. t_check_status usage + Example 1.91. t_check_status usage ... if (t_check_status("(487)|(408)")) { log("487 or 408 negative reply\n"); } ... -4.43. t_check_trans() +4.44. t_check_trans() t_check_trans() can be used to quickly check if a message belongs or is related to a transaction. It behaves differently for different types of @@ -2800,12 +2816,12 @@ Note See also: t_lookup_request(), t_lookup_cancel(). - Example 1.91. t_check_trans usage + Example 1.92. t_check_trans usage if ( method == "CANCEL" && !t_check_trans()) sl_reply("403", "cancel out of the blue forbidden"); # note: in this example t_check_trans() can be replaced by t_lookup_cancel() -4.44. t_set_disable_6xx(0|1) +4.45. t_set_disable_6xx(0|1) Turn off/on 6xx replies special rfc conforming handling on a per transaction basis. If turned off (t_set_disable_6xx("1")) 6XXs will be @@ -2815,7 +2831,7 @@ if ( method == "CANCEL" && !t_check_trans()) See also: disable_6xx_block. - Example 1.92. t_set_disable_6xx usage + Example 1.93. t_set_disable_6xx usage ... route { ... @@ -2824,13 +2840,13 @@ route { ... } -4.45. t_set_disable_failover(0|1) +4.46. t_set_disable_failover(0|1) Turn off/on dns failover on a per transaction basis. See also: use_dns_failover. - Example 1.93. t_set_disable_failover usage + Example 1.94. t_set_disable_failover usage ... route { ... @@ -2839,11 +2855,11 @@ route { ... } -4.46. t_set_disable_internal_reply(0|1) +4.47. t_set_disable_internal_reply(0|1) Turn off/on sending internally a SIP reply in case of relay errors. - Example 1.94. t_set_disable_internal_reply usage + Example 1.95. t_set_disable_internal_reply usage ... t_set_disable_internal_reply(1); # turn off sending internal reply on error if(!t_relay()) { @@ -2851,7 +2867,7 @@ if(!t_relay()) { } ... -4.47. t_replicate([params]) +4.48. t_replicate([params]) Replicate the SIP request to a specific address. Return values are the same as for t_relay(). Note that responses to the replicated request @@ -2876,7 +2892,7 @@ if(!t_relay()) { * hostport - address in "host:port" format. It can be given via an AVP. - Example 1.95. t_replicate usage + Example 1.96. t_replicate usage ... # sent to 1.2.3.4:5060 over tcp t_replicate("sip:1.2.3.4:5060;transport=tcp"); @@ -2889,7 +2905,7 @@ t_replicate("sip:$var(h);transport=tls"); t_replicate_to_udp("1.2.3.4", "5060"); ... -4.48. t_relay_to(proxy, flags) +4.49. t_relay_to(proxy, flags) Forward the SIP request to a specific address, controlling internal behavior via flags. @@ -2910,7 +2926,7 @@ t_replicate_to_udp("1.2.3.4", "5060"); + 0x02 - do not generate reply on internal error. + 0x04 - disable dns failover. - Example 1.96. t_relay_to usage + Example 1.97. t_relay_to usage ... # sent to 1.2.3.4:5060 over tcp t_relay_to("tcp:1.2.3.4:5060"); @@ -2922,7 +2938,7 @@ t_relay_to("tls:1.2.3.4"); t_relay_to("0x01"); ... -4.49. t_set_no_e2e_cancel_reason(0|1) +4.50. t_set_no_e2e_cancel_reason(0|1) Enables/disables reason header (RFC 3326) copying from the triggering received CANCEL to the generated hop-by-hop CANCEL. 0 enables and 1 @@ -2936,7 +2952,7 @@ t_relay_to("0x01"); See also: e2e_cancel_reason. - Example 1.97. t_set_no_e2e_cancel_reason usage + Example 1.98. t_set_no_e2e_cancel_reason usage ... route { ... @@ -2946,7 +2962,7 @@ opying ... } -4.50. t_is_set(target) +4.51. t_is_set(target) Return true if the attribute specified by 'target' is set for transaction. @@ -2959,13 +2975,13 @@ opying * onreply_route - the function returns true if an onreply route is set to be executed. - Example 1.98. t_replicate usage + Example 1.99. t_replicate usage ... if(!t_is_set("failure_route")) LM_DBG("no failure route will be executed for current transaction\n"); ... -4.51. t_use_uac_headers() +4.52. t_use_uac_headers() Set internal flags to tell tm to use UAC side for building headers for local generated requests (ACK, CANCEL) - useful when changing From/To @@ -2973,12 +2989,12 @@ if(!t_is_set("failure_route")) It returns true. - Example 1.99. t_use_uac_headers usage + Example 1.100. t_use_uac_headers usage ... t_use_uac_headers(); ... -4.52. t_is_retr_async_reply() +4.53. t_is_retr_async_reply() Check to see if the reply is a retransmitted reply on a transaction that is currently suspended asynchronously (suspended during reply @@ -2992,7 +3008,7 @@ t_use_uac_headers(); returns true if the transaction is currently reply suspended or false if not. - Example 1.100. t_is_retr_async_reply usage + Example 1.101. t_is_retr_async_reply usage ... if (t_is_retr_async_reply()) { xlog("L_DBG", "Dropping retransmitted reply which is still currently sus @@ -3001,7 +3017,7 @@ pended\n"); } ... -4.53. t_uac_send(method, ruri, nexthop, socket, headers, body) +4.54. t_uac_send(method, ruri, nexthop, socket, headers, body) Send a UAC request. @@ -3017,39 +3033,39 @@ pended\n"); Content-Type header must exist. * body - SIP message body (can be empty). - Example 1.101. t_uac_send usage + Example 1.102. t_uac_send usage ... t_uac_send("OPTIONS", "sip:alice@kamailio.org", "", "", "From: bob@kamailio.org;tag=2w3e\r\nTo: bob@kamailio.org", ""); ... -4.54. t_get_status_code() +4.55. t_get_status_code() Return the status code for transaction - the most relevant SIP reply status code, or -1 in case of error or no status code was set. - Example 1.102. t_get_status_code usage + Example 1.103. t_get_status_code usage ... $var(ts) = t_get_status_code(); if($var(ts) == 500) { ... } ... -4.55. t_clean() +4.56. t_clean() Cleans active but very old transactions. Returns true (1). Can be called from any route. - Example 1.103. t_clean usage + Example 1.104. t_clean usage ... t_clean(); ... -4.56. t_exists() +4.57. t_exists() Return true if a transaction for the current message exists, without setting the global references. - Example 1.104. t_exists usage + Example 1.105. t_exists usage ... reply_route { if (!t_exists()) { @@ -3179,7 +3195,7 @@ reply_route { enabled with the t_on_branch_failure function. This event_route uses the BRANCH_FAILURE_ROUTE route type. - Example 1.105. event_route[tm:branch-failure:id] usage + Example 1.106. event_route[tm:branch-failure:id] usage ... request_route { ... @@ -3205,7 +3221,7 @@ event_route[tm:branch-failure:myroute] { The request can still be updated, i.e., changes are possible to R-URI ($ru), destination URI ($du) or the send socket ($fs). - Example 1.106. event_route[tm:local-request] usage + Example 1.107. event_route[tm:local-request] usage ... event_route [tm:local-request] { xlog("L_INFO", "Routing locally generated $rm to $ru\n"); @@ -3218,7 +3234,7 @@ event_route [tm:local-request] { Executed after the tm module sent a local generated, transaction stateful response. - Example 1.107. event_route[tm:local-response] usage + Example 1.108. event_route[tm:local-response] usage ... event_route[tm:local-response] { xlog("tm:local-response replied locally\n");