Module: kamailio Branch: 5.2 Commit: b536723c66441203c2eaaa1ed1a68c981a0254be URL: https://github.com/kamailio/kamailio/commit/b536723c66441203c2eaaa1ed1a68c981a0254be
Author: Victor Seva <linuxman...@torreviejawireless.org> Committer: Victor Seva <linuxman...@torreviejawireless.org> Date: 2019-05-15T11:38:24+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/b536723c66441203c2eaaa1ed1a68c981a0254be.diff Patch: https://github.com/kamailio/kamailio/commit/b536723c66441203c2eaaa1ed1a68c981a0254be.patch --- diff --git a/src/modules/dialplan/dialplan.c b/src/modules/dialplan/dialplan.c index d8685d52f2..9d68d5d64b 100644 --- a/src/modules/dialplan/dialplan.c +++ b/src/modules/dialplan/dialplan.c @@ -476,8 +476,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) { @@ -486,16 +487,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) { _______________________________________________ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev