Module: kamailio Branch: master Commit: bfbf41d8ba2ba2b6eed8eb8fff2e554476c0a5b8 URL: https://github.com/kamailio/kamailio/commit/bfbf41d8ba2ba2b6eed8eb8fff2e5544...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-02-17T13:31:34+01:00
tm: consider local_rport parameter when building local via
---
Modified: src/modules/tm/t_msgbuilder.c
---
Diff: https://github.com/kamailio/kamailio/commit/bfbf41d8ba2ba2b6eed8eb8fff2e5544... Patch: https://github.com/kamailio/kamailio/commit/bfbf41d8ba2ba2b6eed8eb8fff2e5544...
---
diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c index 47f94c1697..ef9b45e246 100644 --- a/src/modules/tm/t_msgbuilder.c +++ b/src/modules/tm/t_msgbuilder.c @@ -1358,6 +1358,7 @@ static inline int assemble_via(str* dest, struct cell* t, unsigned int via_len; str branch_str; struct hostport hp; + str rport = str_init(";rport");
if (!t_calc_branch(t, branch, branch_buf, &len)) { LM_ERR("branch calculation failed\n"); @@ -1372,7 +1373,11 @@ static inline int assemble_via(str* dest, struct cell* t, #endif
set_hostport(&hp, 0); - via = via_builder(&via_len, NULL, dst, &branch_str, 0, &hp); + if(ksr_local_rport) { + via = via_builder(&via_len, NULL, dst, &branch_str, &rport, &hp); + } else { + via = via_builder(&via_len, NULL, dst, &branch_str, 0, &hp); + } if (!via) { LM_ERR("via building failed\n"); return -2;