From: Mark Spencer Date: Tue, 14 Sep 2004 22:35:53 +0000 (+0000) Subject: Make sure patterns are always last (bug #2435) X-Git-Tag: 1.0.0~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=238b9d24c608c5e195652beacc0146448a56bdce;p=thirdparty%2Fasterisk.git Make sure patterns are always last (bug #2435) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3777 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/pbx.c b/pbx.c index dd8abbd4aa..2bc05ff5d9 100755 --- a/pbx.c +++ b/pbx.c @@ -3830,7 +3830,13 @@ int ast_add_extension2(struct ast_context *con, } e = con->root; while(e) { - res= strcmp(e->exten, extension); + /* Make sure patterns are always last! */ + if ((e->exten[0] != '_') && (extension[0] == '_')) + res = -1; + else if ((e->exten[0] == '_') && (extension[0] != '_')) + res = 1; + else + res= strcmp(e->exten, extension); if (!res) { if (!e->matchcid && !tmp->matchcid) res = 0;