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

Author: Gustavo Almeida <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-07-01T09:00:26+02:00

path: support for adding socket name when adverised functions are used

---

Modified: src/modules/path/path.c

---

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

---

diff --git a/src/modules/path/path.c b/src/modules/path/path.c
index 13d3b1eaab6..c92d13d9d0b 100644
--- a/src/modules/path/path.c
+++ b/src/modules/path/path.c
@@ -249,6 +249,13 @@ static int prepend_path(sip_msg_t *_m, str *user, 
path_param_t param,
                l = insert_new_lump_before(l, dp, adv_addr->len, 0);
                if(!l)
                        goto out2;
+               /* the advertised address replaces the host part only, so the 
socket
+                * name still has to be appended at send time if sockname_mode 
is on */
+               if(path_sockname_mode) {
+                       l = insert_subst_lump_before(l, SUBST_SND_SOCKNAME, 0);
+                       if(!l)
+                               goto out2;
+               }
        } else {
                l = insert_subst_lump_before(
                                l, (path_sockname_mode) ? SUBST_SND_ALL_EX : 
SUBST_SND_ALL, 0);
@@ -273,9 +280,14 @@ static int prepend_path(sip_msg_t *_m, str *user, 
path_param_t param,
                        l = insert_new_lump_before(l, dp, adv_addr->len, 0);
                        if(!l)
                                goto out1;
+                       if(path_sockname_mode) {
+                               l = insert_subst_lump_before(l, 
SUBST_RCV_SOCKNAME, 0);
+                               if(!l)
+                                       goto out1;
+                       }
                } else {
-                       l = insert_subst_lump_before(
-                                       l, (path_sockname_mode) ? 
SUBST_RCV_ALL_EX : SUBST_RCV_ALL, 0);
+                       l = insert_subst_lump_before(l,
+                                       (path_sockname_mode) ? SUBST_RCV_ALL_EX 
: SUBST_RCV_ALL, 0);
                        if(!l)
                                goto out1;
                }

_______________________________________________
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