Module: kamailio Branch: 5.8 Commit: b6360f4d8549c18efad507bc37ef599d9e3316d7 URL: https://github.com/kamailio/kamailio/commit/b6360f4d8549c18efad507bc37ef599d...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-01-22T10:49:25+01:00
core: add rport to generated replies after first via branch when no incoming rport
(cherry picked from commit 09d1ba87f4d37c3e13153229c63698f09ca195bc)
---
Modified: src/core/msg_translator.c
---
Diff: https://github.com/kamailio/kamailio/commit/b6360f4d8549c18efad507bc37ef599d... Patch: https://github.com/kamailio/kamailio/commit/b6360f4d8549c18efad507bc37ef599d...
---
diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index 4e81f89cedb..262ba07a23a 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -2663,6 +2663,22 @@ char *build_res_buf_from_sip_req(unsigned int code, str *text, str *new_tag, - msg->via1->rport->start - msg->via1->rport->size, msg); + } else if(msg->via1->branch) { /* add after branch */ + /* copy until after branch */ + append_str_trans(p, hdr->name.s, + msg->via1->branch->start - hdr->name.s + + msg->via1->branch->size, + msg); + /* copy new rport */ + append_str(p, rport_buf, rport_len); + /* copy the rest of the via */ + append_str_trans(p, + msg->via1->branch->start + + msg->via1->branch->size, + hdr->body.s + hdr->body.len + - msg->via1->branch->start + - msg->via1->branch->size, + msg); } else { /* just append the new one */ /* normal whole via copy */ append_str_trans(p, hdr->name.s,