Skip to content

Commit

Permalink
dialplan: Fix a rule tie-breaking bug
Browse files Browse the repository at this point in the history
When an input string would match both a "string" rule and a "regex"
rule, the priority based tie-breaking was incorrect (now favouring
the bigger priority instead - opposite to default module behavior).

Thanks to @paolodepa for suggesting this fix
Fixes issue #696

(cherry picked from commit cbdd79a)
  • Loading branch information
liviuchircu committed May 26, 2016
1 parent a645657 commit 9c66491
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/dialplan/dp_repl.c
Expand Up @@ -436,8 +436,8 @@ int translate(struct sip_msg *msg, str input, str * output, dpl_id_p idp, str *
}

/* pick the rule with lowest table index if both match and prio are equal */
if ((string_res | regexp_res) == 0) {
if (rulep->pr < rrulep->pr) {
if (string_res == 0 && regexp_res == 0) {
if (rrulep->pr < rulep->pr) {
rulep = rrulep;
} else if (rrulep->pr == rulep->pr &&
rrulep->table_id < rulep->table_id) {
Expand Down

0 comments on commit 9c66491

Please sign in to comment.