Module: kamailio
Branch: master
Commit: d161d4523fc6b0619defe918bc204cc7a9cae073
URL:
https://github.com/kamailio/kamailio/commit/d161d4523fc6b0619defe918bc204cc…
Author: Alex Hermann <alex(a)hexla.nl>
Committer: Alex Hermann <alex(a)hexla.nl>
Date: 2020-10-19T15:46:37+02:00
tmx: Allow $T_branch(flags) in onreply_route
---
Modified: src/modules/tmx/t_var.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d161d4523fc6b0619defe918bc204cc…
Patch:
https://github.com/kamailio/kamailio/commit/d161d4523fc6b0619defe918bc204cc…
---
diff --git a/src/modules/tmx/t_var.c b/src/modules/tmx/t_var.c
index 1aa1dc0cff..3e977c9877 100644
--- a/src/modules/tmx/t_var.c
+++ b/src/modules/tmx/t_var.c
@@ -805,14 +805,24 @@ int pv_get_t_branch(struct sip_msg *msg, pv_param_t *param,
" in MODE_ONFAILURE\n", branch);
return pv_get_null(msg, param, res);
}
- res->ri = t->uac[branch].branch_flags;
- res->flags = PV_VAL_INT;
- LM_DBG("branch flags is [%u]\n", res->ri);
+ break;
+ case TM_ONREPLY_ROUTE:
+ tcx = _tmx_tmb.tm_ctx_get();
+ if(tcx == NULL) {
+ LM_ERR("no reply branch\n");
+ return pv_get_null(msg, param, res);
+ }
+ branch = tcx->branch_index;
break;
default:
LM_ERR("unsupported route_type %d\n", get_route_type());
return pv_get_null(msg, param, res);
}
+ if(branch<0 || branch>=t->nr_of_outgoings) {
+ return pv_get_null(msg, param, res);
+ }
+ LM_DBG("branch flags is [%u]\n", t->uac[branch].branch_flags);
+ return pv_get_uintval(msg, param, res, t->uac[branch].branch_flags);
break;
case 6: /* $T_branch(uri) */
if (get_route_type() != TM_ONREPLY_ROUTE) {