Browse code

tm: consider local_rport parameter when building local via

Daniel-Constantin Mierla authored on 17/02/2021 12:31:34
Showing 1 changed files
... ...
@@ -1358,6 +1358,7 @@ static inline int assemble_via(str* dest, struct cell* t,
1358 1358
 	unsigned int via_len;
1359 1359
 	str branch_str;
1360 1360
 	struct hostport hp;
1361
+	str rport = str_init(";rport");
1361 1362
 
1362 1363
 	if (!t_calc_branch(t, branch, branch_buf, &len)) {
1363 1364
 		LM_ERR("branch calculation failed\n");
... ...
@@ -1372,7 +1373,11 @@ static inline int assemble_via(str* dest, struct cell* t,
1372 1373
 #endif
1373 1374
 
1374 1375
 	set_hostport(&hp, 0);
1375
-	via = via_builder(&via_len, NULL, dst, &branch_str, 0, &hp);
1376
+	if(ksr_local_rport) {
1377
+		via = via_builder(&via_len, NULL, dst, &branch_str, &rport, &hp);
1378
+	} else {
1379
+		via = via_builder(&via_len, NULL, dst, &branch_str, 0, &hp);
1380
+	}
1376 1381
 	if (!via) {
1377 1382
 		LM_ERR("via building failed\n");
1378 1383
 		return -2;