Browse code

tmx: added $T(ruid)

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

Daniel-Constantin Mierla authored on 16/11/2015 15:38:57
Showing 1 changed files
... ...
@@ -646,6 +646,11 @@ int pv_parse_t_name(pv_spec_p sp, str *in)
646 646
 				sp->pvp.pvn.u.isname.name.n = 6;
647 647
 			else goto error;
648 648
 			break;
649
+		case 4:
650
+			if(strncmp(in->s, "ruid", 4) == 0)
651
+				sp->pvp.pvn.u.isname.name.n = 7;
652
+			else goto error;
653
+			break;
649 654
 		case 5:
650 655
 			if(strncmp(in->s, "flags", 5) == 0)
651 656
 				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,
773 773
 				return pv_get_null(msg, param, res);
774 774
 			}
775 775
 			return pv_get_strval(msg, param, res, &t->uac[branch].uri);
776
+		case 7: /* $T_branch(ruid) */
777
+			switch(route_type) {
778
+				case BRANCH_ROUTE:
779
+					/* branch and branch_failure routes have their index set */
780
+					tcx = _tmx_tmb.tm_ctx_get();
781
+					if(tcx == NULL)
782
+						return pv_get_null(msg, param, res);
783
+					return pv_get_strval(msg, param, res, &t->uac[tcx->branch_index].ruid);
784
+				break;
785
+				default:
786
+					return pv_get_tm_reply_ruid(msg, param, res);
787
+			}
788
+
776 789
 	}
777 790
 	return 0;
778 791
 }