<p>Let's say we are translating a destination matching two dialplan rules, the first working on exact string match and the second working on regexp match: I'm getting selected the exact match rule ONLY IF its priority is bigger (&gt;) than the regexp rule; the regexp rule is selected otherwise.<br>
I would have expected the opposite behaviour.</p>

<p>I'm facing this issue on 1.11.5 version but, looking at  the source code, the problem should be present also in 2.1.X.<br>
In detail, I suppose that replacing this code snippet into the function "translate" (dp_repl.c):</p>

<pre><code>    /* pick the rule with lowest table index if both match and prio are equal */
    if ((string_res | regexp_res) == 0) {
            if (rulep-&gt;pr &lt; rrulep-&gt;pr) {
                    rulep = rrulep;
</code></pre>

<p>with:</p>

<pre><code>    /* pick the rule with lowest table index if both match and prio are equal */
    if ((string_res | regexp_res) == 0) {
            if (rrulep-&gt;pr &lt; rulep-&gt;pr) {
                    rulep = rrulep;
</code></pre>

<p>would make the job.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/696">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOcibk5_uzi9Sfz6V-M8OgRk8MlEWGYks5pFGA4gaJpZM4Gg6iX.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/OpenSIPS/opensips/issues/696"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>