[sr-dev] git:master:73c29912: tmx: added $T(ruid)

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 16 16:40:09 CET 2015


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-11-16T16:38:57+01:00

tmx: added $T(ruid)

- return current branch ruid attribute
- same as $T_reply_ruid, but works also for branch route

---

Modified: modules/tmx/t_var.c

---

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

---

diff --git a/modules/tmx/t_var.c b/modules/tmx/t_var.c
index 7b61a49..bcd5839 100644
--- a/modules/tmx/t_var.c
+++ b/modules/tmx/t_var.c
@@ -646,6 +646,11 @@ int pv_parse_t_name(pv_spec_p sp, str *in)
 				sp->pvp.pvn.u.isname.name.n = 6;
 			else goto error;
 			break;
+		case 4:
+			if(strncmp(in->s, "ruid", 4) == 0)
+				sp->pvp.pvn.u.isname.name.n = 7;
+			else goto error;
+			break;
 		case 5:
 			if(strncmp(in->s, "flags", 5) == 0)
 				sp->pvp.pvn.u.isname.name.n = 5;
@@ -773,6 +778,19 @@ int pv_get_t_branch(struct sip_msg *msg,  pv_param_t *param,
 				return pv_get_null(msg, param, res);
 			}
 			return pv_get_strval(msg, param, res, &t->uac[branch].uri);
+		case 7: /* $T_branch(ruid) */
+			switch(route_type) {
+				case BRANCH_ROUTE:
+					/* branch and branch_failure routes have their index set */
+					tcx = _tmx_tmb.tm_ctx_get();
+					if(tcx == NULL)
+						return pv_get_null(msg, param, res);
+					return pv_get_strval(msg, param, res, &t->uac[tcx->branch_index].ruid);
+				break;
+				default:
+					return pv_get_tm_reply_ruid(msg, param, res);
+			}
+
 	}
 	return 0;
 }




More information about the sr-dev mailing list