[sr-dev] git:master:a7ade4f3: dispatcher: rpc command to add a record updated to get priority
Daniel-Constantin Mierla
miconda at gmail.com
Fri Apr 8 13:28:51 CEST 2022
Module: kamailio
Branch: master
Commit: a7ade4f3c6c2439ebc286c0c595c92b88550dbc3
URL: https://github.com/kamailio/kamailio/commit/a7ade4f3c6c2439ebc286c0c595c92b88550dbc3
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-04-08T13:25:31+02:00
dispatcher: rpc command to add a record updated to get priority
---
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/a7ade4f3c6c2439ebc286c0c595c92b88550dbc3.diff
Patch: https://github.com/kamailio/kamailio/commit/a7ade4f3c6c2439ebc286c0c595c92b88550dbc3.patch
---
diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index b82bc89b90..0f6a6b178f 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -2611,12 +2611,11 @@ void ds_add_dest_cb(ds_set_t *node, int i, void *arg)
}
/* add dispatcher entry to in-memory dispatcher list */
-int ds_add_dst(int group, str *address, int flags, str *attrs)
+int ds_add_dst(int group, str *address, int flags, int priority, str *attrs)
{
- int setn, priority;
+ int setn;
setn = _ds_list_nr;
- priority = 0;
*ds_next_idx = (*ds_crt_idx + 1) % 2;
ds_avl_destroy(&ds_lists[*ds_next_idx]);
diff --git a/src/modules/dispatcher/dispatch.h b/src/modules/dispatcher/dispatch.h
index fec204bfff..3eaa9894dd 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -145,7 +145,7 @@ int ds_select_dst_limit(sip_msg_t *msg, int set, int alg, uint32_t limit,
int mode);
int ds_select_dst(struct sip_msg *msg, int set, int alg, int mode);
int ds_update_dst(struct sip_msg *msg, int upos, int mode);
-int ds_add_dst(int group, str *address, int flags, str *attrs);
+int ds_add_dst(int group, str *address, int flags, int priority, str *attrs);
int ds_remove_dst(int group, str *address);
int ds_update_state(sip_msg_t *msg, int group, str *address, int state,
ds_rctx_t *rctx);
diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c
index e877e3bf6c..ccf579fba8 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -1907,7 +1907,7 @@ static const char *dispatcher_rpc_add_doc[2] = {
*/
static void dispatcher_rpc_add(rpc_t *rpc, void *ctx)
{
- int group, flags, nparams;
+ int group, flags, priority, nparams;
str dest;
str attrs = STR_NULL;
@@ -1924,17 +1924,18 @@ static void dispatcher_rpc_add(rpc_t *rpc, void *ctx)
*ds_rpc_reload_time = time(NULL);
flags = 0;
+ priority = 0;
- nparams = rpc->scan(ctx, "dS*dS", &group, &dest, &flags, &attrs);
+ nparams = rpc->scan(ctx, "dS*ddS", &group, &dest, &flags, &priority, &attrs);
if(nparams < 2) {
rpc->fault(ctx, 500, "Invalid Parameters");
return;
- } else if (nparams <= 3) {
+ } else if (nparams <= 4) {
attrs.s = 0;
attrs.len = 0;
}
- if(ds_add_dst(group, &dest, flags, &attrs) != 0) {
+ if(ds_add_dst(group, &dest, flags, priority, &attrs) != 0) {
rpc->fault(ctx, 500, "Adding dispatcher dst failed");
return;
}
More information about the sr-dev
mailing list