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

Alex Hermann alex at hexla.nl
Fri Oct 23 10:34:05 CEST 2020


Module: kamailio
Branch: master
Commit: d161d4523fc6b0619defe918bc204cc7a9cae073
URL: https://github.com/kamailio/kamailio/commit/d161d4523fc6b0619defe918bc204cc7a9cae073

Author: Alex Hermann <alex at hexla.nl>
Committer: Alex Hermann <alex at 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/d161d4523fc6b0619defe918bc204cc7a9cae073.diff
Patch: https://github.com/kamailio/kamailio/commit/d161d4523fc6b0619defe918bc204cc7a9cae073.patch

---

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) {




More information about the sr-dev mailing list