[sr-dev] git:master:ee1ea030: dialplan: fixed error log in rule_translate

Daniel-Constantin Mierla miconda at gmail.com
Fri Mar 29 10:18:43 CET 2019


Module: kamailio
Branch: master
Commit: ee1ea030d90818f5547c4970f0785b33889d8b75
URL: https://github.com/kamailio/kamailio/commit/ee1ea030d90818f5547c4970f0785b33889d8b75

Author: Marco Capetta <mcapetta at sipwise.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-03-29T10:11:06+01:00

dialplan: fixed error log in rule_translate

- Print an error line only if the string fails a match with
all the subst_exp avp values.

---

Modified: src/modules/dialplan/dp_repl.c

---

Diff:  https://github.com/kamailio/kamailio/commit/ee1ea030d90818f5547c4970f0785b33889d8b75.diff
Patch: https://github.com/kamailio/kamailio/commit/ee1ea030d90818f5547c4970f0785b33889d8b75.patch

---

diff --git a/src/modules/dialplan/dp_repl.c b/src/modules/dialplan/dp_repl.c
index 2cd568ca5f..06534a9dab 100644
--- a/src/modules/dialplan/dp_repl.c
+++ b/src/modules/dialplan/dp_repl.c
@@ -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,
@@ -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){




More information about the sr-dev mailing list