Module: sip-router
Branch: master
Commit: 78f0c33c3793a7c586860c65ed84e8442808d580
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=78f0c33…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: Sat Jan 26 17:56:51 2013 +0100
dispatcher - Fix typo in README and add return value information for ds_select_dst
The return value was used in the example, but not documented.
---
modules/dispatcher/README | 5 +++--
modules/dispatcher/doc/dispatcher_admin.xml | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules/dispatcher/README b/modules/dispatcher/README
index 358730d..576e3fb 100644
--- a/modules/dispatcher/README
+++ b/modules/dispatcher/README
@@ -685,12 +685,13 @@ Note
4.1. ds_select_dst(set, alg)
- The method selects a destination from addresses set.
+ The method selects a destination from addresses set. It returns true if
+ a new destination is set.
Meaning of the parameters is as follows:
* set - the id of the set from where to pick up destination address.
It is the first column in destination list file. The parameter can
- be an integer or a variable holding an interger.
+ be an integer or a variable holding an integer.
* alg - the algorithm used to select the destination address. The
parameter can be an integer or a variable holding an interger.
+ "0" - hash over callid
diff --git a/modules/dispatcher/doc/dispatcher_admin.xml b/modules/dispatcher/doc/dispatcher_admin.xml
index 7f66d10..7a02921 100644
--- a/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/modules/dispatcher/doc/dispatcher_admin.xml
@@ -721,7 +721,8 @@ modparam("dispatcher", "force_dst", 1)
<function moreinfo="none">ds_select_dst(set, alg)</function>
</title>
<para>
- The method selects a destination from addresses set.
+ The method selects a destination from addresses set. It returns true if
+ a new destination is set.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
@@ -730,7 +731,7 @@ modparam("dispatcher", "force_dst", 1)
<emphasis>set</emphasis> - the id of the set from where to pick
up destination address. It is the first column in destination
list file. The parameter can be an integer or a variable holding
- an interger.
+ an integer.
</para>
</listitem>
<listitem>
Hi!
THe branch I just published contains some functions made a day after code freeze. With this you can check if a named route exists, and call it if it exists.
This works well with non-mandatory include files. You can now have building blocks and just dump a NAT-manage file in an include directory. If that's included and that route block is defined, then execute it.
Small changes that I added to the cfgutils module if that's ok with all the authors of that module.
Please test and if everything seems ok, I'll merge after 4.0.0 release.
Have a great weekend!
Cheers,
/O
Documentation:
==============
4.17. check_route_exists(route)
Check if a route block exists
Parameters:
"name" of a route block in the config file, like "route[FROGJUMP]"
This function can be used from any route. You can only check for
route[] blocks, not reply, event or other routes.
Example 1.21. check_route_exists() usage
...
if(check_route_exists("FROGJUMP") {
$var(jumping_frogs) = 1;
};
...
4.18. route_if_exists(route)
Execute a routing block only if it is defined. If it's not defined,
silently move to the next action in the configuration script.
Parameters:
"name" of a route block in the config file, like "route[FROGJUMP]"
This function can be used from any route. You can only execute it for
route[] blocks, not reply, event or other routes.
Example 1.22. route_if_exists() usage
...
route_if_exists("PRESENCE_SANTA_CLAUS");
...
Module: sip-router
Branch: oej/routeblocks
Commit: 446a1289d53e16682c502673535a98ad9710ce3b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=446a128…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: Fri Jan 25 18:58:42 2013 +0100
Merge branch 'master' into oej/routeblocks
* master: (70 commits)
core: made a wrapper forward_reply_nocb()
sl: use forward_reply_nocb() for sl_forward_reply()
core: end simple pv name (e.g., $xy) at end of line
db_cassandra: Replaced 'openser' with 'kamailio'
core: default compatibility set to SR_COMPAT_MAX
correct url to libjson in json and jsonrpc-c module docs
pkg/kamailio/(centos|fedora): Removed old FC16 build
lib/srdb1: update custom sql functions for uid tables
kamctl: added option to grant sql access from a remote host
kamctl: added option to creat uid-related tables
kamctl: cleaned db creation
json: proper handling of empty values for json documents
modules:sipcapture Added PSQL schema, fixed columns length, fixed id column for PostgreSQL
pua_reginfo: fix setting lengths of contact attributes
siputils: fix decode2format fuction to handle ; in userpart
modules:sipcapture Changed authorization column to "auth". Now PostgreSQL should be happy.
kamdbctl: fix presence tables provisioning
app_python: reverted changes (dlflags)
pkg/kamailio/fedora: added build files for Fedora 18
README remove "modules_k"
...
---
Module: sip-router
Branch: master
Commit: 9cb173699b25bc420ff5938214b3df81ed18a4ba
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9cb1736…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Jan 25 17:30:42 2013 +0100
core: made a wrapper forward_reply_nocb()
- it forwards a reply without calling the callbacks from modules for sip
response handling
- fixes the issue of sl_forward_reply() looping when used in TM onreply
routes
---
forward.c | 26 +++++++++++++++++++++-----
forward.h | 1 +
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/forward.c b/forward.c
index b0540d2..380b204 100644
--- a/forward.c
+++ b/forward.c
@@ -754,7 +754,8 @@ int update_sock_struct_from_via( union sockaddr_union* to,
he=sip_resolvehost(name, &port, &proto);
if (he==0){
- LOG(L_NOTICE, "ERROR:forward_reply:resolve_host(%.*s) failure\n",
+ LOG(L_NOTICE,
+ "update_sock_struct_from_via:resolve_host(%.*s) failure\n",
name->len, name->s);
return -1;
}
@@ -765,8 +766,9 @@ int update_sock_struct_from_via( union sockaddr_union* to,
-/* removes first via & sends msg to the second */
-int forward_reply(struct sip_msg* msg)
+/* removes first via & sends msg to the second
+ * - mode param controls if modules sip response callbacks are executed */
+static int do_forward_reply(struct sip_msg* msg, int mode)
{
char* new_buf;
struct dest_info dst;
@@ -792,8 +794,10 @@ int forward_reply(struct sip_msg* msg)
}
/* check modules response_f functions */
- for (r=0; r<mod_response_cbk_no; r++)
- if (mod_response_cbks[r](msg)==0) goto skip;
+ if(likely(mode==0)) {
+ for (r=0; r<mod_response_cbk_no; r++)
+ if (mod_response_cbks[r](msg)==0) goto skip;
+ }
/* we have to forward the reply stateless, so we need second via -bogdan*/
if (parse_headers( msg, HDR_VIA2_F, 0 )==-1
|| (msg->via2==0) || (msg->via2->error!=PARSE_OK))
@@ -872,6 +876,18 @@ error:
return -1;
}
+/* removes first via & sends msg to the second */
+int forward_reply(struct sip_msg* msg)
+{
+ return do_forward_reply(msg, 0);
+}
+
+/* removes first via & sends msg to the second - no module callbacks */
+int forward_reply_nocb(struct sip_msg* msg)
+{
+ return do_forward_reply(msg, 1);
+}
+
static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg)
{
if (msg->force_send_socket != 0) {
diff --git a/forward.h b/forward.h
index 2b9ae78..17ac683 100644
--- a/forward.h
+++ b/forward.h
@@ -105,6 +105,7 @@ int update_sock_struct_from_via( union sockaddr_union* to,
((msg)->via1->port)?(msg)->via1->port: SIP_PORT )
int forward_reply( struct sip_msg* msg);
+int forward_reply_nocb( struct sip_msg* msg);
int is_check_self_func_list_set(void);