Module: sip-router
Branch: master
Commit: 196c65fdc5d2526d3c777b22ec37eef200cd08ae
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=196c65f…
Author: Ovidiu Sas <osas(a)voipembedded.com>
Committer: Ovidiu Sas <osas(a)voipembedded.com>
Date: Tue May 20 13:47:44 2014 -0400
dispatcher: ds_select_dst/domain can take args as string (not only int)
- internal converion of string->int (if possible)
---
modules/dispatcher/dispatcher.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/modules/dispatcher/dispatcher.c b/modules/dispatcher/dispatcher.c
index b07cc24..b7a5236 100644
--- a/modules/dispatcher/dispatcher.c
+++ b/modules/dispatcher/dispatcher.c
@@ -545,23 +545,39 @@ static void destroy(void)
}
+#define GET_VALUE(param_name,param,i_value,s_value,value_flags) do{ \
+ if(get_is_fparam(&(i_value), &(s_value), msg, (fparam_t*)(param),
&(value_flags))!=0) { \
+ LM_ERR("no %s value\n", (param_name)); \
+ return -1; \
+ } \
+}while(0)
+
/**
*
*/
static int w_ds_select(struct sip_msg* msg, char* set, char* alg, int mode)
{
+ unsigned int algo_flags, set_flags;
+ str s_algo = {NULL, 0};
+ str s_set = {NULL, 0};
int a, s;
if(msg==NULL)
return -1;
- if(fixup_get_ivalue(msg, (gparam_p)set, &s)!=0)
- {
- LM_ERR("no dst set value\n");
+ GET_VALUE("destination set", set, s, s_set, set_flags);
+ if (!(set_flags&PARAM_INT)) {
+ if (set_flags&PARAM_STR)
+ LM_ERR("unable to get destination set from [%.*s]\n", s_set.len, s_set.s);
+ else
+ LM_ERR("unable to get destination set\n");
return -1;
}
- if(fixup_get_ivalue(msg, (gparam_p)alg, &a)!=0)
- {
- LM_ERR("no alg value\n");
+ GET_VALUE("algorithm", alg, a, s_algo, algo_flags);
+ if (!(algo_flags&PARAM_INT)) {
+ if (algo_flags&PARAM_STR)
+ LM_ERR("unable to get algorithm from [%.*s]\n", s_algo.len, s_algo.s);
+ else
+ LM_ERR("unable to get algorithm\n");
return -1;
}