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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-06-25T13:22:17+02:00

dispatcher: $dsv(name) extended to return setid and uri

---

Modified: src/modules/dispatcher/dispatch.c
Modified: src/modules/dispatcher/dispatch.h
Modified: src/modules/dispatcher/dispatcher.c

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index d484c40233c..cb7ccf44685 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -3044,6 +3044,9 @@ int ds_mark_addr(sip_msg_t *msg, int state, int group, 
str *uri, int mode)
        } else {
                rctx.code = 800;
        }
+       rctx.setid = group;
+       rctx.uri = *uri;
+
        ret = ds_update_state(msg, group, uri, state, mode, &rctx);
 
        LM_DBG("state [%d] grp [%d] dst [%.*s]\n", state, group, uri->len, 
uri->s);
@@ -4069,6 +4072,8 @@ static void ds_options_callback(
                        rctx.reason = ps->rpl->first_line.u.reply.reason;
                }
        }
+       rctx.setid = group;
+       rctx.uri = uri;
 
        /* Check if in the meantime someone disabled probing of the target
         * through RPC or reload */
@@ -4231,6 +4236,8 @@ void ds_ping_set(ds_set_t *node)
                                rctx.code = 500;
                                rctx.reason.s = "Sending keepalive failed";
                                rctx.reason.len = 24;
+                               rctx.setid = node->id;
+                               rctx.uri = node->dlist[j].uri;
                                /* check if meantime someone disabled the 
target via RPC */
                                if(!(node->dlist[j].flags & DS_DISABLED_DST)
                                                && ds_update_state(NULL, 
node->id, &node->dlist[j].uri,
diff --git a/src/modules/dispatcher/dispatch.h 
b/src/modules/dispatcher/dispatch.h
index c47ad4fbf5e..ffaab7cb7e8 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -90,6 +90,8 @@ typedef struct ds_rctx
        int flags;
        int code;
        str reason;
+       str uri;
+       int setid;
 } ds_rctx_t;
 
 extern str ds_db_url;
diff --git a/src/modules/dispatcher/dispatcher.c 
b/src/modules/dispatcher/dispatcher.c
index 00960311ead..35cfd3cc4a5 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -1392,6 +1392,13 @@ static int pv_get_dsv(sip_msg_t *msg, pv_param_t *param, 
pv_value_t *res)
                        return pv_get_null(msg, param, res);
                case 2:
                        return pv_get_sintval(msg, param, res, rctx->flags);
+               case 3:
+                       if(rctx->uri.s != NULL && rctx->uri.len > 0) {
+                               return pv_get_strval(msg, param, res, 
&rctx->uri);
+                       }
+                       return pv_get_null(msg, param, res);
+               case 4:
+                       return pv_get_sintval(msg, param, res, rctx->setid);
                default:
                        return pv_get_null(msg, param, res);
        }
@@ -1406,6 +1413,12 @@ static int pv_parse_dsv(pv_spec_p sp, str *in)
                return -1;
 
        switch(in->len) {
+               case 3:
+                       if(strncmp(in->s, "uri", 3) == 0)
+                               sp->pvp.pvn.u.isname.name.n = 3;
+                       else
+                               goto error;
+                       break;
                case 4:
                        if(strncmp(in->s, "code", 4) == 0)
                                sp->pvp.pvn.u.isname.name.n = 0;
@@ -1415,6 +1428,10 @@ static int pv_parse_dsv(pv_spec_p sp, str *in)
                case 5:
                        if(strncmp(in->s, "flags", 5) == 0)
                                sp->pvp.pvn.u.isname.name.n = 2;
+                       else if(strncmp(in->s, "setid", 5) == 0)
+                               sp->pvp.pvn.u.isname.name.n = 4;
+                       else if(strncmp(in->s, "group", 5) == 0)
+                               sp->pvp.pvn.u.isname.name.n = 4;
                        else
                                goto error;
                        break;

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to