Module: kamailio Branch: master Commit: cae249d58c1155c2f13c56e8f1251fcadb5483c0 URL: https://github.com/kamailio/kamailio/commit/cae249d58c1155c2f13c56e8f1251fca...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2017-12-08T09:47:38+01:00
tm: restore backup char inside ki_t_check_status()
---
Modified: src/modules/tm/tm.c
---
Diff: https://github.com/kamailio/kamailio/commit/cae249d58c1155c2f13c56e8f1251fca... Patch: https://github.com/kamailio/kamailio/commit/cae249d58c1155c2f13c56e8f1251fca...
---
diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c index 7d7145393b..90f9a989ea 100644 --- a/src/modules/tm/tm.c +++ b/src/modules/tm/tm.c @@ -995,6 +995,7 @@ static int ki_t_check_status(sip_msg_t* msg, str *sexp) /* first get the transaction */ if (t_check(msg, 0 ) == -1) return -1;
+ backup = 0; if ((t = get_t()) == 0) { LM_ERR("cannot check status for a reply" " which has no T-state established\n"); @@ -1010,7 +1011,7 @@ static int ki_t_check_status(sip_msg_t* msg, str *sexp) switch(get_route_type()) { case REQUEST_ROUTE: /* use the status of the last sent reply */ - status = int2str( t->uas.status, 0); + status = int2str(t->uas.status, 0); break;
case TM_ONREPLY_ROUTE: @@ -1037,7 +1038,7 @@ static int ki_t_check_status(sip_msg_t* msg, str *sexp) " a final response in FAILURE_ROUTE\n"); goto error; } - status = int2str( lowest_status , 0); + status = int2str(lowest_status, 0); break; case BRANCH_FAILURE_ROUTE: status = int2str(t->uac[get_t_branch()].last_received, 0); @@ -1052,6 +1053,7 @@ static int ki_t_check_status(sip_msg_t* msg, str *sexp) /* do the checking */ n = regexec(&re, status, 1, &pmatch, 0);
+ if (backup) status[msg->first_line.u.reply.status.len] = backup; regfree(&re);
if (unlikely(t && is_route_type(CORE_ONREPLY_ROUTE))){ @@ -2979,4 +2981,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2) { sr_kemi_modules_add(tm_kemi_exports); return 0; -} \ No newline at end of file +}