subexpressions should not be checked when the expression has private variables
output of the error ``` 0(10175) DEBUG: dialplan [dp_db.c:496]: build_rule(): building rule for [2:^(00|+)([1-9][0-9]+)$/^(00|+)([1-9][0-9]+)$/\2] 0(10175) DEBUG: dialplan [dp_db.c:533]: build_rule(): attrs are: '' 0(10175) DEBUG: dialplan [dp_db.c:580]: add_rule2hash(): new dpl_id 1 0(10175) DEBUG: dialplan [dp_db.c:593]: add_rule2hash(): new index , len 0 0(10175) DEBUG: dialplan [dp_db.c:629]: add_rule2hash(): added the rule id 1 index 0 pr 1 next (nil) to the index with 0 len 0(10175) DEBUG: dialplan [dp_repl.c:146]: repl_exp_parse(): replacement expression is [\1] 0(10175) DEBUG: dialplan [dp_db.c:102]: dpl_check_pv(): parsing [^$avp(s:caller_cc)$avp(s:caller_ac)([1-9][0-9]+)$] 0(10175) DEBUG: <core> [pvapi.c:419]: pv_spec_lookup(): PV <$avp(s:caller_cc)> is not in cache 0(10175) DEBUG: <core> [usr_avp.c:882]: parse_avp_ident(): Parsing 's:caller_cc' 0(10175) DEBUG: <core> [pvapi.c:293]: pv_cache_add(): pvar [$avp(s:caller_cc)] added in cache 0(10175) DEBUG: dialplan [dp_db.c:124]: dpl_check_pv(): string [^$avp(s:caller_cc)$avp(s:caller_ac)([1-9][0-9]+)$] has variables 0(10175) DEBUG: dialplan [dp_db.c:496]: build_rule(): building rule for [2:^$avp(s:caller_cc)$avp(s:caller_ac)([1-9][0-9]+)$/^$avp(s:caller_cc)$avp(s:caller_ac)([1-9][0-9]+)$/\1] 0(10175) ERROR: dialplan [dp_db.c:502]: build_rule(): repl_exp \1 refers to 1 sub-expressions, but subst_exp ^$avp(s:caller_cc)$avp(s:caller_ac)([1-9][0-9]+)$ has only 0 0(10175) DEBUG: dialplan [dp_db.c:685]: destroy_rule(): destroying rule with priority 1 ``` You can merge this Pull Request by running:
git pull https://github.com/linuxmaniac/kamailio vseva/dialplan_fix
Or you can view, comment on it, or merge it online at:
https://github.com/kamailio/kamailio/pull/17
-- Commit Summary --
* dialplan: don't check subexpressions on expressions with pvs
-- File Changes --
M modules/dialplan/dp_db.c (6)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/17.patch https://github.com/kamailio/kamailio/pull/17.diff
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/17
@@ -188,7 +188,13 @@ int rule_translate(sip_msg_t *msg, str string, dpl_node_t * rule, }
if(rule->tflags&DP_TFLAGS_PV_SUBST) {
subst_comp = dpl_dynamic_pcre(msg, &rule->subst_exp, NULL);
subst_comp = dpl_dynamic_pcre(msg, &rule->subst_exp, &cap_cnt);
if (cap_cnt > MAX_REPLACE_WITH) {
The other check is done a few lines later ``` if(repl_comp->max_pmatch > cap_cnt){ ```
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/17/files#r22765911
It can be merged.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/17#issuecomment-69892706
Closed #17.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/17#event-218660218
merged
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/17#issuecomment-69897271