diff --git a/src/modules/tm/README b/src/modules/tm/README index 34613eda0fc..08d245f1e1a 100644 --- a/src/modules/tm/README +++ b/src/modules/tm/README @@ -135,6 +135,7 @@ Daniel-Constantin Mierla body) 4.54. t_get_status_code() + 4.55. t_clean() 5. RPC Commands @@ -270,9 +271,10 @@ Daniel-Constantin Mierla 1.94. t_is_retr_async_reply usage 1.95. t_uac_send usage 1.96. t_get_status_code usage - 1.97. event_route[tm:branch-failure:id] usage - 1.98. event_route[tm:local-request] usage - 1.99. event_route[tm:local-response] usage + 1.97. t_clean usage + 1.98. event_route[tm:branch-failure:id] usage + 1.99. event_route[tm:local-request] usage + 1.100. event_route[tm:local-response] usage Chapter 1. Admin Guide @@ -388,6 +390,7 @@ Chapter 1. Admin Guide 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() 5. RPC Commands @@ -1740,6 +1743,7 @@ modparam("tm", "rich_redirect", 3) 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.1. t_relay([host, port]) @@ -2912,6 +2916,16 @@ $var(ts) = t_get_status_code(); if($var(ts) == 500) { ... } ... +4.55. t_clean() + + Cleans active but very old transactions. Returns true (1). Can be + called from any route. + + Example 1.97. t_clean usage +... +t_clean(); +... + 5. RPC Commands 5.1. tm.list @@ -3025,7 +3039,7 @@ if($var(ts) == 500) { ... } enabled with the t_on_branch_failure function. This event_route uses the BRANCH_FAILURE_ROUTE route type. - Example 1.97. event_route[tm:branch-failure:id] usage + Example 1.98. event_route[tm:branch-failure:id] usage ... request_route { ... @@ -3051,7 +3065,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.98. event_route[tm:local-request] usage + Example 1.99. event_route[tm:local-request] usage ... event_route [tm:local-request] { xlog("L_INFO", "Routing locally generated $rm to $ru\n"); @@ -3064,7 +3078,7 @@ event_route [tm:local-request] { Executed after the tm module sent a local generated, transaction stateful response. - Example 1.99. event_route[tm:local-response] usage + Example 1.100. event_route[tm:local-response] usage ... event_route[tm:local-response] { xlog("tm:local-response replied locally\n"); diff --git a/src/modules/tm/doc/functions.xml b/src/modules/tm/doc/functions.xml index 1935fe394a2..acfc590ffda 100644 --- a/src/modules/tm/doc/functions.xml +++ b/src/modules/tm/doc/functions.xml @@ -3,10 +3,10 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
- - Functions + +
@@ -1890,4 +1890,21 @@ if($var(ts) == 500) { ... } </programlisting> </example> </section> + <section id="tm.f.t_clean"> + <title> + <function>t_clean()</function> + + + Cleans active but very old transactions. Returns true (1). Can be + called from any route. + + + <function>t_clean</function> usage + +... +t_clean(); +... + +
+
diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c index 8bcb1bd5706..ec39c3cd490 100644 --- a/src/modules/tm/tm.c +++ b/src/modules/tm/tm.c @@ -208,6 +208,7 @@ static int w_t_uac_send(sip_msg_t* msg, char* pmethod, char* pruri, char* pnexthop, char* psock, char *phdrs, char* pbody); static int w_t_get_status_code(sip_msg_t* msg, char *p1, char *p2); +static int t_clean(struct sip_msg* msg, char* key, char* value); /* by default the fr timers avps are not set, so that the avps won't be * searched for nothing each time a new transaction is created */ @@ -411,6 +412,7 @@ static cmd_export_t cmds[]={ REQUEST_ROUTE | FAILURE_ROUTE}, {"t_next_contact_flow", t_next_contact_flow, 0, 0, 0, REQUEST_ROUTE }, + {"t_clean", t_clean, 0, 0, 0, ANY_ROUTE }, /* not applicable from the script */ {"load_tm", (cmd_function)load_tm, NO_SCRIPT, 0, 0, 0}, @@ -2952,6 +2954,13 @@ static int ki_t_relay_to_flags(sip_msg_t *msg, int rflags) return ki_t_relay_to_proxy_flags(msg, NULL, rflags); } +/* script function to clean active but very old transactions */ +static int t_clean(struct sip_msg* msg, char* key, char* value) +{ + tm_clean_lifetime(); + return 1; +} + /** * */