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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-03-12T07:18:24+01:00

tm: uac - keep the display name set via rpc

---

Modified: src/modules/tm/rpc_uac.c
Modified: src/modules/tm/t_msgbuilder.c

---

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

---

diff --git a/src/modules/tm/rpc_uac.c b/src/modules/tm/rpc_uac.c
index 3fc5d205a1d..386e682bd2f 100644
--- a/src/modules/tm/rpc_uac.c
+++ b/src/modules/tm/rpc_uac.c
@@ -774,10 +774,16 @@ static void rpc_t_uac_attrs_helper(
        dlg.loc_seq.is_set = DLG_SEQ_VALSET;
 
        dlg.loc_uri = get_from(&faked_msg)->uri;
+       if(get_from(&faked_msg)->display.len > 0) {
+               dlg.loc_dname = get_from(&faked_msg)->display;
+       }
        dlg.rem_uri = get_to(&faked_msg)->uri;
        if(get_to(&faked_msg)->tag_value.len > 0) {
                dlg.id.rem_tag = get_to(&faked_msg)->tag_value;
        }
+       if(get_to(&faked_msg)->display.len > 0) {
+               dlg.rem_dname = get_to(&faked_msg)->display;
+       }
        dlg.rem_target = tattrs->ruri;
        dlg.dst_uri = tattrs->nexthop;
        dlg.send_sock = ssock;
diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c
index f8dfc4c4027..4d0d17665d2 100644
--- a/src/modules/tm/t_msgbuilder.c
+++ b/src/modules/tm/t_msgbuilder.c
@@ -1555,10 +1555,16 @@ static inline char *print_to(
 {
        t->to_hdr.s = w;
        t->to_hdr.len =
-                       TO_LEN + dialog->rem_uri.len + CRLF_LEN
+                       TO_LEN + dialog->rem_dname.len
+                       + ((dialog->rem_dname.len > 0) ? 1 : 0) + 
dialog->rem_uri.len
+                       + CRLF_LEN
                        + (((dialog->rem_uri.s[dialog->rem_uri.len - 1] != 
'>')) ? 2 : 0);
 
        memapp(w, TO, TO_LEN);
+       if(dialog->rem_dname.len > 0) {
+               memapp(w, dialog->rem_dname.s, dialog->rem_dname.len);
+               memapp(w, " ", 1);
+       }
        if(bracket)
                memapp(w, "<", 1);
        memapp(w, dialog->rem_uri.s, dialog->rem_uri.len);
@@ -1584,10 +1590,16 @@ static inline char *print_from(
 {
        t->from_hdr.s = w;
        t->from_hdr.len =
-                       FROM_LEN + dialog->loc_uri.len + CRLF_LEN
+                       FROM_LEN + dialog->loc_dname.len
+                       + ((dialog->loc_dname.len > 0) ? 1 : 0) + 
dialog->loc_uri.len
+                       + CRLF_LEN
                        + ((dialog->loc_uri.s[dialog->loc_uri.len - 1] != '>') 
? 2 : 0);
 
        memapp(w, FROM, FROM_LEN);
+       if(dialog->loc_dname.len > 0) {
+               memapp(w, dialog->loc_dname.s, dialog->loc_dname.len);
+               memapp(w, " ", 1);
+       }
        if(bracket)
                memapp(w, "<", 1);
        memapp(w, dialog->loc_uri.s, dialog->loc_uri.len);
@@ -1675,6 +1687,7 @@ char *build_uac_req(str *method, str *headers, str *body, 
dlg_t *dialog,
        str content_length, cseq, via;
        unsigned int maxfwd_len;
        int tbracket, fbracket;
+       int tdname, fdname;
        str fromtag = STR_NULL;
        str loc_tag = STR_NULL;
 
@@ -1724,6 +1737,9 @@ char *build_uac_req(str *method, str *headers, str *body, 
dlg_t *dialog,
        } else {
                tbracket = 1;
        }
+       if(dialog->rem_dname.len > 0) {
+               tdname = 1;
+       }
        if((p = q_memrchr(dialog->loc_uri.s, '>', dialog->loc_uri.len)) != 
NULL) {
                if((p == dialog->loc_uri.s + dialog->loc_uri.len - 1)
                                || *(p + 1) == ';') {
@@ -1734,14 +1750,17 @@ char *build_uac_req(str *method, str *headers, str 
*body, dlg_t *dialog,
        } else {
                fbracket = 1;
        }
+       if(dialog->loc_dname.len > 0) {
+               fdname = 1;
+       }
 
-       *len += TO_LEN + dialog->rem_uri.len
+       *len += TO_LEN + dialog->rem_dname.len + tdname + dialog->rem_uri.len
                        + (dialog->id.rem_tag.len ? (TOTAG_LEN + 
dialog->id.rem_tag.len)
                                                                          : 0)
                        + CRLF_LEN; /* To */
        if(tbracket)
                *len += 2; /* To-URI < > */
-       *len += FROM_LEN + dialog->loc_uri.len
+       *len += FROM_LEN + dialog->loc_dname.len + fdname + dialog->loc_uri.len
                        + (dialog->id.loc_tag.len ? (FROMTAG_LEN + 
dialog->id.loc_tag.len)
                                                                          : 0)
                        + CRLF_LEN; /* From */

_______________________________________________
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