Module: kamailio
Branch: master
Commit: 1832880c4d8e2e0c5b5444542d414b13bbab47ca
URL:
https://github.com/kamailio/kamailio/commit/1832880c4d8e2e0c5b5444542d414b1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-09-07T08:39:41+02:00
core: add via reply xavp params for generation when using another reply
---
Modified: src/core/msg_translator.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1832880c4d8e2e0c5b5444542d414b1…
Patch:
https://github.com/kamailio/kamailio/commit/1832880c4d8e2e0c5b5444542d414b1…
---
diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c
index c5c4172c045..42f445983f1 100644
--- a/src/core/msg_translator.c
+++ b/src/core/msg_translator.c
@@ -2320,6 +2320,8 @@ char *generate_res_buf_from_sip_res(
unsigned offset, s_offset, via_offset;
char *buf;
unsigned int len;
+ str xparams;
+ sr_lump_t *anchor;
buf = msg->buf;
len = msg->len;
@@ -2339,6 +2341,23 @@ char *generate_res_buf_from_sip_res(
}
}
+ /* test and add xavp via reply params */
+ if(msg && msg->via2 && (msg->msg_flags &
FL_ADD_XAVP_VIA_REPLY_PARAMS)
+ && _ksr_xavp_via_reply_params.len > 0) {
+ xparams.s = pv_get_buffer();
+ xparams.len = xavp_serialize_fields(
+ &_ksr_xavp_via_reply_params, xparams.s, pv_get_buffer_size());
+ if(xparams.len > 0) {
+ anchor = anchor_lump(msg, msg->via2->params.s
+ + msg->via2->params.len - msg->buf, 0, 0);
+ if(anchor != NULL) {
+ if(insert_new_lump_after(anchor, xparams.s, xparams.len, 0) == 0) {
+ LM_ERR("unable to add via reply xavp params\n");
+ }
+ }
+ }
+ }
+
/* Calculate message body difference and adjust
* Content-Length
*/
@@ -2458,7 +2477,7 @@ char *build_res_buf_from_sip_req(unsigned int code, str *text, str
*new_tag,
len -= msg->via1->rport->size + 1; /* include ';' */
}
- /* test and add xavpvia params */
+ /* test and add xavp via reply params */
if(msg && (msg->msg_flags & FL_ADD_XAVP_VIA_REPLY_PARAMS)
&& _ksr_xavp_via_reply_params.len > 0) {
xparams.s = pv_get_buffer();