Module: kamailio
Branch: master
Commit: cced23795582d9f4cc2bae545ea1c24664303036
URL:
https://github.com/kamailio/kamailio/commit/cced23795582d9f4cc2bae545ea1c24…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2019-05-15T11:37:41+02:00
dialplan: don't try to translate on dp_match()
fix #1952
---
Modified: src/modules/dialplan/dialplan.c
Modified: src/modules/dialplan/dp_repl.c
---
Diff:
https://github.com/kamailio/kamailio/commit/cced23795582d9f4cc2bae545ea1c24…
Patch:
https://github.com/kamailio/kamailio/commit/cced23795582d9f4cc2bae545ea1c24…
---
diff --git a/src/modules/dialplan/dialplan.c b/src/modules/dialplan/dialplan.c
index 20b7744e21..7770679a45 100644
--- a/src/modules/dialplan/dialplan.c
+++ b/src/modules/dialplan/dialplan.c
@@ -481,8 +481,9 @@ static int dp_replace_helper(sip_msg_t *msg, int dpid, str *input,
pv_spec_t *pvd)
{
dpl_id_p idp;
- str output = STR_NULL;
+ str tmp = STR_NULL;
str attrs = STR_NULL;
+ str *output = NULL;
str *outattrs = NULL;
if ((idp = select_dpid(dpid)) ==0) {
@@ -491,16 +492,19 @@ static int dp_replace_helper(sip_msg_t *msg, int dpid, str *input,
}
outattrs = (!attr_pvar)?NULL:&attrs;
- if (dp_translate_helper(msg, input, &output, idp, outattrs)!=0) {
+ output = (!pvd)?NULL:&tmp;
+ if (dp_translate_helper(msg, input, output, idp, outattrs)!=0) {
LM_DBG("could not translate %.*s "
"with dpid %i\n", input->len, input->s, idp->dp_id);
return -1;
}
- LM_DBG("input %.*s with dpid %i => output %.*s\n",
- input->len, input->s, idp->dp_id, output.len, output.s);
+ if (output) {
+ LM_DBG("input %.*s with dpid %i => output %.*s\n",
+ input->len, input->s, idp->dp_id, output->len, output->s);
+ }
/* set the output */
- if (dp_update(msg, pvd, &output, outattrs) !=0){
+ if (dp_update(msg, pvd, output, outattrs) !=0){
LM_ERR("cannot set the output\n");
return -1;
}
diff --git a/src/modules/dialplan/dp_repl.c b/src/modules/dialplan/dp_repl.c
index 06534a9dab..05949c8289 100644
--- a/src/modules/dialplan/dp_repl.c
+++ b/src/modules/dialplan/dp_repl.c
@@ -699,6 +699,9 @@ int dp_translate_helper(sip_msg_t *msg, str *input, str *output,
dpl_id_p idp,
attrs->len, attrs->s);
}
}
+ if(!output) {
+ return 0;
+ }
if(rulep->tflags&DP_TFLAGS_PV_SUBST) {
re_list = dpl_dynamic_pcre_list(msg, &rulep->subst_exp);
if(re_list==NULL) {