Browse code

tm: update local via if internal flags are set for local request

Daniel-Constantin Mierla authored on 12/11/2020 08:33:11
Showing 1 changed files
... ...
@@ -305,16 +305,20 @@ static inline int t_run_local_req(
305 305
 	setsflagsval(sflag_bk);
306 306
 
307 307
 	if (unlikely(ra_ctx.run_flags&DROP_R_F)) {
308
-		LM_DBG("tm:local-request dropped msg. to %.*s\n", 
308
+		LM_DBG("tm:local-request dropped msg. to %.*s\n",
309 309
 				lreq.dst_uri.len, lreq.dst_uri.s);
310 310
 		refresh_shortcuts = E_DROP;
311 311
 		goto clean;
312 312
 	}
313
+
313 314
 	/* rebuild the new message content */
314
-	if(lreq.force_send_socket != uac_r->dialog->send_sock) {
315
-		LM_DBG("Send socket updated to: %.*s",
315
+	if((lreq.force_send_socket != uac_r->dialog->send_sock)
316
+			|| (lreq.msg_flags&(FL_ADD_LOCAL_RPORT|FL_ADD_SRVID
317
+					|FL_ADD_XAVP_VIA_PARAMS|FL_USE_XAVP_VIA_FIELDS))) {
318
+		LM_DBG("local Via update - socket: [%.*s] - msg-flags: %u",
316 319
 				lreq.force_send_socket->address_str.len,
317
-				lreq.force_send_socket->address_str.s);
320
+				lreq.force_send_socket->address_str.s,
321
+				lreq.msg_flags);
318 322
 
319 323
 		/* rebuild local Via - remove previous value
320 324
 			* and add the one for the new send socket */