URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=657b180…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Fri Aug 22 11:44:56 2014 +0200
dialog: Send properly structured responses on RPC requests
Instead of dumping random blobs in structured protocols (json, xmlrpc),
return properly structured data.
Each dialog is a struct with named fields, a list of dialogs is an array
of structs. Variables and profiles are arrays in the dialog struct.
Dialog contexts still todo.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f17a349…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Fri Aug 22 15:30:07 2014 +0200
dialog: Unset DMQ_SYNC flag upon restore from DB on another host
Don't try to sync non-local dialogs via DMQ after DB restore.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7b23af7…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Fri Aug 22 13:55:42 2014 +0200
dialog: Correctly restore dialog lifetime from DB
Restore the lifetime to the configured value instead of the offset from the
time the reload from the DB took place.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3f5ddcc…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Mon Aug 11 17:03:31 2014 +0200
dialog: Introduce increment and offset for hash id's
When replicating dialogs via dmq, the id's must not overlap. introduce an
offset and increment so each kamailio instance creates unique id's. The
increment must be identical between all involved proxies, the offset must
be unique.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=50d96c0…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Thu Aug 7 17:13:17 2014 +0200
dialog: Add syncing via DMQ
Primary purpose is to sync profiles. This implements just that.
Enough of the state is synced to maintain identical profiles counts on
all kamailio instances.
Changed profiles are only synced as the request is sent out, adding
multiple profiles will result in just 1 sync message at the moment
the request is being sent.
It is not possible for the 'other' instances to send in-dialog requests.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3d6e507…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Thu Aug 7 11:22:53 2014 +0200
dialog: delete dialog on negative ack, not tm destroy
Do what the comments say, destroy the dialog on reception of a negative ACK
instead of delaying it until the transaction is cleaned up. Keep the old
behaviour as backup for when the ACK is missing.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=74923e4…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Fri Aug 22 15:55:05 2014 +0200
dmq: More efficient peer storage
Allocate only 1 hunk of memory for the entire peer's storage needs.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ce92fe7…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Fri Aug 22 15:51:49 2014 +0200
dmq: Broadcast nodelists to all hosts
Update all hosts with updated state on shutdown.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3214481…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Fri Aug 22 15:48:28 2014 +0200
dmq: Handle Max-Forwards correctly when maxfwd module is used.
The maxfwd module will change the current msg buffer with a decreased
Max-Forwards header. Detect this sitation via the 'parsed' field and handle
it.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4fc27d4…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Fri Aug 22 15:46:08 2014 +0200
dmq: Use the received status updates from peer hosts to update in-memory status
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e4e63eb…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Fri Aug 22 15:42:51 2014 +0200
dmq: Set node status to value in uri
The status was forced to ACTIVE regardless of the status in the uri.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b8db958…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Mon Aug 11 19:06:42 2014 +0200
dmq: Various sanity checks and initializations
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=061b485…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Thu Aug 7 17:20:20 2014 +0200
dmq: fix copy-paste error resulting in the peer's description not being copied
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=95d4e0f…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Thu Jul 17 13:02:12 2014 +0200
dmq: Set send_socket to the correct address
UDP is hardcodd because DMQ doesn;t work with other protocols (yet)
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c589248…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Mon Jul 7 16:38:29 2014 +0200
dialog: Set the dialog context on transaction failure
Before, the dialog context would be derived from the callid and tags. This
could select the wrong dialog in case of spirals. This patch sets the correct
dialog context by storing the it in the transaction and restoring it on a
failure. Now the correct dialog variables are available in failure_route.
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ad45f19…
Author: Alex Hermann <alex(a)speakup.nl>
Date: Mon Jul 7 16:38:29 2014 +0200
dialog: Set the dialog context on incoming replies
Before, the dialog context would be derived from the callid and tags. This
could select the wrong dialog in case of spirals. This patch sets the correct
dialog context by storing the it in the transaction and restoring it on an
incoming response. Now the correct dialog variables are available in
onreply_route.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#458 - Do not fork command line option
User who did this - Jay J (jayka)
----------
Hi guys,
So what is the behavior currently?
What I am looking for is running the main process in the foreground, at the same time forking it on the back end.
The use case for this is using a process manager (such as supervisor) that has to read stout in order to monitor the health of (and restart if necessary) the process.
Thanks!
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=458#comment1599
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Fabio (fabiovn)
Attached to Project - sip-router
Summary - Content of $dlg_vars are mixed with each other when writing cdr values on version 4.1.5-1.1
Task Type - Bug Report
Category - dialog
Status - Unconfirmed
Assigned To -
Operating System - Linux
Severity - Low
Priority - Normal
Reported Version - 4.1
Due in Version - Undecided
Due Date - Undecided
Details - -> Version 4.1.5-1.1
-> param cdr_enable = 1
-> using $dlg_var on cdr_extra param
When a call is finished, contents of all $dlg_vars are mixed with each other, causing the CDR not to be stored correctly. Used to work fine on version 4.1.3-2.1.
Thanks.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=463
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Module: sip-router
Branch: master
Commit: d5c6185f4369833113e21802baafe18288fb4254
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d5c6185…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Aug 22 15:52:12 2014 +0200
dialog: documentation for dlg_remote_profile() config function
---
modules/dialog/README | 31 +++++++++++++++++++++
modules/dialog/doc/dialog_admin.xml | 51 +++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 0 deletions(-)
diff --git a/modules/dialog/README b/modules/dialog/README
index aeafc0b..37b2bc4 100644
--- a/modules/dialog/README
+++ b/modules/dialog/README
@@ -110,6 +110,7 @@ Alex Balashov
6.14. dlg_set_timeout(timeout [, h_entry, h_id])
6.15. dlg_set_timeout_by_profile(profile, [value], timeout)
6.16. dlg_set_property(attr)
+ 6.17. dlg_remote_profile(cmd, profile, value, uid, expires)
7. Statistics
@@ -233,6 +234,7 @@ Alex Balashov
1.64. dlg_set_timeout usage
1.65. dlg_set_timeout_by_profile usage
1.66. dlg_set_property usage
+ 1.67. dlg_remote_profile usage
Chapter 1. Admin Guide
@@ -317,6 +319,7 @@ Chapter 1. Admin Guide
6.14. dlg_set_timeout(timeout [, h_entry, h_id])
6.15. dlg_set_timeout_by_profile(profile, [value], timeout)
6.16. dlg_set_property(attr)
+ 6.17. dlg_remote_profile(cmd, profile, value, uid, expires)
7. Statistics
@@ -1169,6 +1172,7 @@ modparam("dialog", "timer_procs", 1)
6.14. dlg_set_timeout(timeout [, h_entry, h_id])
6.15. dlg_set_timeout_by_profile(profile, [value], timeout)
6.16. dlg_set_property(attr)
+ 6.17. dlg_remote_profile(cmd, profile, value, uid, expires)
6.1. set_dlg_profile(profile,[value])
@@ -1511,6 +1515,33 @@ dlg_set_property("ka-dst");
dlg_set_property("timeout-noreset");
...
+6.17. dlg_remote_profile(cmd, profile, value, uid, expires)
+
+ Manage remote profile via config file. A remote profile item is
+ considered when the dialog is not managed by this server instance. The
+ notification to add/remove can be received via SIP or a RPC command,
+ the operation can be then triggered from configuration file. This
+ should allow counting active dialogs in a profile that are managed by
+ multiple SIP server instances.
+
+ Meaning of the parameters is as follows:
+ * cmd - the operations to do: add - add an item in profile; rm -
+ remove an item from profile
+ * profile - name of profile
+ * value - value for profile (if no value is needed for that profile,
+ use an empty string.
+ * expires - absolute time (unix timestamp) when this profile item
+ should be removed automatically (time based), if still in the
+ profile
+
+ This function can be used from ANY_ROUTE.
+
+ Example 1.67. dlg_remote_profile usage
+...
+$var(exp) = 3600 + $Ts;
+dlg_remote_profile("add", "caller", "test", "$sruid", "$var(exp)");
+...
+
7. Statistics
7.1. active_dialogs
diff --git a/modules/dialog/doc/dialog_admin.xml b/modules/dialog/doc/dialog_admin.xml
index 1d5506f..3feb5f3 100644
--- a/modules/dialog/doc/dialog_admin.xml
+++ b/modules/dialog/doc/dialog_admin.xml
@@ -1886,6 +1886,57 @@ dlg_set_property("timeout-noreset");
</example>
</section>
+ <section id="dialog.f.dlg_remote_profile">
+ <title>
+ <function moreinfo="none">dlg_remote_profile(cmd, profile, value, uid, expires)</function>
+ </title>
+ <para>
+ Manage remote profile via config file. A remote profile item is considered when
+ the dialog is not managed by this server instance. The notification to add/remove
+ can be received via SIP or a RPC command, the operation can be then triggered
+ from configuration file. This should allow counting active dialogs in a profile
+ that are managed by multiple SIP server instances.
+ </para>
+ <para>Meaning of the parameters is as follows:</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis>cmd</emphasis> - the operations to do: add - add an item in
+ profile; rm - remove an item from profile
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>profile</emphasis> - name of profile
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>value</emphasis> - value for profile (if no value is needed
+ for that profile, use an empty string.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>expires</emphasis> - absolute time (unix timestamp) when this
+ profile item should be removed automatically (time based),
+ if still in the profile
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+ <example>
+ <title><function>dlg_remote_profile</function> usage</title>
+ <programlisting format="linespecific">
+...
+$var(exp) = 3600 + $Ts;
+dlg_remote_profile("add", "caller", "test", "$sruid", "$var(exp)");
+...
+</programlisting>
+ </example>
+ </section>
</section>
hi ,
i would like to submit a patch to pua_dialoginfo to expose
the dialog_publish function to the script so that we can configure
something like this in the script.
route[MY_ROUTE]
{
pua_dialoginfo_publish(.......)
}
i also want to provide a new module pua_mwi that publishes mwi info.
what's the proper flow to submit this ? i want to submit it to 4.0 and 4.1
branch.
also, there seems to be a bug in json module on fixup_get_field_free
function
if (param_no == 3) {
return fixup_free_pvar_null(param, 3); <<<== shouldn't this be 1 ?
}
thanks
Module: sip-router
Branch: master
Commit: 0b2462d745ac05587539f6c937aed5580ad92c8c
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0b2462d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Aug 22 15:58:31 2014 +0200
dispatcher: regenerated the documentation for update on ds_select_dst()
---
modules/dispatcher/README | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/modules/dispatcher/README b/modules/dispatcher/README
index 2357883..50b7d1b 100644
--- a/modules/dispatcher/README
+++ b/modules/dispatcher/README
@@ -67,8 +67,8 @@ Carsten Bock
4. Functions
- 4.1. ds_select_dst(set, alg)
- 4.2. ds_select_domain(set, alg)
+ 4.1. ds_select_dst(set, alg[, limit])
+ 4.2. ds_select_domain(set, alg[, limit])
4.3. ds_next_dst()
4.4. ds_next_domain()
4.5. ds_mark_dst([state])
@@ -183,8 +183,8 @@ Chapter 1. Admin Guide
4. Functions
- 4.1. ds_select_dst(set, alg)
- 4.2. ds_select_domain(set, alg)
+ 4.1. ds_select_dst(set, alg[, limit])
+ 4.2. ds_select_domain(set, alg[, limit])
4.3. ds_next_dst()
4.4. ds_next_domain()
4.5. ds_mark_dst([state])
@@ -690,8 +690,8 @@ Note
4. Functions
- 4.1. ds_select_dst(set, alg)
- 4.2. ds_select_domain(set, alg)
+ 4.1. ds_select_dst(set, alg[, limit])
+ 4.2. ds_select_domain(set, alg[, limit])
4.3. ds_next_dst()
4.4. ds_next_domain()
4.5. ds_mark_dst([state])
@@ -699,7 +699,7 @@ Note
4.7. ds_load_update()
4.8. ds_load_unset()
-4.1. ds_select_dst(set, alg)
+4.1. ds_select_dst(set, alg[, limit])
The method selects a destination from addresses set. It returns true if
a new destination is set. The selected address is set to dst_uri field
@@ -707,9 +707,10 @@ Note
in the SIP request.
If the bit 2 in 'flags' parameter is set, the rest of the addresses
- from the destination set is stored in AVP list. You can use
- 'ds_next_dst()' to use next address in order to achieve serial forking
- to all possible destinations.
+ from the destination set is stored in AVP list (limited with an
+ optional 'limit' parameter). You can use 'ds_next_dst()' to use next
+ address in order to achieve serial forking to all possible
+ destinations.
Meaning of the parameters is as follows:
* set - the id of the set from where to pick up destination address.
@@ -748,6 +749,9 @@ Note
requests as it is the only SIP method creating a SIP call.
+ "X" - if the algorithm is not implemented, the first entry in
set is chosen.
+ * limit - the maximum number of items to be stored in AVP list for
+ further failovers (the first selected destination and default
+ destination are the first to be put in the list)
If the bit 2 in 'flags' is set, the rest of the addresses from the
destination set is stored in AVP list. You can use 'ds_next_dst()' to
@@ -763,17 +767,19 @@ ds_select_dst("1", "0");
$var(a) = 4;
ds_select_dst("1", "$var(a)");
...
+ds_select_dst("1", "4", "3");
+...
-4.2. ds_select_domain(set, alg)
+4.2. ds_select_domain(set, alg[, limit])
The method selects a destination from addresses set and rewrites the
host and port from R-URI. The parameters have same meaning as for
ds_select_dst().
If the bit 2 in 'flags' is set, the rest of the addresses from the
- destination set is stored in AVP list. You can use 'ds_next_domain()'
- to use next address to achieve serial forking to all possible
- destinations.
+ destination set is stored in AVP list (limited with an optional 'limit'
+ parameter). You can use 'ds_next_domain()' to use next address to
+ achieve serial forking to all possible destinations.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
Module: sip-router
Branch: master
Commit: 15d1022b575ae06f92f5a966bc12e144f3def5c5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=15d1022…
Author: Alekzander Spiridonov <sipidronov(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Aug 21 08:20:09 2014 -0700
dispatcher: option to limit the number of items in dst_avp list
---
modules/dispatcher/dispatch.c | 18 +++++++-
modules/dispatcher/dispatch.h | 1 +
modules/dispatcher/dispatcher.c | 56 ++++++++++++++++++++++-----
modules/dispatcher/doc/dispatcher_admin.xml | 26 +++++++++----
4 files changed, 80 insertions(+), 21 deletions(-)
diff --git a/modules/dispatcher/dispatch.c b/modules/dispatcher/dispatch.c
index bc945f8..8fc6b79 100644
--- a/modules/dispatcher/dispatch.c
+++ b/modules/dispatcher/dispatch.c
@@ -1583,6 +1583,11 @@ static inline int ds_update_dst(struct sip_msg *msg, str *uri, int mode)
*/
int ds_select_dst(struct sip_msg *msg, int set, int alg, int mode)
{
+ return ds_select_dst_limit(msg, set, alg, 0, mode);
+}
+
+int ds_select_dst_limit(struct sip_msg *msg, int set, int alg, unsigned int limit, int mode)
+{
int i, cnt;
unsigned int hash;
int_str avp_val;
@@ -1600,6 +1605,13 @@ int ds_select_dst(struct sip_msg *msg, int set, int alg, int mode)
return -1;
}
+ if (limit==0)
+ {
+ LM_DBG("Limit set to 0 - forcing to unlimited\n");
+ limit = 0xffffffff;
+ }
+ --limit; /* reserving 1 slot for selected dst */
+
if((mode==0) && (ds_force_dst==0)
&& (msg->dst_uri.s!=NULL || msg->dst_uri.len>0))
{
@@ -1767,7 +1779,7 @@ int ds_select_dst(struct sip_msg *msg, int set, int alg, int mode)
if(dst_avp_name.n!=0)
{
/* add default dst to last position in AVP list */
- if(ds_use_default!=0 && hash!=idx->nr-1)
+ if(ds_use_default!=0 && hash!=idx->nr-1 && cnt<limit)
{
avp_val.s = idx->dlist[idx->nr-1].uri;
if(add_avp(AVP_VAL_STR|dst_avp_type, dst_avp_name, avp_val)!=0)
@@ -1799,7 +1811,7 @@ int ds_select_dst(struct sip_msg *msg, int set, int alg, int mode)
/* add to avp */
- for(i=hash-1; i>=0; i--)
+ 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)))
@@ -1833,7 +1845,7 @@ int ds_select_dst(struct sip_msg *msg, int set, int alg, int mode)
cnt++;
}
- for(i=idx->nr-1; i>hash; i--)
+ 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)))
diff --git a/modules/dispatcher/dispatch.h b/modules/dispatcher/dispatch.h
index 31262b5..c02cf50 100644
--- a/modules/dispatcher/dispatch.h
+++ b/modules/dispatcher/dispatch.h
@@ -107,6 +107,7 @@ void ds_disconnect_db(void);
int ds_load_db(void);
int ds_reload_db(void);
int ds_destroy_list(void);
+int ds_select_dst_limit(struct sip_msg *msg, int set, int alg, unsigned int limit, int mode);
int ds_select_dst(struct sip_msg *msg, int set, int alg, int mode);
int ds_next_dst(struct sip_msg *msg, int mode);
int ds_update_state(sip_msg_t *msg, int group, str *address, int state);
diff --git a/modules/dispatcher/dispatcher.c b/modules/dispatcher/dispatcher.c
index 7df0c6d..0ec3338 100644
--- a/modules/dispatcher/dispatcher.c
+++ b/modules/dispatcher/dispatcher.c
@@ -106,8 +106,8 @@ pv_elem_t * hash_param_model = NULL;
int probing_threshhold = 1; /* number of failed requests, before a destination
is taken into probing */
-str ds_ping_method = {"OPTIONS",7};
-str ds_ping_from = {"sip:dispatcher@localhost", 24};
+str ds_ping_method = str_init("OPTIONS");
+str ds_ping_from = str_init("sip:dispatcher@localhost");
static int ds_ping_interval = 0;
int ds_probing_mode = DS_PROBE_NONE;
@@ -147,7 +147,9 @@ static int ds_parse_reply_codes();
static int ds_init_rpc(void);
static int w_ds_select_dst(struct sip_msg*, char*, char*);
+static int w_ds_select_dst_limit(struct sip_msg*, char*, char*, char*);
static int w_ds_select_domain(struct sip_msg*, char*, char*);
+static int w_ds_select_domain_limit(struct sip_msg*, char*, char*, char*);
static int w_ds_next_dst(struct sip_msg*, char*, char*);
static int w_ds_next_domain(struct sip_msg*, char*, char*);
static int w_ds_mark_dst0(struct sip_msg*, char*, char*);
@@ -170,8 +172,12 @@ static int mi_child_init(void);
static cmd_export_t cmds[]={
{"ds_select_dst", (cmd_function)w_ds_select_dst, 2,
fixup_igp_igp, 0, REQUEST_ROUTE|FAILURE_ROUTE},
+ {"ds_select_dst", (cmd_function)w_ds_select_dst_limit, 3,
+ fixup_igp_null, 0, REQUEST_ROUTE|FAILURE_ROUTE},
{"ds_select_domain", (cmd_function)w_ds_select_domain, 2,
fixup_igp_igp, 0, REQUEST_ROUTE|FAILURE_ROUTE},
+ {"ds_select_domain", (cmd_function)w_ds_select_domain_limit, 3,
+ fixup_igp_null, 0, REQUEST_ROUTE|FAILURE_ROUTE},
{"ds_next_dst", (cmd_function)w_ds_next_dst, 0,
ds_warn_fixup, 0, REQUEST_ROUTE|FAILURE_ROUTE},
{"ds_next_domain", (cmd_function)w_ds_next_domain, 0,
@@ -526,12 +532,13 @@ static void destroy(void)
/**
*
*/
-static int w_ds_select(struct sip_msg* msg, char* set, char* alg, int mode)
+static int w_ds_select(struct sip_msg* msg, char* set, char* alg, char* limit, int mode)
{
- unsigned int algo_flags, set_flags;
- str s_algo = {NULL, 0};
- str s_set = {NULL, 0};
- int a, s;
+ unsigned int algo_flags, set_flags, limit_flags;
+ str s_algo = STR_NULL;
+ str s_set = STR_NULL;
+ str s_limit = STR_NULL;
+ int a, s, l;
if(msg==NULL)
return -1;
@@ -552,14 +559,35 @@ static int w_ds_select(struct sip_msg* msg, char* set, char* alg, int mode)
return -1;
}
- return ds_select_dst(msg, s, a, mode);
+ if (limit) {
+ GET_VALUE("limit", limit, l, s_limit, limit_flags);
+ if (!(limit_flags&PARAM_INT)) {
+ if (limit_flags&PARAM_STR)
+ LM_ERR("unable to get dst number limit from [%.*s]\n", s_limit.len, s_limit.s);
+ else
+ LM_ERR("unable to get dst number limit\n");
+ return -1;
+ }
+ } else {
+ l = -1; /* will be casted to a rather big unsigned value */
+ }
+
+ return ds_select_dst_limit(msg, s, a, (unsigned int)l, mode);
}
/**
*
*/
static int w_ds_select_dst(struct sip_msg* msg, char* set, char* alg)
{
- return w_ds_select(msg, set, alg, 0 /*set dst uri*/);
+ return w_ds_select(msg, set, alg, 0 /* limit number of dst*/, 0 /*set dst uri*/);
+}
+
+/**
+ *
+ */
+static int w_ds_select_dst_limit(struct sip_msg* msg, char* set, char* alg, char* limit)
+{
+ return w_ds_select(msg, set, alg, limit /* limit number of dst*/, 0 /*set dst uri*/);
}
/**
@@ -567,7 +595,15 @@ static int w_ds_select_dst(struct sip_msg* msg, char* set, char* alg)
*/
static int w_ds_select_domain(struct sip_msg* msg, char* set, char* alg)
{
- return w_ds_select(msg, set, alg, 1 /*set host port*/);
+ return w_ds_select(msg, set, alg, 0 /* limit number of dst*/, 1 /*set host port*/);
+}
+
+/**
+ *
+ */
+static int w_ds_select_domain_limit(struct sip_msg* msg, char* set, char* alg, char* limit)
+{
+ return w_ds_select(msg, set, alg, limit /* limit number of dst*/, 1 /*set host port*/);
}
/**
diff --git a/modules/dispatcher/doc/dispatcher_admin.xml b/modules/dispatcher/doc/dispatcher_admin.xml
index 75debec..75031f9 100644
--- a/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/modules/dispatcher/doc/dispatcher_admin.xml
@@ -737,7 +737,7 @@ modparam("dispatcher", "force_dst", 1)
<title>Functions</title>
<section id="dispatcher.f.ds_select_dst">
<title>
- <function moreinfo="none">ds_select_dst(set, alg)</function>
+ <function moreinfo="none">ds_select_dst(set, alg[, limit])</function>
</title>
<para>
The method selects a destination from addresses set. It returns true if
@@ -747,9 +747,9 @@ modparam("dispatcher", "force_dst", 1)
</para>
<para>
If the bit 2 in 'flags' parameter is set, the rest of the addresses from
- the destination set is stored in AVP list. You can use 'ds_next_dst()'
- to use next address in order to achieve serial forking to all possible
- destinations.
+ the destination set is stored in AVP list (limited with an optional 'limit'
+ parameter). You can use 'ds_next_dst()' to use next address in order to
+ achieve serial forking to all possible destinations.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
@@ -856,6 +856,14 @@ modparam("dispatcher", "force_dst", 1)
</listitem>
</itemizedlist>
</listitem>
+ <listitem>
+ <para>
+ <emphasis>limit</emphasis> - the maximum number of items to be
+ stored in AVP list for further failovers (the first selected
+ destination and default destination are the first to be put in
+ the list)
+ </para>
+ </listitem>
</itemizedlist>
<para>
If the bit 2 in 'flags' is set, the rest of the addresses from the
@@ -875,12 +883,14 @@ ds_select_dst("1", "0");
$var(a) = 4;
ds_select_dst("1", "$var(a)");
...
+ds_select_dst("1", "4", "3");
+...
</programlisting>
</example>
</section>
<section id="dispatcher.f.ds_select_domain">
<title>
- <function moreinfo="none">ds_select_domain(set, alg)</function>
+ <function moreinfo="none">ds_select_domain(set, alg[, limit])</function>
</title>
<para>
The method selects a destination from addresses set and rewrites the
@@ -889,9 +899,9 @@ ds_select_dst("1", "$var(a)");
</para>
<para>
If the bit 2 in 'flags' is set, the rest of the addresses from the
- destination set is stored in AVP list. You can use 'ds_next_domain()'
- to use next address to achieve serial forking to all possible
- destinations.
+ destination set is stored in AVP list (limited with an optional 'limit'
+ 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.