Module: kamailio
Branch: master
Commit: 431e982157f687789c65e7cb74e3f68939a05730
URL:
https://github.com/kamailio/kamailio/commit/431e982157f687789c65e7cb74e3f68…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-03-28T08:26:02+02:00
phonenum: set the order of params for phonenum_match_cn()
---
Modified: src/modules/phonenum/phonenum_mod.c
Modified: src/modules/phonenum/phonenum_pv.c
Modified: src/modules/phonenum/phonenum_pv.h
---
Diff:
https://github.com/kamailio/kamailio/commit/431e982157f687789c65e7cb74e3f68…
Patch:
https://github.com/kamailio/kamailio/commit/431e982157f687789c65e7cb74e3f68…
---
diff --git a/src/modules/phonenum/phonenum_mod.c b/src/modules/phonenum/phonenum_mod.c
index 5c6c6c8294..5d74c5eec2 100644
--- a/src/modules/phonenum/phonenum_mod.c
+++ b/src/modules/phonenum/phonenum_mod.c
@@ -109,7 +109,7 @@ static int phonenum_match(sip_msg_t *msg, str *tomatch, str *pvclass)
{
phonenum_pv_reset(pvclass);
- return phonenum_update_pv(tomatch, pvclass, NULL);
+ return phonenum_update_pv(tomatch, NULL, pvclass);
}
static int w_phonenum_match(sip_msg_t *msg, char *target, char *pvname)
@@ -134,15 +134,15 @@ static int w_phonenum_match(sip_msg_t *msg, char *target, char
*pvname)
return phonenum_match(msg, &tomatch, &pvclass);
}
-static int phonenum_match_cn(sip_msg_t *msg, str *tomatch, str *pvclass, str *cc)
+static int phonenum_match_cn(sip_msg_t *msg, str *tomatch, str *cnc, str *pvclass)
{
phonenum_pv_reset(pvclass);
- return phonenum_update_pv(tomatch, pvclass, cc);
+ return phonenum_update_pv(tomatch, cnc, pvclass);
}
-static int w_phonenum_match_cn(sip_msg_t *msg, char *target, char *pvname,
- char *cncstr)
+static int w_phonenum_match_cn(sip_msg_t *msg, char *target, char *cncstr,
+ char *pvname)
{
str tomatch = STR_NULL;
str pvclass = STR_NULL;
@@ -157,16 +157,16 @@ static int w_phonenum_match_cn(sip_msg_t *msg, char *target, char
*pvname,
LM_ERR("cannot get the address\n");
return -1;
}
- if(fixup_get_svalue(msg, (gparam_t *)pvname, &pvclass) < 0) {
- LM_ERR("cannot get the pv class\n");
- return -1;
- }
if(fixup_get_svalue(msg, (gparam_t *)cncstr, &cncval) < 0) {
LM_ERR("cannot get the country code\n");
return -1;
}
+ if(fixup_get_svalue(msg, (gparam_t *)pvname, &pvclass) < 0) {
+ LM_ERR("cannot get the pv class\n");
+ return -1;
+ }
- return phonenum_match_cn(msg, &tomatch, &pvclass, &cncval);
+ return phonenum_match_cn(msg, &tomatch, &cncval, &pvclass);
}
/**
diff --git a/src/modules/phonenum/phonenum_pv.c b/src/modules/phonenum/phonenum_pv.c
index 0de7b5250d..31f60a6428 100644
--- a/src/modules/phonenum/phonenum_pv.c
+++ b/src/modules/phonenum/phonenum_pv.c
@@ -289,7 +289,7 @@ void phonenum_pv_reset(str *name)
memset(gr, 0, sizeof(sr_phonenum_record_t));
}
-int phonenum_update_pv(str *tomatch, str *name, str *cncode)
+int phonenum_update_pv(str *tomatch, str *cncode, str *name)
{
sr_phonenum_record_t *gr = NULL;
diff --git a/src/modules/phonenum/phonenum_pv.h b/src/modules/phonenum/phonenum_pv.h
index 2156c33be6..b56d6f47dd 100644
--- a/src/modules/phonenum/phonenum_pv.h
+++ b/src/modules/phonenum/phonenum_pv.h
@@ -33,7 +33,7 @@ int pv_get_phonenum(struct sip_msg *msg, pv_param_t *param,
int phonenum_init_pv(int smode);
void phonenum_destroy_pv(void);
void phonenum_pv_reset(str *pvclass);
-int phonenum_update_pv(str *tomatch, str *pvclass, str *cncode);
+int phonenum_update_pv(str *tomatch, str *cncode, str *pvclass);
#endif