Skip to content

Commit

Permalink
Merge pull request #1914 from marcocapetta/master
Browse files Browse the repository at this point in the history
Small fixes to dialplan module when an avp is used as subst_exp
  • Loading branch information
miconda committed Mar 28, 2019
2 parents 4489b19 + de529a6 commit 4e91dc3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/modules/dialplan/dp_repl.c
Expand Up @@ -432,7 +432,7 @@ int rule_translate(sip_msg_t *msg, str *instr, dpl_node_t *rule,
/*search for the pattern from the compiled subst_exp*/
if (pcre_exec(subst_comp, NULL, instr->s, instr->len,
0, 0, ovector, 3 * (MAX_REPLACE_WITH + 1)) <= 0) {
LM_ERR("the string %.*s matched "
LM_DBG("the string %.*s matched "
"the match_exp %.*s but not the subst_exp %.*s!\n",
instr->len, instr->s,
rule->match_exp.len, rule->match_exp.s,
Expand Down Expand Up @@ -700,7 +700,7 @@ int dp_translate_helper(sip_msg_t *msg, str *input, str *output, dpl_id_p idp,
}
}
if(rulep->tflags&DP_TFLAGS_PV_SUBST) {
re_list = dpl_dynamic_pcre_list(msg, &rulep->match_exp);
re_list = dpl_dynamic_pcre_list(msg, &rulep->subst_exp);
if(re_list==NULL) {
/* failed to compile dynamic pcre -- ignore */
LM_DBG("failed to compile dynamic pcre[%.*s]\n",
Expand All @@ -721,6 +721,13 @@ int dp_translate_helper(sip_msg_t *msg, str *input, str *output, dpl_id_p idp,
pkg_free(re_list);
re_list = rt;
} while(re_list);
if(rez<0) {
LM_ERR("the string %.*s matched "
"the match_exp %.*s but not the subst_exp %.*s!\n",
input->len, input->s,
rulep->match_exp.len, rulep->match_exp.s,
rulep->subst_exp.len, rulep->subst_exp.s);
}
}
else {
if(rule_translate(msg, input, rulep, rulep->subst_comp, output)!=0){
Expand Down

0 comments on commit 4e91dc3

Please sign in to comment.