fix logic in dmachine parser for overlap bindings so they work regardless of the order they are bound
This commit is contained in:
parent
2051237c74
commit
cbefc9dae1
|
@ -309,10 +309,19 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin
|
||||||
|
|
||||||
if (!dmachine->cur_digit_len || !dmachine->realm) goto end;
|
if (!dmachine->cur_digit_len || !dmachine->realm) goto end;
|
||||||
|
|
||||||
|
for(bp = dmachine->realm->binding_list; bp; bp = bp->next) {
|
||||||
|
if (bp->is_regex) {
|
||||||
|
pmatches++;
|
||||||
|
} else {
|
||||||
|
if (!strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits))) {
|
||||||
|
pmatches++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(bp = dmachine->realm->binding_list; bp; bp = bp->next) {
|
for(bp = dmachine->realm->binding_list; bp; bp = bp->next) {
|
||||||
if (bp->is_regex) {
|
if (bp->is_regex) {
|
||||||
switch_status_t r_status = switch_regex_match(dmachine->digits, bp->digits);
|
switch_status_t r_status = switch_regex_match(dmachine->digits, bp->digits);
|
||||||
pmatches = 1;
|
|
||||||
|
|
||||||
if (r_status == SWITCH_STATUS_SUCCESS) {
|
if (r_status == SWITCH_STATUS_SUCCESS) {
|
||||||
if (is_timeout || (bp == dmachine->realm->binding_list && !bp->next)) {
|
if (is_timeout || (bp == dmachine->realm->binding_list && !bp->next)) {
|
||||||
|
@ -325,11 +334,7 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin
|
||||||
} else {
|
} else {
|
||||||
int pmatch = !strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits));
|
int pmatch = !strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits));
|
||||||
|
|
||||||
if (pmatch) {
|
if (!exact_bp && pmatch && (pmatches == 1 || is_timeout) && !strcmp(bp->digits, dmachine->digits)) {
|
||||||
pmatches++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!exact_bp && pmatch && !strcmp(bp->digits, dmachine->digits)) {
|
|
||||||
best = DM_MATCH_EXACT;
|
best = DM_MATCH_EXACT;
|
||||||
exact_bp = bp;
|
exact_bp = bp;
|
||||||
if (dmachine->cur_digit_len == dmachine->max_digit_len) break;
|
if (dmachine->cur_digit_len == dmachine->max_digit_len) break;
|
||||||
|
|
Loading…
Reference in New Issue