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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-01-16T11:11:24+01:00

tm: keep ds_uri in branch uac

- path, ruid, ... are already kept

---

Modified: src/modules/tm/h_table.c
Modified: src/modules/tm/h_table.h
Modified: src/modules/tm/t_fwd.c

---

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

---

diff --git a/src/modules/tm/h_table.c b/src/modules/tm/h_table.c
index 81cfb4a125b..583fd9bc09f 100644
--- a/src/modules/tm/h_table.c
+++ b/src/modules/tm/h_table.c
@@ -224,6 +224,9 @@ void free_cell_helper(
                }
                dns_srv_handle_put_shm_unsafe(&dead_cell->uac[i].dns_h);
 #endif
+               if(unlikely(dead_cell->uac[i].dst_uri.s)) {
+                       shm_free_unsafe(dead_cell->uac[i].dst_uri.s);
+               }
                if(unlikely(dead_cell->uac[i].path.s)) {
                        shm_free_unsafe(dead_cell->uac[i].path.s);
                }
diff --git a/src/modules/tm/h_table.h b/src/modules/tm/h_table.h
index 7b28b472b6d..7544e878750 100644
--- a/src/modules/tm/h_table.h
+++ b/src/modules/tm/h_table.h
@@ -204,6 +204,7 @@ typedef struct ua_client
        struct dns_srv_handle dns_h;
 #endif
        str uri;
+       str dst_uri;
        str path;
        str instance;
        str ruid;
diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
index c318ca746d9..e9203519ee8 100644
--- a/src/modules/tm/t_fwd.c
+++ b/src/modules/tm/t_fwd.c
@@ -508,6 +508,22 @@ static int prepare_new_uac(struct cell *t, struct sip_msg 
*i_req, int branch,
        t->uac[branch].uri.s = t->uac[branch].request.buffer
                                                   + 
i_req->first_line.u.request.method.len + 1;
        t->uac[branch].uri.len = GET_RURI(i_req)->len;
+       if(unlikely(i_req->dst_uri.s && i_req->dst_uri.len)) {
+               t->uac[branch].dst_uri.s = shm_malloc(i_req->dst_uri.len + 1);
+               if(unlikely(t->uac[branch].dst_uri.s == 0)) {
+                       SHM_MEM_ERROR;
+                       shm_free(shbuf);
+                       t->uac[branch].request.buffer = 0;
+                       t->uac[branch].request.buffer_len = 0;
+                       t->uac[branch].uri.s = 0;
+                       t->uac[branch].uri.len = 0;
+                       ret = E_OUT_OF_MEM;
+                       goto error01;
+               }
+               t->uac[branch].dst_uri.len = i_req->dst_uri.len;
+               t->uac[branch].dst_uri.s[i_req->dst_uri.len] = 0;
+               memcpy(t->uac[branch].dst_uri.s, i_req->dst_uri.s, 
i_req->dst_uri.len);
+       }
        if(unlikely(i_req->path_vec.s && i_req->path_vec.len)) {
                t->uac[branch].path.s = shm_malloc(i_req->path_vec.len + 1);
                if(unlikely(t->uac[branch].path.s == 0)) {

_______________________________________________
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