|
@@ -8,9 +8,9 @@ Juha Heinanen
|
|
|
|
|
|
<[email protected]>
|
|
|
|
|
|
- Copyright © 2003 FhG FOKUS
|
|
|
+ Copyright © 2003 FhG FOKUS
|
|
|
|
|
|
- Copyright © 2008 Juha Heinanen
|
|
|
+ Copyright © 2008 Juha Heinanen
|
|
|
Revision History
|
|
|
Revision $Revision$ $Date$
|
|
|
__________________________________________________________________
|
|
@@ -57,6 +57,8 @@ Juha Heinanen
|
|
|
1.4.35. disable_6xx_block (integer)
|
|
|
1.4.36. local_ack_mode (integer)
|
|
|
1.4.37. failure_reply_mode (integer)
|
|
|
+ 1.4.38. local_cancel_reason (boolean)
|
|
|
+ 1.4.39. e2e_cancel_reason (boolean)
|
|
|
|
|
|
1.5. Functions
|
|
|
|
|
@@ -105,6 +107,7 @@ Juha Heinanen
|
|
|
1.5.35. t_set_disable_failover(0|1)
|
|
|
1.5.36. t_replicate(params)
|
|
|
1.5.37. t_relay_to(proxy, flags)
|
|
|
+ 1.5.38. t_set_no_e2e_cancel_reason(0|1)
|
|
|
|
|
|
1.6. TM Module API
|
|
|
|
|
@@ -174,7 +177,7 @@ Juha Heinanen
|
|
|
Note
|
|
|
|
|
|
Several Kamailio (OpenSER) TM module functionalities are now
|
|
|
- implemented in the TMX module: “modules_k/tmx�. Check it to see if what
|
|
|
+ implemented in the TMX module: "modules_k/tmx". Check it to see if what
|
|
|
you are looking for is there.
|
|
|
|
|
|
1.2. Serial Forking Based on Q Value
|
|
@@ -1131,6 +1134,42 @@ modparam("tm", "local_ack_mode", 1)
|
|
|
modparam("tm", "failure_reply_mode", 3)
|
|
|
...
|
|
|
|
|
|
+1.4.38. local_cancel_reason (boolean)
|
|
|
+
|
|
|
+ Enables/disables adding reason headers (RFC 3326) for CANCELs generated
|
|
|
+ due to receiving a final reply. The reason header added will look like:
|
|
|
+ "Reason: SIP;cause=<final_reply_code>".
|
|
|
+
|
|
|
+ Default value is 1 (enabled).
|
|
|
+
|
|
|
+ Can be set at runtime, e.g.:
|
|
|
+ $ sercmd cfg.set_now_int tm local_cancel_reason 0
|
|
|
+
|
|
|
+ See also: e2e_cancel_reason.
|
|
|
+
|
|
|
+ Example 38. Set local_cancel_reason parameter
|
|
|
+...
|
|
|
+modparam("tm", "local_cancel_reason", "0")
|
|
|
+...
|
|
|
+
|
|
|
+1.4.39. e2e_cancel_reason (boolean)
|
|
|
+
|
|
|
+ Enables/disables adding reason headers (RFC 3326) for CANCELs generated
|
|
|
+ due to a received CANCEL. If enabled the reason headers from received
|
|
|
+ CANCELs will be copied into the generated hop-by-hop CANCELs.
|
|
|
+
|
|
|
+ Default value is 1 (enabled).
|
|
|
+
|
|
|
+ Can be changed at runtime, e.g.:
|
|
|
+ $ sercmd cfg.set_now_int tm e2e_cancel_reason 0
|
|
|
+
|
|
|
+ See also: t_set_no_e2e_cancel_reason() and local_cancel_reason.
|
|
|
+
|
|
|
+ Example 39. Set e2e_cancel_reason parameter
|
|
|
+...
|
|
|
+modparam("tm", "e2e_cancel_reason", "0")
|
|
|
+...
|
|
|
+
|
|
|
1.5. Functions
|
|
|
|
|
|
Revision History
|
|
@@ -1156,7 +1195,7 @@ t_relay_to_sctp(ip, port) t_relay_to_sctp()
|
|
|
derived from the message uri (using sip sepcific DNS lookups), but with
|
|
|
the protocol corresponding to the function name.
|
|
|
|
|
|
- Example 38. t_relay_to_udp usage
|
|
|
+ Example 40. t_relay_to_udp usage
|
|
|
...
|
|
|
if (src_ip==10.0.0.0/8)
|
|
|
t_relay_to_udp("1.2.3.4", "5060"); # sent to 1.2.3.4:5060 over udp
|
|
@@ -1183,7 +1222,7 @@ else
|
|
|
Returns a negative value on failure--you may still want to send a
|
|
|
negative reply upstream statelessly not to leave upstream UAC in lurch.
|
|
|
|
|
|
- Example 39. t_relay usage
|
|
|
+ Example 41. t_relay usage
|
|
|
...
|
|
|
if (!t_relay())
|
|
|
{
|
|
@@ -1212,7 +1251,7 @@ if (!t_relay())
|
|
|
Meaning of the parameters is as follows:
|
|
|
* failure_route - Failure route block to be called.
|
|
|
|
|
|
- Example 40. t_on_failure usage
|
|
|
+ Example 42. t_on_failure usage
|
|
|
...
|
|
|
route {
|
|
|
t_on_failure("1");
|
|
@@ -1238,7 +1277,7 @@ failure_route[1] {
|
|
|
Meaning of the parameters is as follows:
|
|
|
* onreply_route - Onreply route block to be called.
|
|
|
|
|
|
- Example 41. t_on_reply usage
|
|
|
+ Example 43. t_on_reply usage
|
|
|
...
|
|
|
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
|
|
|
...
|
|
@@ -1270,7 +1309,7 @@ es');
|
|
|
Meaning of the parameters is as follows:
|
|
|
* branch_route - branch route block to be called.
|
|
|
|
|
|
- Example 42. t_on_branch usage
|
|
|
+ Example 44. t_on_branch usage
|
|
|
...
|
|
|
route {
|
|
|
t_on_branch("1");
|
|
@@ -1288,7 +1327,7 @@ branch_route[1] {
|
|
|
Similarly to t_fork_to, it extends destination set by a new entry. The
|
|
|
difference is that current URI is taken as new entry.
|
|
|
|
|
|
- Example 43. append_branch usage
|
|
|
+ Example 45. append_branch usage
|
|
|
...
|
|
|
set_user("john");
|
|
|
t_fork();
|
|
@@ -1303,7 +1342,7 @@ t_relay();
|
|
|
the only way a script can add a new transaction in an atomic way.
|
|
|
Typically, it is used to deploy a UAS.
|
|
|
|
|
|
- Example 44. t_newtran usage
|
|
|
+ Example 46. t_newtran usage
|
|
|
...
|
|
|
if (t_newtran()) {
|
|
|
log("UAS logic");
|
|
@@ -1322,7 +1361,7 @@ if (t_newtran()) {
|
|
|
* code - Reply code number.
|
|
|
* reason_phrase - Reason string.
|
|
|
|
|
|
- Example 45. t_reply usage
|
|
|
+ Example 47. t_reply usage
|
|
|
...
|
|
|
t_reply("404", "Not found");
|
|
|
...
|
|
@@ -1335,7 +1374,7 @@ t_reply("404", "Not found");
|
|
|
none was found. However this is safely (atomically) done using
|
|
|
t_newtran.
|
|
|
|
|
|
- Example 46. t_lookup_request usage
|
|
|
+ Example 48. t_lookup_request usage
|
|
|
...
|
|
|
if (t_lookup_request()) {
|
|
|
...
|
|
@@ -1346,7 +1385,7 @@ if (t_lookup_request()) {
|
|
|
|
|
|
Retransmits a reply sent previously by UAS transaction.
|
|
|
|
|
|
- Example 47. t_retransmit_reply usage
|
|
|
+ Example 49. t_retransmit_reply usage
|
|
|
...
|
|
|
t_retransmit_reply();
|
|
|
...
|
|
@@ -1356,7 +1395,7 @@ t_retransmit_reply();
|
|
|
Remove transaction from memory (it will be first put on a wait timer to
|
|
|
absorb delayed messages).
|
|
|
|
|
|
- Example 48. t_release usage
|
|
|
+ Example 50. t_release usage
|
|
|
...
|
|
|
t_release();
|
|
|
...
|
|
@@ -1371,7 +1410,7 @@ t_forward_nonack_tls(ip, port) t_forward_nonack_sctp(ip, port)
|
|
|
* ip - IP address where the message should be sent.
|
|
|
* port - Port number.
|
|
|
|
|
|
- Example 49. t_forward_nonack usage
|
|
|
+ Example 51. t_forward_nonack usage
|
|
|
...
|
|
|
t_forward_nonack("1.2.3.4", "5060");
|
|
|
...
|
|
@@ -1394,7 +1433,7 @@ t_forward_nonack("1.2.3.4", "5060");
|
|
|
|
|
|
See also: fr_timer, fr_inv_timer, t_reset_fr().
|
|
|
|
|
|
- Example 50. t_set_fr usage
|
|
|
+ Example 52. t_set_fr usage
|
|
|
...
|
|
|
route {
|
|
|
t_set_fr(10000); # set only fr invite timeout to 10s
|
|
@@ -1421,7 +1460,7 @@ branch_route[1] {
|
|
|
|
|
|
See also: fr_timer, fr_inv_timer, t_set_fr.
|
|
|
|
|
|
- Example 51. t_reset_fr usage
|
|
|
+ Example 53. t_reset_fr usage
|
|
|
...
|
|
|
route {
|
|
|
...
|
|
@@ -1447,7 +1486,7 @@ route {
|
|
|
|
|
|
See also: max_inv_lifetime, max_noninv_lifetime, t_reset_max_lifetime.
|
|
|
|
|
|
- Example 52. t_set_max_lifetime usage
|
|
|
+ Example 54. t_set_max_lifetime usage
|
|
|
...
|
|
|
route {
|
|
|
if (src_ip=1.2.3.4)
|
|
@@ -1469,7 +1508,7 @@ route {
|
|
|
|
|
|
See also: max_inv_lifetime, max_noninv_lifetime, t_set_max_lifetime.
|
|
|
|
|
|
- Example 53. t_reset_max_lifetime usage
|
|
|
+ Example 55. t_reset_max_lifetime usage
|
|
|
...
|
|
|
route {
|
|
|
...
|
|
@@ -1507,7 +1546,7 @@ route {
|
|
|
|
|
|
See also: retr_timer1, retr_timer2, t_reset_retr().
|
|
|
|
|
|
- Example 54. t_set_retr usage
|
|
|
+ Example 56. t_set_retr usage
|
|
|
...
|
|
|
route {
|
|
|
t_set_retr(250, 0); # set only T1 to 250 ms
|
|
@@ -1534,7 +1573,7 @@ branch_route[1] {
|
|
|
|
|
|
See also: retr_timer1, retr_timer2, t_set_retr.
|
|
|
|
|
|
- Example 55. t_reset_retr usage
|
|
|
+ Example 57. t_reset_retr usage
|
|
|
...
|
|
|
route {
|
|
|
...
|
|
@@ -1550,7 +1589,7 @@ route {
|
|
|
|
|
|
See also: auto_inv_100.
|
|
|
|
|
|
- Example 56. t_set_auto_inv_100 usage
|
|
|
+ Example 58. t_set_auto_inv_100 usage
|
|
|
...
|
|
|
route {
|
|
|
...
|
|
@@ -1564,7 +1603,7 @@ route {
|
|
|
Returns true if the failure route is executed for a branch that did
|
|
|
timeout. It can be used only from the failure_route.
|
|
|
|
|
|
- Example 57. t_branch_timeout usage
|
|
|
+ Example 59. t_branch_timeout usage
|
|
|
...
|
|
|
failure_route[0]{
|
|
|
if (t_branch_timeout()){
|
|
@@ -1579,7 +1618,7 @@ failure_route[0]{
|
|
|
receive at least one reply in the past (the "current" reply is not
|
|
|
taken into account). It can be used only from the failure_route.
|
|
|
|
|
|
- Example 58. t_branch_replied usage
|
|
|
+ Example 60. t_branch_replied usage
|
|
|
...
|
|
|
failure_route[0]{
|
|
|
if (t_branch_timeout()){
|
|
@@ -1596,7 +1635,7 @@ failure_route[0]{
|
|
|
Returns true if at least one of the current transactions branches did
|
|
|
timeout.
|
|
|
|
|
|
- Example 59. t_any_timeout usage
|
|
|
+ Example 61. t_any_timeout usage
|
|
|
...
|
|
|
failure_route[0]{
|
|
|
if (!t_branch_timeout()){
|
|
@@ -1613,7 +1652,7 @@ failure_route[0]{
|
|
|
receive some reply in the past. If called from a failure or onreply
|
|
|
route, the "current" reply is not taken into account.
|
|
|
|
|
|
- Example 60. t_any_replied usage
|
|
|
+ Example 62. t_any_replied usage
|
|
|
...
|
|
|
onreply_route[0]{
|
|
|
if (!t_any_replied()){
|
|
@@ -1627,7 +1666,7 @@ onreply_route[0]{
|
|
|
Returns true if "code" is the final reply received (or locally
|
|
|
generated) in at least one of the current transactions branches.
|
|
|
|
|
|
- Example 61. t_grep_status usage
|
|
|
+ Example 63. t_grep_status usage
|
|
|
...
|
|
|
onreply_route[0]{
|
|
|
if (t_grep_status("486")){
|
|
@@ -1640,7 +1679,7 @@ onreply_route[0]{
|
|
|
|
|
|
Returns true if the current transaction was canceled.
|
|
|
|
|
|
- Example 62. t_is_canceled usage
|
|
|
+ Example 64. t_is_canceled usage
|
|
|
...
|
|
|
failure_route[0]{
|
|
|
if (t_is_canceled()){
|
|
@@ -1654,7 +1693,7 @@ failure_route[0]{
|
|
|
Returns true if the current transaction has already been expired, i.e.
|
|
|
the max_inv_lifetime/max_noninv_lifetime interval has already elapsed.
|
|
|
|
|
|
- Example 63. t_is_expired usage
|
|
|
+ Example 65. t_is_expired usage
|
|
|
...
|
|
|
failure_route[0]{
|
|
|
if (t_is_expired()){
|
|
@@ -1675,7 +1714,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 64. t_relay_cancel usage
|
|
|
+ Example 66. t_relay_cancel usage
|
|
|
if (method == CANCEL) {
|
|
|
if (!t_relay_cancel()) { # implicit drop if relaying was successful,
|
|
|
# nothing to do
|
|
@@ -1702,7 +1741,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 65. t_lookup_cancel usage
|
|
|
+ Example 67. t_lookup_cancel usage
|
|
|
if (method == CANCEL) {
|
|
|
if (t_lookup_cancel()) {
|
|
|
log("INVITE transaction exists");
|
|
@@ -1732,7 +1771,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 66. t_drop_replies() usage
|
|
|
+ Example 68. t_drop_replies() usage
|
|
|
...
|
|
|
failure_route[0]{
|
|
|
if (t_check_status("5[0-9][0-9]")){
|
|
@@ -1763,7 +1802,7 @@ failure_route[0]{
|
|
|
The transaction must be created by t_newtran() before calling
|
|
|
t_save_lumps().
|
|
|
|
|
|
- Example 67. t_save_lumps() usage
|
|
|
+ Example 69. t_save_lumps() usage
|
|
|
route {
|
|
|
...
|
|
|
t_newtran();
|
|
@@ -1833,7 +1872,7 @@ failure_route[1] {
|
|
|
|
|
|
This function can be used from REQUEST_ROUTE.
|
|
|
|
|
|
- Example 68. t_load_contacts usage
|
|
|
+ Example 70. t_load_contacts usage
|
|
|
...
|
|
|
if (!t_load_contacts()) {
|
|
|
sl_send_reply("500", "Server Internal Error - Cannot load contacts");
|
|
@@ -1874,7 +1913,7 @@ if (!t_load_contacts()) {
|
|
|
anymore set. Based on that test, you can then use t_set_fr() function
|
|
|
to set timers according to your needs.
|
|
|
|
|
|
- Example 69. t_next_contacts usage
|
|
|
+ Example 71. t_next_contacts usage
|
|
|
...
|
|
|
# First call after t_load_contacts() when transaction does not exist yet
|
|
|
# and contacts should be available
|
|
@@ -1938,7 +1977,7 @@ Note
|
|
|
|
|
|
See also: t_lookup_request(), t_lookup_cancel().
|
|
|
|
|
|
- Example 70. t_check_trans usage
|
|
|
+ Example 72. 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()
|
|
@@ -1953,7 +1992,7 @@ if ( method == "CANCEL" && !t_check_trans())
|
|
|
|
|
|
See also: disable_6xx_block.
|
|
|
|
|
|
- Example 71. t_set_disable_6xx usage
|
|
|
+ Example 73. t_set_disable_6xx usage
|
|
|
...
|
|
|
route {
|
|
|
...
|
|
@@ -1968,7 +2007,7 @@ route {
|
|
|
|
|
|
See also: use_dns_failover.
|
|
|
|
|
|
- Example 72. t_set_disable_failover usage
|
|
|
+ Example 74. t_set_disable_failover usage
|
|
|
...
|
|
|
route {
|
|
|
...
|
|
@@ -1999,7 +2038,7 @@ route {
|
|
|
* hostport - address in "host:port" format. It can be given via an
|
|
|
AVP.
|
|
|
|
|
|
- Example 73. t_replicate usage
|
|
|
+ Example 75. t_replicate usage
|
|
|
...
|
|
|
# sent to 1.2.3.4:5060 over tcp
|
|
|
t_replicate("sip:1.2.3.4:5060;transport=tcp");
|
|
@@ -2034,7 +2073,7 @@ t_replicate_to_udp("1.2.3.4", "5060");
|
|
|
effect anymore).
|
|
|
+ 0x04 - disable dns failover.
|
|
|
|
|
|
- Example 74. t_replicate usage
|
|
|
+ Example 76. t_replicate usage
|
|
|
...
|
|
|
# sent to 1.2.3.4:5060 over tcp
|
|
|
t_relay_to("tcp:1.2.3.4:5060");
|
|
@@ -2046,6 +2085,27 @@ t_relay_to("tls:1.2.3.4");
|
|
|
t_relay_to("0x01");
|
|
|
...
|
|
|
|
|
|
+1.5.38. 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
|
|
|
+ disables.
|
|
|
+
|
|
|
+ It overrides the e2e_cancel_reason setting (module parameter) for the
|
|
|
+ current transaction.
|
|
|
+
|
|
|
+ See also: e2e_cancel_reason.
|
|
|
+
|
|
|
+ Example 77. t_set_no_e2e_cancel_reason usage
|
|
|
+...
|
|
|
+route {
|
|
|
+...
|
|
|
+ if (src_ip!=10.0.0.0/8) # don't trust CANCELs from the outside
|
|
|
+ t_set_no_e2e_cancel_reason(1); # turn off CANCEL reason header c
|
|
|
+opying
|
|
|
+...
|
|
|
+}
|
|
|
+
|
|
|
1.6. TM Module API
|
|
|
|
|
|
Revision History
|