Module: kamailio
Branch: master
Commit: e93bb3dba955cb6fe1526bb1737ce0f227f4a8c7
URL: https://github.com/kamailio/kamailio/commit/e93bb3dba955cb6fe1526bb1737ce0f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-03-24T14:08:32+01:00
dispatcher: docs for ds_select()
---
Modified: modules/dispatcher/doc/dispatcher_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/e93bb3dba955cb6fe1526bb1737ce0f…
Patch: https://github.com/kamailio/kamailio/commit/e93bb3dba955cb6fe1526bb1737ce0f…
---
diff --git a/modules/dispatcher/doc/dispatcher_admin.xml b/modules/dispatcher/doc/dispatcher_admin.xml
index c79ecaa..8368bb7 100644
--- a/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/modules/dispatcher/doc/dispatcher_admin.xml
@@ -1050,19 +1050,64 @@ ds_select_dst("1", "4", "3");
<para>
If the bit 2 in 'flags' is set, the rest of the addresses from the
destination set is stored in AVP list (limited with an optional 'limit'
- parameter). You can use 'ds_next_domain()' to use next address to
+ parameter). You can use 'ds_next_domain()' to use next address to
achieve serial forking to all possible destinations.
</para>
<para>
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
</para>
- </section>
- <section>
- <title>
- <function moreinfo="none">ds_next_dst()</function>
- </title>
- <para>
- Takes the next destination address from the AVPs with id 'dst_avp_id'
+ <example>
+ <title><function>ds_select_domain</function> usage</title>
+ <programlisting format="linespecific">
+...
+$var(a) = 4;
+if(ds_select_domain("1", "$var(a)")) {
+ t_relay();
+ exit;
+}
+...
+</programlisting>
+ </example>
+ </section>
+ <section id="dispatcher.f.ds_select">
+ <title>
+ <function moreinfo="none">ds_select(set, alg [, limit])</function>
+ </title>
+ <para>
+ The method selects a destination from addresses set and adds it
+ in the AVPs specified for this module. It is not updating R-URI
+ nor the destination URI. The parameters have same
+ meaning as for ds_select_dst().
+ </para>
+ <para>
+ If the bit 2 in 'flags' is set, the rest of the addresses from the
+ destination set is stored in AVP list (limited with an optional 'limit'
+ parameter). You can execute 'ds_next_domain()' or 'ds_next_dst()' to use
+ next address to achieve serial forking to all possible destinations.
+ </para>
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+ <example>
+ <title><function>ds_select</function> usage</title>
+ <programlisting format="linespecific">
+...
+$var(a) = 4;
+if(ds_select("1", "$var(a)")) {
+ ds_next_domain();
+ t_relay();
+ exit;
+}
+...
+</programlisting>
+ </example>
+ </section>
+ <section>
+ <title>
+ <function moreinfo="none">ds_next_dst()</function>
+ </title>
+ <para>
+ Takes the next destination address from the AVPs with id 'dst_avp_id'
and sets the dst_uri (outbound proxy address).
</para>
<para>
Module: kamailio
Branch: master
Commit: 1d401e0a9b4c3010c32b0084ec6a218fc46e4f78
URL: https://github.com/kamailio/kamailio/commit/1d401e0a9b4c3010c32b0084ec6a218…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-03-24T09:21:00+01:00
dispatcher: coherent indentation and whitespacing
---
Modified: modules/dispatcher/dispatch.c
Modified: modules/dispatcher/dispatcher.c
---
Diff: https://github.com/kamailio/kamailio/commit/1d401e0a9b4c3010c32b0084ec6a218…
Patch: https://github.com/kamailio/kamailio/commit/1d401e0a9b4c3010c32b0084ec6a218…
---
diff --git a/modules/dispatcher/dispatch.c b/modules/dispatcher/dispatch.c
index 6921aae..60c9121 100644
--- a/modules/dispatcher/dispatch.c
+++ b/modules/dispatcher/dispatch.c
@@ -305,7 +305,7 @@ int add_dest2list(int id, str uri, int flags, int priority, str *attrs,
/* skip IPv6 references if IPv6 lookups are disabled */
if (default_core_cfg.dns_try_ipv6 == 0 &&
- puri.host.s[0] == '[' && puri.host.s[puri.host.len-1] == ']') {
+ puri.host.s[0] == '[' && puri.host.s[puri.host.len-1] == ']') {
LM_DBG("skipping IPv6 record %.*s\n", puri.host.len, puri.host.s);
return 0;
}
@@ -496,7 +496,7 @@ int dp_init_relative_weights(ds_set_t *dset)
if(dset==NULL || dset->dlist==NULL)
return -1;
-
+
int rw_sum = 0;
/* find the sum of relative weights*/
for(j=0; j<dset->nr; j++){
@@ -514,9 +514,9 @@ int dp_init_relative_weights(ds_set_t *dset)
for(j=0; j<dset->nr; j++)
{
if( ds_skip_dst(dset->dlist[j].flags ) )
- continue;
+ continue;
- int current_slice = dset->dlist[j].attrs.rweight*100/rw_sum; //truncate here;
+ int current_slice = dset->dlist[j].attrs.rweight*100/rw_sum; //truncate here;
for(k=0; k<current_slice; k++)
{
dset->rwlist[t] = (unsigned int)j;
@@ -525,7 +525,7 @@ int dp_init_relative_weights(ds_set_t *dset)
}
/* if the array was not completely filled (i.e., the sum of rweights is
* less than 100 due to truncated), then use last address to fill the rest */
- unsigned int last_insert = t>0? dset->rwlist[t-1] : (unsigned int)(dset->nr-1);
+ unsigned int last_insert = t>0? dset->rwlist[t-1] : (unsigned int)(dset->nr-1);
for(j=t; j<100; j++)
dset->rwlist[j] = last_insert;
@@ -1765,7 +1765,7 @@ static inline int ds_update_dst(struct sip_msg *msg, str *uri,
return -1;
}
/* dst_uri changes, so it makes sense to re-use the current uri for
- forking */
+ * forking */
ruri_mark_new(); /* re-use uri for serial forking */
break;
}
@@ -2487,7 +2487,7 @@ static void ds_run_route(sip_msg_t *msg, str *uri, char *route)
/**
- recalculate relative states if some destination state was changed
+ * recalculate relative states if some destination state was changed
*/
int ds_reinit_rweight_on_state_change(int old_state, int new_state, ds_set_t *dset)
{
@@ -2495,7 +2495,7 @@ int ds_reinit_rweight_on_state_change(int old_state, int new_state, ds_set_t *ds
LM_ERR("destination set is null\n");
return -1;
}
- if ( (!ds_skip_dst(old_state) && ds_skip_dst(new_state)) ||
+ if ( (!ds_skip_dst(old_state) && ds_skip_dst(new_state)) ||
(ds_skip_dst(old_state) && !ds_skip_dst(new_state)) )
{
dp_init_relative_weights(dset);
@@ -2804,8 +2804,8 @@ static void ds_options_callback( struct cell *t, int type,
{
/* Set the according entry back to "Active" */
state = 0;
- if (ds_probing_mode==DS_PROBE_ALL ||
- ((ds_probing_mode==DS_PROBE_ONLYFLAGGED)
+ if (ds_probing_mode==DS_PROBE_ALL ||
+ ((ds_probing_mode==DS_PROBE_ONLYFLAGGED)
&& (ds_get_state(group, &uri) & DS_PROBING_DST)))
state |= DS_PROBING_DST;
diff --git a/modules/dispatcher/dispatcher.c b/modules/dispatcher/dispatcher.c
index 51d1955..2a0ddbc 100644
--- a/modules/dispatcher/dispatcher.c
+++ b/modules/dispatcher/dispatcher.c
@@ -96,9 +96,9 @@ unsigned short sock_avp_type;
pv_elem_t * hash_param_model = NULL;
int probing_threshold = 1; /* number of failed requests, before a destination
- is taken into probing */
+ * is taken into probing */
int inactive_threshold = 1; /* number of replied requests, before a destination
- is taken into back in active state */
+ * is taken into back in active state */
str ds_ping_method = str_init("OPTIONS");
str ds_ping_from = str_init("sip:dispatcher@localhost");
static int ds_ping_interval = 0;
Hi there,
we are using kamailio as Registrar and Dispatcher.
Running ```modparam("auth_db", "use_domain", MULTIDOMAIN) //with MULTIDOMAIN = 1```
In our ```route[AUTH]```
I call ```if (!auth_check("$fd", "subscriber", "1")) {```
to filter unwanted Guests and and brute-force attacks to the blacklist.
strangely auth_check fails under the following conditions:
1 UserAgent(Phone) with 2 SipAccounts with the same user-name but different realm
The first account can REGISTER without a problem.
for the second Account REGISTER fails with -2.
If I disable the first one the second one Registered.
Could it be that auth_check is not multidomain-safe in one user-agent thread?
Hope to here from you...
PS: I like kamailio =).
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/548