Skip to content

Wrong rule selected in dialplan translation when both string and regexp rules are matched #696

@paolodepa

Description

@paolodepa

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 (>) than the regexp rule; the regexp rule is selected otherwise.
I would have expected the opposite behaviour.

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.
In detail, I suppose that replacing this code snippet into the function "translate" (dp_repl.c):

    /* 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) {
                    rulep = rrulep;

with:

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

would make the job.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions