[sr-dev] git:5.3:fda40721: tmx: Allow $T_branch(flags) in onreply_route

Daniel-Constantin Mierla miconda at gmail.com
Fri Oct 30 14:50:57 CET 2020


Module: kamailio
Branch: 5.3
Commit: fda40721c90314694cc799238323cdb70ea9bf2b
URL: https://github.com/kamailio/kamailio/commit/fda40721c90314694cc799238323cdb70ea9bf2b

Author: Alex Hermann <alex at hexla.nl>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-10-30T14:46:35+01:00

tmx: Allow $T_branch(flags) in onreply_route

(cherry picked from commit d161d4523fc6b0619defe918bc204cc7a9cae073)
(cherry picked from commit dc2336f541eb27d0a034f4c72a26c40270cfea70)

---

Modified: src/modules/tmx/t_var.c

---

Diff:  https://github.com/kamailio/kamailio/commit/fda40721c90314694cc799238323cdb70ea9bf2b.diff
Patch: https://github.com/kamailio/kamailio/commit/fda40721c90314694cc799238323cdb70ea9bf2b.patch

---

diff --git a/src/modules/tmx/t_var.c b/src/modules/tmx/t_var.c
index 6f1848f2d1..5b63abeed6 100644
--- a/src/modules/tmx/t_var.c
+++ b/src/modules/tmx/t_var.c
@@ -803,14 +803,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) {




More information about the sr-dev mailing list