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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-05-13T10:58:43+02:00

corex: exported forward uac functions with branch index

---

Modified: src/modules/corex/corex_mod.c

---

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

---

diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c
index 70db47470ad..a09a71af685 100644
--- a/src/modules/corex/corex_mod.c
+++ b/src/modules/corex/corex_mod.c
@@ -52,7 +52,9 @@ MODULE_VERSION
 
 static int nio_intercept = 0;
 static int w_forward_uac(sip_msg_t *msg, char *p1, char *p2);
+static int w_forward_uac_branch(sip_msg_t *msg, char *pbindex, char *p2);
 static int w_forward_uac_uri(sip_msg_t *msg, char *puri, char *p2);
+static int w_forward_uac_uri_branch(sip_msg_t *msg, char *puri, char *pbindex);
 static int w_forward_reply(sip_msg_t *msg, char *p1, char *p2);
 static int w_append_branch(sip_msg_t *msg, char *su, char *sq);
 static int w_send_udp(sip_msg_t *msg, char *su, char *sq);
@@ -132,8 +134,12 @@ static tr_export_t mod_trans[] = {
 static cmd_export_t cmds[] = {
        {"forward_uac", (cmd_function)w_forward_uac, 0,
                0, 0, REQUEST_ROUTE},
+       {"forward_uac", (cmd_function)w_forward_uac_branch, 1,
+               fixup_igp_null, fixup_free_igp_null, REQUEST_ROUTE},
        {"forward_uac_uri", (cmd_function)w_forward_uac_uri, 1,
                fixup_spve_null, fixup_free_spve_null, REQUEST_ROUTE},
+       {"forward_uac_uri", (cmd_function)w_forward_uac_uri_branch, 2,
+               fixup_spve_igp, fixup_free_spve_igp, REQUEST_ROUTE},
        {"forward_reply", (cmd_function)w_forward_reply, 0,
                0, 0, CORE_ONREPLY_ROUTE},
        {"append_branch", (cmd_function)w_append_branch, 0,
@@ -367,6 +373,26 @@ static int w_forward_uac(sip_msg_t *msg, char *p1, char 
*p2)
        return -1;
 }
 
+/**
+ * forward request like initial uac sender, with only one via and branch index
+ */
+static int w_forward_uac_branch(sip_msg_t *msg, char *pbindex, char *p2)
+{
+       int ret;
+       int vbindex = 0;
+
+       if(fixup_get_ivalue(msg, (gparam_t *)pbindex, &vbindex)) {
+               LM_ERR("cannot get the branch index parameter\n");
+               return -1;
+       }
+
+       ret = forward_uac_uri(msg, NULL, vbindex);
+       if(ret >= 0) {
+               return 1;
+       }
+       return -1;
+}
+
 /**
  * forward request to uri like initial uac sender, with only one via
  */
@@ -387,6 +413,32 @@ static int w_forward_uac_uri(sip_msg_t *msg, char *puri, 
char *p2)
        return -1;
 }
 
+/**
+ * forward request to uri like initial uac sender, with only one via and branch
+ * index
+ */
+static int w_forward_uac_uri_branch(sip_msg_t *msg, char *puri, char *pbindex)
+{
+       int ret;
+       int vbindex = 0;
+       str vuri = STR_NULL;
+
+       if(fixup_get_svalue(msg, (gparam_t *)puri, &vuri)) {
+               LM_ERR("cannot get the destination parameter\n");
+               return -1;
+       }
+       if(fixup_get_ivalue(msg, (gparam_t *)pbindex, &vbindex)) {
+               LM_ERR("cannot get the branch index parameter\n");
+               return -1;
+       }
+
+       ret = forward_uac_uri(msg, &vuri, vbindex);
+       if(ret >= 0) {
+               return 1;
+       }
+       return -1;
+}
+
 /**
  * forward reply based on via
  */

_______________________________________________
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