[sr-dev] git:master: dispatcher: allow pv in ds_is_from_list(setid) parameter

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 12 10:23:32 CEST 2013


Module: sip-router
Branch: master
Commit: 9a25e712529cb7aacbae8e64a2e1be4da3c9a8c3
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9a25e712529cb7aacbae8e64a2e1be4da3c9a8c3

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Jul 12 10:22:33 2013 +0200

dispatcher: allow pv in ds_is_from_list(setid) parameter

---

 modules/dispatcher/README                   |    4 +++-
 modules/dispatcher/dispatcher.c             |   10 ++++++++--
 modules/dispatcher/doc/dispatcher_admin.xml |    4 +++-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/modules/dispatcher/README b/modules/dispatcher/README
index 4736445..9f8e73c 100644
--- a/modules/dispatcher/README
+++ b/modules/dispatcher/README
@@ -829,7 +829,9 @@ failure_route[tryagain] {
    Parameter groupid is optional, when it is missing, then the matching
    will be done against all addresses in all groups. Upon a match, the
    variable specified by 'setid_pvname' parameter will be set to groupid
-   of matching address.
+   of matching address and the attributes will be set in variable
+   specified by 'attrs_pvname'. The parameter can be an integer or a
+   variable holding an integer value.
 
    This function can be used from ANY_ROUTE.
 
diff --git a/modules/dispatcher/dispatcher.c b/modules/dispatcher/dispatcher.c
index 4af6757..9cb5ed5 100644
--- a/modules/dispatcher/dispatcher.c
+++ b/modules/dispatcher/dispatcher.c
@@ -183,7 +183,7 @@ static cmd_export_t cmds[]={
 	{"ds_is_from_list",  (cmd_function)w_ds_is_from_list0, 0,
 		0, 0, REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE},
 	{"ds_is_from_list",  (cmd_function)w_ds_is_from_list1, 1,
-		fixup_uint_null, 0, ANY_ROUTE},
+		fixup_igp_null, 0, ANY_ROUTE},
 	{"ds_load_unset",    (cmd_function)w_ds_load_unset,   0,
 		0, 0, ANY_ROUTE},
 	{"ds_load_update",   (cmd_function)w_ds_load_update,  0,
@@ -807,7 +807,13 @@ static int w_ds_is_from_list0(struct sip_msg *msg, char *str1, char *str2)
 
 static int w_ds_is_from_list1(struct sip_msg *msg, char *set, char *str2)
 {
-	return ds_is_from_list(msg, (int)(long)set);
+	int s;
+	if(fixup_get_ivalue(msg, (gparam_p)set, &s)!=0)
+	{
+		LM_ERR("cannot get set id value\n");
+		return -1;
+	}
+	return ds_is_from_list(msg, s);
 }
 
 static int ds_parse_reply_codes() {
diff --git a/modules/dispatcher/doc/dispatcher_admin.xml b/modules/dispatcher/doc/dispatcher_admin.xml
index 7115225..b63a523 100644
--- a/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/modules/dispatcher/doc/dispatcher_admin.xml
@@ -986,7 +986,9 @@ failure_route[tryagain] {
 		Parameter groupid is optional, when it is missing, then the matching
 		will be done against all addresses in all groups. Upon a match, the
 		variable specified by 'setid_pvname' parameter will be set to groupid
-		of matching address.
+		of matching address and the attributes will be set in variable
+		specified by 'attrs_pvname'. The parameter can be an integer or a
+		variable holding an integer value.
  		</para>
 		<para>
 			This function can be used from ANY_ROUTE.




More information about the sr-dev mailing list