Module: kamailio
Branch: master
Commit: 848394fa7615b56d86d255d6e05d7c4690893d35
URL: https://github.com/kamailio/kamailio/commit/848394fa7615b56d86d255d6e05d7c4…
Author: Federico Cabiddu <federico.cabiddu(a)gmail.com>
Committer: Federico Cabiddu <federico.cabiddu(a)gmail.com>
Date: 2015-02-18T08:04:12+01:00
modules/dispatcher: fixed ds_print_mi_list when a gateway doesn't have attrs defined
- reported by Luis Azedo
---
Modified: modules/dispatcher/dispatch.c
---
Diff: https://github.com/kamailio/kamailio/commit/848394fa7615b56d86d255d6e05d7c4…
Patch: https://github.com/kamailio/kamailio/commit/848394fa7615b56d86d255d6e05d7c4…
---
diff --git a/modules/dispatcher/dispatch.c b/modules/dispatcher/dispatch.c
index c33df25..6394ae8 100644
--- a/modules/dispatcher/dispatch.c
+++ b/modules/dispatcher/dispatch.c
@@ -344,7 +344,7 @@ int add_dest2list(int id, str uri, int flags, int priority, str *attrs,
hostent2ip_addr(&dp->ip_address, he, 0);
/* Copy the port out of the URI */
- dp->port = puri.port_no;
+ dp->port = puri.port_no;
/* Copy the proto out of the URI */
dp->proto = puri.proto;
@@ -1899,7 +1899,7 @@ int ds_select_dst_limit(sip_msg_t *msg, int set, int alg, unsigned int limit, in
/* add to avp */
for(i=hash-1; i>=0 && cnt<limit; i--)
- {
+ {
if(ds_skip_dst(idx->dlist[i].flags)
|| (ds_use_default!=0 && i==(idx->nr-1)))
continue;
@@ -1947,7 +1947,7 @@ int ds_select_dst_limit(sip_msg_t *msg, int set, int alg, unsigned int limit, in
}
for(i=idx->nr-1; i>hash && cnt<limit; i--)
- {
+ {
if(ds_skip_dst(idx->dlist[i].flags)
|| (ds_use_default!=0 && i==(idx->nr-1)))
continue;
@@ -2238,10 +2238,10 @@ int ds_update_state(sip_msg_t *msg, int group, str *address, int state)
/* reset the bits used for states */
idx->dlist[i].flags &= ~(DS_STATES_ALL);
-
+
/* we need the initial state for inactive counter */
init_state = state;
-
+
if((state & DS_TRYING_DST) && (old_state & DS_INACTIVE_DST))
{
/* old state is inactive, new state is trying => keep it inactive
@@ -2257,7 +2257,7 @@ int ds_update_state(sip_msg_t *msg, int group, str *address, int state)
} else {
idx->dlist[i].flags |= state;
}
-
+
if(state & DS_TRYING_DST)
{
idx->dlist[i].message_count++;
@@ -2281,7 +2281,7 @@ int ds_update_state(sip_msg_t *msg, int group, str *address, int state)
/* Destination has enough replied messages.. Bringing it to active state */
idx->dlist[i].message_count = 0;
}
- }else{
+ }else{
idx->dlist[i].message_count = 0;
}
}
@@ -2563,9 +2563,6 @@ int ds_print_mi_list(struct mi_node* rpl)
if(node == NULL)
return -1;
- if(attr == 0)
- return -1;
-
memset(&c, 0, sizeof(c));
if (list->dlist[j].flags & DS_INACTIVE_DST)
c[0] = 'I';
Hi Federico,
your commit aae775859f54f84734ba2cfc2945c02c52b95e1f on 12 Nov 2014 added this condition to ds_print_mi_list
if(attr == 0)
return -1;
attr will always be 0 on first pass. were you adding something above that set attr ?
as a result of this change, kamctl fifo ds_list will always fail.
cheers
lookup function has an optional uri param for looking up based on that param.
lookup_to_dset is used if we don't want to overwritte the Request-URI but there is option to lookup based on a uri.
during tests i noticed that the append_branch was being called when i did a lookup_to_dset("location", "$fu") and kamailio exited because of that.
i made the append_branch to depend on the _mode ( 0 = lookup ) which seemed to fixed.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/84
-- Commit Summary --
* registrar : add lookup_to_dset optional uri param as in lookup
-- File Changes --
M modules/registrar/lookup.c (34)
M modules/registrar/reg_mod.c (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/84.patchhttps://github.com/kamailio/kamailio/pull/84.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/84