Module: kamailio
Branch: master
Commit: 074d3c67a96a49e9b8c86f6ec4cfd61725b0ccce
URL:
https://github.com/kamailio/kamailio/commit/074d3c67a96a49e9b8c86f6ec4cfd61…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-11-22T08:56:54+01:00
dispatcher: ds_select_routes() - set r-uri/d-uri even when first group has no available
dst
- GH #1728
---
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/074d3c67a96a49e9b8c86f6ec4cfd61…
Patch:
https://github.com/kamailio/kamailio/commit/074d3c67a96a49e9b8c86f6ec4cfd61…
---
diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 80540ee6ba..d247d6e104 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -2181,6 +2181,7 @@ int ds_manage_routes(sip_msg_t *msg, ds_select_state_t *rstate)
idx->dlist[hash].uri.len, idx->dlist[hash].uri.s);
return -1;
}
+ rstate->emode = 1;
}
LM_DBG("selected [%d-%d-%d/%d] <%.*s>\n", rstate->alg,
rstate->setid,
diff --git a/src/modules/dispatcher/dispatch.h b/src/modules/dispatcher/dispatch.h
index 7a798fc162..14db0e2a30 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -214,11 +214,12 @@ typedef struct _ds_set {
} ds_set_t;
typedef struct _ds_select_state {
- int setid;
- int alg;
- int umode;
- uint32_t limit;
- int cnt;
+ int setid; /* dispatcher set id (group id) */
+ int alg; /* algorithm to select destionations */
+ int umode; /* update mode - push to: r-uri, d-uri, xavp */
+ uint32_t limit; /* limit of destination addresses to be selected */
+ int cnt; /* output: number of xavps set with destination addresses */
+ int emode; /* output: update operation was executed or not */
sr_xavp_t *lxavp;
} ds_select_state_t;
diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c
index 750f17b670..66ed3248ef 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -632,7 +632,6 @@ static int ki_ds_select_routes_limit(sip_msg_t *msg, str *srules, str
*smode,
int i;
int vret;
int gret;
- int vfirst;
sr_xval_t nxval;
ds_select_state_t vstate;
@@ -644,7 +643,6 @@ static int ki_ds_select_routes_limit(sip_msg_t *msg, str *srules, str
*smode,
}
vret = -1;
gret = -1;
- vfirst = 0;
i = 0;
while(i<srules->len) {
vstate.setid = 0;
@@ -677,9 +675,11 @@ static int ki_ds_select_routes_limit(sip_msg_t *msg, str *srules, str
*smode,
}
LM_DBG("routing with setid=%d alg=%d cnt=%d limit=0x%x (%u)\n",
vstate.setid, vstate.alg, vstate.cnt, vstate.limit, vstate.limit);
-
+
vstate.umode = DS_SETOP_XAVP;
- if(vfirst==0) {
+ /* if no r-uri/d-uri was set already, keep using the update mode
+ * specified by the param, then just add to xavps list */
+ if(vstate.emode==0) {
switch(smode->s[0]) {
case '0':
case 'd':
@@ -700,7 +700,6 @@ static int ki_ds_select_routes_limit(sip_msg_t *msg, str *srules, str
*smode,
smode->len, smode->s);
return -1;
}
- vfirst = 1;
}
vret = ds_manage_routes(msg, &vstate);
if(vret<0) {