Browse code

Merge 582173070e01637653a6f83b6c905c8851e6ec80 into 1fbdc35c3d29da048cb06bfe0268c503c5015c3c

braams authored on 27/09/2022 08:35:19 • GitHub committed on 27/09/2022 08:35:19
Showing 1 changed files
... ...
@@ -240,7 +240,7 @@ void tm_rpc_response_list_clean(unsigned int ticks, void *param)
240 240
 static int rpc_uac_check_msg(rpc_t *rpc, void* c,
241 241
 		struct sip_msg* msg,
242 242
 		str* method, str* body,
243
-		int* fromtag, int *cseq_is, int* cseq,
243
+		str* fromtag, int *cseq_is, int* cseq,
244 244
 		str* callid)
245 245
 {
246 246
 	struct to_body* parsed_from;
... ...
@@ -275,7 +275,13 @@ static int rpc_uac_check_msg(rpc_t *rpc, void* c,
275 275
 	}
276 276
 
277 277
 	parsed_from = (struct to_body*)msg->from->parsed;
278
-	*fromtag = parsed_from->tag_value.s && parsed_from->tag_value.len;
278
+	if(parsed_from->tag_value.s && parsed_from->tag_value.len) {
279
+		fromtag->s = parsed_from->tag_value.s;
280
+		fromtag->len = parsed_from->tag_value.len;
281
+	} else {
282
+		fromtag->s = NULL;
283
+		fromtag->len = 0;
284
+	}
279 285
 
280 286
 	*cseq = 0;
281 287
 	if (msg->cseq && (parsed_cseq = get_cseq(msg))) {
... ...
@@ -634,7 +640,8 @@ static void rpc_t_uac(rpc_t* rpc, void* c, int reply_wait)
634 640
 	struct socket_info* ssock;
635 641
 	str saddr;
636 642
 	int sport, sproto;
637
-	int ret, sip_error, err_ret, fromtag, cseq_is, cseq;
643
+	int ret, sip_error, err_ret, cseq_is, cseq;
644
+	str fromtag;
638 645
 	char err_buf[MAX_REASON_LEN];
639 646
 	dlg_t dlg;
640 647
 	uac_req_t uac_req;
... ...
@@ -728,7 +735,9 @@ static void rpc_t_uac(rpc_t* rpc, void* c, int reply_wait)
728 735
 	 */
729 736
 
730 737
 	/* Generate fromtag if not present */
731
-	if (!fromtag) {
738
+	if (fromtag.s && fromtag.len) {
739
+		dlg.id.loc_tag = fromtag;
740
+	} else {
732 741
 		generate_fromtag(&dlg.id.loc_tag, &dlg.id.call_id, &ruri);
733 742
 	}
734 743
 
... ...
@@ -737,8 +746,11 @@ static void rpc_t_uac(rpc_t* rpc, void* c, int reply_wait)
737 746
 	else dlg.loc_seq.value = DEFAULT_CSEQ;
738 747
 	dlg.loc_seq.is_set = 1;
739 748
 
740
-	dlg.loc_uri = faked_msg.from->body;
741
-	dlg.rem_uri = faked_msg.to->body;
749
+	dlg.loc_uri = get_from(&faked_msg)->uri;
750
+	dlg.rem_uri = get_to(&faked_msg)->uri;
751
+	if(get_to(&faked_msg)->tag_value.len > 0) {
752
+		dlg.id.rem_tag = get_to(&faked_msg)->tag_value;
753
+	}
742 754
 	dlg.rem_target = ruri;
743 755
 	dlg.dst_uri = nexthop;
744 756
 	dlg.send_sock=ssock;