浏览代码

dispatcher: allow pv in ds_is_from_list(setid) parameter

Daniel-Constantin Mierla 12 年之前
父节点
当前提交
9a25e71252
共有 3 个文件被更改,包括 14 次插入4 次删除
  1. 3 1
      modules/dispatcher/README
  2. 8 2
      modules/dispatcher/dispatcher.c
  3. 3 1
      modules/dispatcher/doc/dispatcher_admin.xml

+ 3 - 1
modules/dispatcher/README

@@ -829,7 +829,9 @@ failure_route[tryagain] {
    Parameter groupid is optional, when it is missing, then the matching
    Parameter groupid is optional, when it is missing, then the matching
    will be done against all addresses in all groups. Upon a match, the
    will be done against all addresses in all groups. Upon a match, the
    variable specified by 'setid_pvname' parameter will be set to groupid
    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.
    This function can be used from ANY_ROUTE.
 
 

+ 8 - 2
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,
 	{"ds_is_from_list",  (cmd_function)w_ds_is_from_list0, 0,
 		0, 0, REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE},
 		0, 0, REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE},
 	{"ds_is_from_list",  (cmd_function)w_ds_is_from_list1, 1,
 	{"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,
 	{"ds_load_unset",    (cmd_function)w_ds_load_unset,   0,
 		0, 0, ANY_ROUTE},
 		0, 0, ANY_ROUTE},
 	{"ds_load_update",   (cmd_function)w_ds_load_update,  0,
 	{"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)
 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() {
 static int ds_parse_reply_codes() {

+ 3 - 1
modules/dispatcher/doc/dispatcher_admin.xml

@@ -986,7 +986,9 @@ failure_route[tryagain] {
 		Parameter groupid is optional, when it is missing, then the matching
 		Parameter groupid is optional, when it is missing, then the matching
 		will be done against all addresses in all groups. Upon a match, the
 		will be done against all addresses in all groups. Upon a match, the
 		variable specified by 'setid_pvname' parameter will be set to groupid
 		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>
 		<para>
 		<para>
 			This function can be used from ANY_ROUTE.
 			This function can be used from ANY_ROUTE.