2
0
Эх сурвалжийг харах

tsilo: use current r-uri for ts_store()

- msg->first_line.u.request.uri is always the incoming r-uri (never
  updated inside the msg structure)
- if $ru was updated, msg->new_uri is set with the new value
- if incoming r-uri is wanted back after $ru was updated, revert_uri()
  can be used
- if only incoming r-uri is allowed, then the function doesn't work when
  dialing an alias or a short number
Daniel-Constantin Mierla 10 жил өмнө
parent
commit
1e5bad019c
1 өөрчлөгдсөн 12 нэмэгдсэн , 5 устгасан
  1. 12 5
      modules/tsilo/ts_store.c

+ 12 - 5
modules/tsilo/ts_store.c

@@ -43,21 +43,28 @@ int ts_store(struct sip_msg* msg) {
 	struct cell		*t;
 	str aor;
 	struct sip_uri ruri;
+	str suri;
 
 	ts_urecord_t* r;
 	int res;
 
-
+	if (msg->new_uri.s!=NULL) {
+		/* incoming r-uri was chaged by cfg or other component */
+		suri = msg->new_uri;
+	} else {
+		/* no changes to incoming r-uri */
+		suri = msg->first_line.u.request.uri;
+	}
 
 	if (use_domain) {
-		aor = msg->first_line.u.request.uri;
+		aor = suri;
 	}
 	else {
-		if (parse_uri(msg->first_line.u.request.uri.s, msg->first_line.u.request.uri.len, &ruri)!=0)
+		if (parse_uri(suri.s, suri.len, &ruri)!=0)
 		{
 			LM_ERR("bad uri [%.*s]\n",
-					msg->first_line.u.request.uri.len,
-					msg->first_line.u.request.uri.s);
+					suri.len,
+					suri.s);
 			return -1;
 		}
 		aor = ruri.user;