Module: kamailio Branch: master Commit: 09d1ba87f4d37c3e13153229c63698f09ca195bc URL: https://github.com/kamailio/kamailio/commit/09d1ba87f4d37c3e13153229c63698f0...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-01-21T19:45:20+01:00
core: add rport to generated replies after first via branch when no incoming rport
---
Modified: src/core/msg_translator.c
---
Diff: https://github.com/kamailio/kamailio/commit/09d1ba87f4d37c3e13153229c63698f0... Patch: https://github.com/kamailio/kamailio/commit/09d1ba87f4d37c3e13153229c63698f0...
---
diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index 8924e8a2609..50e867804be 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -2683,6 +2683,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,