Browse code

tm: uac - use new send socket only if set in event route local request

- GH #2639

Daniel-Constantin Mierla authored on 16/02/2021 15:36:10
Showing 1 changed files
... ...
@@ -315,10 +315,10 @@ static inline int t_run_local_req(
315 315
 	if((lreq.force_send_socket != uac_r->dialog->send_sock)
316 316
 			|| (lreq.msg_flags&(FL_ADD_LOCAL_RPORT|FL_ADD_SRVID
317 317
 					|FL_ADD_XAVP_VIA_PARAMS|FL_USE_XAVP_VIA_FIELDS))) {
318
-		LM_DBG("local Via update - socket: [%.*s] - msg-flags: %u",
319
-				lreq.force_send_socket->address_str.len,
320
-				lreq.force_send_socket->address_str.s,
321
-				lreq.msg_flags);
318
+		LM_DBG("local Via update - new socket: [%.*s] - msg-flags: %u",
319
+			(lreq.force_send_socket)?lreq.force_send_socket->address_str.len:4,
320
+			(lreq.force_send_socket)?lreq.force_send_socket->address_str.s:"none",
321
+			lreq.msg_flags);
322 322
 
323 323
 		/* rebuild local Via - remove previous value
324 324
 			* and add the one for the new send socket */
... ...
@@ -335,9 +335,11 @@ static inline int t_run_local_req(
335 335
 		lreq.add_to_branch_len = lreq.via1->branch->value.len;
336 336
 
337 337
 		/* update also info about new destination and send sock */
338
-		uac_r->dialog->send_sock=lreq.force_send_socket;
339
-		request->dst.send_sock = lreq.force_send_socket;
340
-		request->dst.proto = lreq.force_send_socket->proto;
338
+		if(lreq.force_send_socket) {
339
+			uac_r->dialog->send_sock=lreq.force_send_socket;
340
+			request->dst.send_sock = lreq.force_send_socket;
341
+			request->dst.proto = lreq.force_send_socket->proto;
342
+		}
341 343
 
342 344
 		LM_DBG("apply new updates with Via to sip msg\n");
343 345
 		buf1 = build_req_buf_from_sip_req(&lreq,