<h3>Description</h3>
<p>dialplan <code>dp_match()</code> 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 <code>subst_exp/repl_exp</code></p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<pre><code>=> 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
</code></pre>
<pre><code>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;
}
</code></pre>
<pre><code>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
</code></pre>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>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
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1952?email_source=notifications&email_token=ABO7UZKV2WPCRJ6WU34HNWDPVO6FRA5CNFSM4HNAS5K2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GT3JPFA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZNZ2E6ZNU2RGARXQA3PVO6FRANCNFSM4HNAS5KQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZOZUVUZHKURTNNDWU3PVO6FRA5CNFSM4HNAS5K2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GT3JPFA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1952?email_source=notifications\u0026email_token=ABO7UZKV2WPCRJ6WU34HNWDPVO6FRA5CNFSM4HNAS5K2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GT3JPFA",
"url": "https://github.com/kamailio/kamailio/issues/1952?email_source=notifications\u0026email_token=ABO7UZKV2WPCRJ6WU34HNWDPVO6FRA5CNFSM4HNAS5K2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GT3JPFA",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>