Module: kamailio
Branch: master
Commit: 27766bcb5249c6b2edba9643394f700c9303dcac
URL: 
https://github.com/kamailio/kamailio/commit/27766bcb5249c6b2edba9643394f700c9303dcac

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-01-07T16:01:06+01:00

tm: pass per branch via-body flags to building new request

-  updates for the new function prototype to build request

---

Modified: src/modules/tm/t_fwd.c
Modified: src/modules/tm/uac.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/27766bcb5249c6b2edba9643394f700c9303dcac.diff
Patch: 
https://github.com/kamailio/kamailio/commit/27766bcb5249c6b2edba9643394f700c9303dcac.patch

---

diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
index 5779a84942f..c318ca746d9 100644
--- a/src/modules/tm/t_fwd.c
+++ b/src/modules/tm/t_fwd.c
@@ -152,6 +152,7 @@ static int prepare_new_uac(struct cell *t, struct sip_msg 
*i_req, int branch,
        struct run_act_ctx ctx;
        struct run_act_ctx *bctx;
        sr_kemi_eng_t *keng;
+       ksr_msgbuild_t mbd = {0};
 
        shbuf = 0;
        ret = E_UNSPEC;
@@ -484,7 +485,8 @@ static int prepare_new_uac(struct cell *t, struct sip_msg 
*i_req, int branch,
                goto error01;
        }
        /* ... and build it now */
-       shbuf = build_req_buf_from_sip_req(i_req, &len, dst, BUILD_IN_SHM);
+       mbd.tvbflags = t->uac[branch].vbflags;
+       shbuf = build_req_buf_from_sip_req(i_req, &len, dst, BUILD_IN_SHM, 
&mbd);
        if(!shbuf || len <= 0) {
                LM_ERR("could not build request\n");
                if(shbuf) {
@@ -648,6 +650,7 @@ static char *print_uac_request_from_buf(struct cell *t, 
struct sip_msg *i_req,
        str branch_str;
        char *via, *old_via_begin, *old_via_end;
        unsigned int via_len;
+       ksr_msgbuild_t mbd = {0};
 
        shbuf = 0;
 
@@ -674,7 +677,8 @@ static char *print_uac_request_from_buf(struct cell *t, 
struct sip_msg *i_req,
        }
 
        /* create the new VIA HF */
-       via = create_via_hf(&via_len, i_req, dst, &branch_str);
+       mbd.tvbflags = t->uac[branch].vbflags;
+       via = create_via_hf(&via_len, i_req, dst, &branch_str, &mbd);
        if(!via) {
                LM_ERR("via building failed\n");
                goto error00;
diff --git a/src/modules/tm/uac.c b/src/modules/tm/uac.c
index 8e4bb736266..53798be8bef 100644
--- a/src/modules/tm/uac.c
+++ b/src/modules/tm/uac.c
@@ -362,7 +362,7 @@ static inline int t_run_local_req(char **buf, int *buf_len, 
int buf_offset,
                if(buf_offset == 0) {
                        LM_DBG("apply new updates with Via to sip msg\n");
                        buf1 = build_req_buf_from_sip_req(&lreq, (unsigned int 
*)&buf_len1,
-                                       &request->dst, BUILD_NEW_LOCAL_VIA | 
BUILD_IN_SHM);
+                                       &request->dst, BUILD_NEW_LOCAL_VIA | 
BUILD_IN_SHM, NULL);
                        if(likely(buf1)) {
                                shm_free(*buf);
                                *buf = buf1;
@@ -374,7 +374,7 @@ static inline int t_run_local_req(char **buf, int *buf_len, 
int buf_offset,
                        LM_DBG("apply new updates with Via to sip msg, 
preserving "
                                   "prefix\n");
                        buf1 = build_req_buf_from_sip_req(&lreq, (unsigned int 
*)&buf_len1,
-                                       &request->dst, BUILD_NEW_LOCAL_VIA);
+                                       &request->dst, BUILD_NEW_LOCAL_VIA, 
NULL);
                        if(likely(buf1)) {
                                buf2 = shm_malloc(buf_offset + buf_len1);
                                if(unlikely(!buf2)) {
@@ -400,7 +400,8 @@ static inline int t_run_local_req(char **buf, int *buf_len, 
int buf_offset,
                                buf1 = build_req_buf_from_sip_req(&lreq,
                                                (unsigned int *)&buf_len1, 
&request->dst,
                                                BUILD_NO_LOCAL_VIA | 
BUILD_NO_VIA1_UPDATE
-                                                               | BUILD_IN_SHM);
+                                                               | BUILD_IN_SHM,
+                                               NULL);
                                if(likely(buf1)) {
                                        shm_free(*buf);
                                        *buf = buf1;
@@ -413,7 +414,7 @@ static inline int t_run_local_req(char **buf, int *buf_len, 
int buf_offset,
                                           "prefix\n");
                                buf1 = build_req_buf_from_sip_req(&lreq,
                                                (unsigned int *)&buf_len1, 
&request->dst,
-                                               BUILD_NO_LOCAL_VIA | 
BUILD_NO_VIA1_UPDATE);
+                                               BUILD_NO_LOCAL_VIA | 
BUILD_NO_VIA1_UPDATE, NULL);
                                if(likely(buf1)) {
                                        buf2 = shm_malloc(buf_offset + 
buf_len1);
                                        if(unlikely(!buf2)) {

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to