Module: kamailio
Branch: 5.1
Commit: 5268c0b6b1ece7f6dffb0f77c15a86b379d309f1
URL:
https://github.com/kamailio/kamailio/commit/5268c0b6b1ece7f6dffb0f77c15a86b…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2019-05-15T11:39:13+02:00
dialplan: don't try to translate on dp_match()
fix #1952
(cherry picked from commit cced23795582d9f4cc2bae545ea1c24664303036)
---
Modified: src/modules/dialplan/dialplan.c
Modified: src/modules/dialplan/dp_repl.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5268c0b6b1ece7f6dffb0f77c15a86b…
Patch:
https://github.com/kamailio/kamailio/commit/5268c0b6b1ece7f6dffb0f77c15a86b…
---
diff --git a/src/modules/dialplan/dialplan.c b/src/modules/dialplan/dialplan.c
index 61aeae47f1..96bb183bd3 100644
--- a/src/modules/dialplan/dialplan.c
+++ b/src/modules/dialplan/dialplan.c
@@ -478,8 +478,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) {
@@ -488,16 +489,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 06762ce6d2..093e48fd37 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->match_exp);
if(re_list==NULL) {