further thought says '!' is a better early-match wildcard (bug #3889, take 2)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5372 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-04-03 22:24:17 +00:00
parent be563d29a0
commit 7e3e619497
2 changed files with 5 additions and 5 deletions

View File

@@ -69,7 +69,7 @@ TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9) ; [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
; . - wildcard, matches anything remaining (e.g. _9011. matches ; . - wildcard, matches anything remaining (e.g. _9011. matches
; anything starting with 9011 excluding 9011 itself) ; anything starting with 9011 excluding 9011 itself)
; + - wildcard, causes the matching process to complete as soon as ; ! - wildcard, causes the matching process to complete as soon as
; it can unambiguously determine that no other matches are possible ; it can unambiguously determine that no other matches are possible
; ;
; For example the extension _NXXXXXX would match normal 7 digit dialings, ; For example the extension _NXXXXXX would match normal 7 digit dialings,

8
pbx.c
View File

@@ -633,7 +633,7 @@ static void pbx_destroy(struct ast_pbx *p)
case '.':\ case '.':\
/* Must match */\ /* Must match */\
return 1;\ return 1;\
case '+':\ case '!':\
/* Early match */\ /* Early match */\
return 2;\ return 2;\
case ' ':\ case ' ':\
@@ -648,8 +648,8 @@ static void pbx_destroy(struct ast_pbx *p)
data++;\ data++;\
pattern++;\ pattern++;\
}\ }\
/* If we ran off the end of the data and the pattern ends in '+', match */\ /* If we ran off the end of the data and the pattern ends in '!', match */\
if (match && !*data && (*pattern == '+'))\ if (match && !*data && (*pattern == '!'))\
return 2;\ return 2;\
} }
@@ -774,7 +774,7 @@ static struct ast_exten *pbx_find_extension(struct ast_channel *chan, struct ast
(!eroot->matchcid || matchcid(eroot->cidmatch, callerid))) { (!eroot->matchcid || matchcid(eroot->cidmatch, callerid))) {
if (action == HELPER_MATCHMORE && match == 2 && !earlymatch) { if (action == HELPER_MATCHMORE && match == 2 && !earlymatch) {
/* It matched an extension ending in a '+' wildcard /* It matched an extension ending in a '!' wildcard
So ignore it for now, unless there's a better match */ So ignore it for now, unless there's a better match */
earlymatch = eroot; earlymatch = eroot;
} else { } else {