Module: kamailio Branch: master Commit: dc2838649343f1a75cd4443ae3004f0916ea7068 URL: https://github.com/kamailio/kamailio/commit/dc2838649343f1a75cd4443ae3004f09...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2018-03-14T17:36:59+01:00
tmx: added t_flush_xflags() function
---
Modified: src/modules/tmx/tmx_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/dc2838649343f1a75cd4443ae3004f09... Patch: https://github.com/kamailio/kamailio/commit/dc2838649343f1a75cd4443ae3004f09...
---
diff --git a/src/modules/tmx/tmx_mod.c b/src/modules/tmx/tmx_mod.c index 770fcc20bf..2a703362d6 100644 --- a/src/modules/tmx/tmx_mod.c +++ b/src/modules/tmx/tmx_mod.c @@ -67,6 +67,7 @@ static int t_reply_callid(sip_msg_t* msg, char *cid, char *cseq, static int fixup_reply_callid(void** param, int param_no);
static int t_flush_flags(sip_msg_t* msg, char*, char* ); +static int t_flush_xflags(sip_msg_t* msg, char *, char *); static int w_t_is_failure_route(sip_msg_t* msg, char*, char* ); static int w_t_is_branch_route(sip_msg_t* msg, char*, char* ); static int w_t_is_reply_route(sip_msg_t* msg, char*, char*); @@ -176,6 +177,8 @@ 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_flush_xflags", (cmd_function)t_flush_xflags, 0, 0, + 0, ANY_ROUTE }, {"t_is_failure_route", (cmd_function)w_t_is_failure_route, 0, 0, 0, ANY_ROUTE }, {"t_is_branch_route", (cmd_function)w_t_is_branch_route, 0, 0, @@ -589,6 +592,33 @@ static int t_flush_flags(sip_msg_t* msg, char *foo, char *bar) return ki_t_flush_flags(msg); }
+/** + * + */ +static int ki_t_flush_xflags(sip_msg_t* msg) +{ + tm_cell_t *t; + + t=_tmx_tmb.t_gett(); + if ( t==0 || t==T_UNDEFINED) { + LM_ERR("failed to flush flags - no transaction found\n"); + return -1; + } + + memcpy(t->uas.request->xflags, msg->xflags, + KSR_XFLAGS_SIZE * sizeof(flag_t)); + return 1; +} + +/** + * + */ +static int t_flush_xflags(sip_msg_t* msg, char *foo, char *bar) +{ + return ki_t_flush_xflags(msg); +} + + /** * */ @@ -1036,6 +1066,11 @@ static sr_kemi_t sr_kemi_tmx_exports[] = { { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, + { str_init("tmx"), str_init("t_flush_xflags"), + SR_KEMIP_INT, ki_t_flush_xflags, + { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, { str_init("tmx"), str_init("t_cancel_branches"), SR_KEMIP_INT, ki_t_cancel_branches, { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,