Module: kamailio
Branch: master
Commit: e4a408385c6b56c2f623a131d92246484cfb2720
URL:
https://github.com/kamailio/kamailio/commit/e4a408385c6b56c2f623a131d922464…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-10-06T22:35:55+02:00
siputils: use spve fixup instead of pvar
- it includes the later, plus more flexibility to allow static or
dynamic strings
---
Modified: src/modules/siputils/checks.c
Modified: src/modules/siputils/siputils.c
---
Diff:
https://github.com/kamailio/kamailio/commit/e4a408385c6b56c2f623a131d922464…
Patch:
https://github.com/kamailio/kamailio/commit/e4a408385c6b56c2f623a131d922464…
---
diff --git a/src/modules/siputils/checks.c b/src/modules/siputils/checks.c
index b700c620c0..ee60595e3a 100644
--- a/src/modules/siputils/checks.c
+++ b/src/modules/siputils/checks.c
@@ -134,30 +134,17 @@ int w_has_totag(struct sip_msg* _m, char* _foo, char* _bar)
*/
int is_uri(struct sip_msg* _m, char* _sp, char* _s2)
{
- pv_spec_t *sp;
- pv_value_t pv_val;
sip_uri_t turi;
+ str uval;
- sp = (pv_spec_t *)_sp;
-
- if (sp && (pv_get_spec_value(_m, sp, &pv_val) == 0)) {
- if (pv_val.flags & PV_VAL_STR) {
- if (pv_val.rs.len == 0 || pv_val.rs.s == NULL) {
- LM_DBG("missing argument\n");
- return -1;
- }
- if(parse_uri(pv_val.rs.s, pv_val.rs.len, &turi)!=0) {
- return -1;
- }
- return 1;
- } else {
- LM_ERR("pseudo variable value is not string\n");
- return -1;
- }
- } else {
- LM_ERR("failed to get pseudo variable value\n");
+ if(fixup_get_svalue(_m, (gparam_t*)_sp, &uval)!=0) {
+ LM_ERR("cannot get parameter value\n");
return -1;
}
+ if(parse_uri(uval.s, uval.len, &turi)!=0) {
+ return -1;
+ }
+ return 1;
}
/*
diff --git a/src/modules/siputils/siputils.c b/src/modules/siputils/siputils.c
index 50cd7425aa..bfd90d020a 100644
--- a/src/modules/siputils/siputils.c
+++ b/src/modules/siputils/siputils.c
@@ -137,8 +137,8 @@ static cmd_export_t cmds[]={
free_fixup_get_uri_param, REQUEST_ROUTE|LOCAL_ROUTE},
{"tel2sip", (cmd_function)tel2sip, 3, fixup_tel2sip, 0,
REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|ONREPLY_ROUTE},
- {"is_uri", (cmd_function)is_uri, 1, fixup_pvar_null,
- fixup_free_pvar_null, ANY_ROUTE},
+ {"is_uri", (cmd_function)is_uri, 1, fixup_spve_null,
+ fixup_free_spve_null, ANY_ROUTE},
{"is_e164", (cmd_function)is_e164, 1, fixup_pvar_null,
fixup_free_pvar_null, REQUEST_ROUTE|FAILURE_ROUTE|LOCAL_ROUTE},
{"is_uri_user_e164", (cmd_function)w_is_uri_user_e164, 1, fixup_pvar_null,