Module: sip-router Branch: master Commit: 0160d59ce479c40a56ecb35fc9f23537622f53c8 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0160d59c...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Fri May 27 13:21:52 2011 +0200
tmx: two helper functions to detect route block type
- t_is_failure_route() - return true if it is a failure_route execution - t_is_branch_route() - return true if it is a branch_route execution - useful to check in sub-routes executed from different points of config
---
modules_k/tmx/tmx_mod.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/modules_k/tmx/tmx_mod.c b/modules_k/tmx/tmx_mod.c index 1da7fd3..36f7e6c 100644 --- a/modules_k/tmx/tmx_mod.c +++ b/modules_k/tmx/tmx_mod.c @@ -27,6 +27,7 @@ #include "../../sr_module.h" #include "../../dprint.h" #include "../../mod_fix.h" +#include "../../route.h" #include "../../modules/tm/tm_load.h" #include "../../lib/kcore/kstats_wrapper.h"
@@ -54,6 +55,8 @@ static int t_reply_callid(struct sip_msg* msg, char *cid, char *cseq, static int fixup_reply_callid(void** param, int param_no);
static int t_flush_flags(struct sip_msg* msg, char*, char* ); +static int t_is_failure_route(struct sip_msg* msg, char*, char* ); +static int t_is_branch_route(struct sip_msg* msg, char*, char* );
/* statistic variables */ stat_var *tm_rcv_rpls; @@ -139,6 +142,10 @@ static cmd_export_t cmds[]={ fixup_reply_callid, 0, ANY_ROUTE }, {"t_flush_flags", (cmd_function)t_flush_flags, 0, 0, 0, ANY_ROUTE }, + {"t_is_failure_route", (cmd_function)t_is_failure_route, 0, 0, + 0, ANY_ROUTE }, + {"t_is_branch_route", (cmd_function)t_is_branch_route, 0, 0, + 0, ANY_ROUTE }, {0,0,0,0,0,0} };
@@ -419,6 +426,26 @@ static int t_flush_flags(struct sip_msg* msg, char *foo, char *bar) return 1; }
+/** + * + */ +static int t_is_failure_route(struct sip_msg* msg, char *foo, char *bar) +{ + if(route_type==FAILURE_ROUTE) + return 1; + return -1; +} + +/** + * + */ +static int t_is_branch_route(struct sip_msg* msg, char *foo, char *bar) +{ + if(route_type==BRANCH_ROUTE) + return 1; + return -1; +} + #ifdef STATISTICS
/*** tm stats ***/