Description

dialplan dp_match() fails with a substitution error when subst_exp doesn't match the string. I was expecting to only match the rule to get the attrs no matter what is defined in subst_exp/repl_exp

Troubleshooting

Reproduction

=> select * from dialplan where id = 24;
─[ RECORD 1 ]──────────────────────────────────────
id        │ 24
dpid      │ 101000
pr        │ 1
match_op  │ 1
match_exp │ ^00([1-9][0-35-9]|[1-35-9][0-9])[0-9]+$
match_len │ 0
subst_exp │ ^([1-9][0-9]{8})$
repl_exp  │ +34\1
attrs     │ cli=+34654205682;action=0
route[SET_DST] {
    if($var(dpid_team)==0){
        xdbg("SET_DST no $$var(dpid_team) - ci='$ci'");
        return;
    }
    xinfo("SET_DST trying to get dialplan from dpid:$var(dpid_team) - ci'$ci'");
    if(dp_translate("$(var(dpid_team){s.int})", "$rU/$var(dst)")){
        if($rU != $var(dst)){
            xinfo("SET_DST  change from $$rU:'$rU' to '$var(dst)' - ci='$ci'");
            $rU = $var(dst);
        }
    } else {
        xinfo("SET_DST  no valid subst_exp for '$rU' trying to match - ci='$ci'");
        dp_match("$(var(dpid_team){s.int})", "$rU");
    }
    if($var(dp_attrs)!=0) {
        xdbg("SET_DST $$var(dp_attrs):$var(dp_attrs) "
            "action:$(var(dp_attrs){param.value,action}) - ci='$ci'");
        $var(action) = $(var(dp_attrs){param.value,action});
        if($var(action)=='1'){
            xalert("Dialing rule group for '$rU' set to 'deny' - ci='$ci'");
            route(ERROR_DEST_DENY);
        }
    }
    return;
}
INFO: <script>: SET_DST trying to get dialplan from dpid:101000 - ci'57f955434e6ca1e57727367e4abcff1f@PBX-2797.xpbx.foehn.co.uk'
ERROR: dialplan [dp_repl.c:439]: rule_translate(): the string 0034654205681 matched the match_exp ^00([1-9][0-35-9]|[1-35-9][0-9])[0-9]+$ but not the subst_exp ^([1-9][0-9]{8})$!
ERROR: dialplan [dp_repl.c:727]: dp_translate_helper(): could not build the output
INFO: <script>: SET_DST  no valid subst_exp for '0034654205681' trying to match - ci='57f955434e6ca1e57727367e4abcff1f@PBX-2797.xpbx.foehn.co.uk'
ERROR: dialplan [dp_repl.c:439]: rule_translate(): the string 0034654205681 matched the match_exp ^00([1-9][0-35-9]|[1-35-9][0-9])[0-9]+$ but not the subst_exp ^([1-9][0-9]{8})$!
ERROR: dialplan [dp_repl.c:727]: dp_translate_helper(): could not build the output

Additional Information

version: kamailio 5.2.2 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown 
compiled with gcc 4.8.4


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.