aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-24 21:00:26 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-24 21:00:26 +0000
commit2a36d53ce3bceb7f31ccfe840d3efa6ad1977c5c (patch)
tree15cf03868acd5ee0433da42a45f4399c9f9cb621 /pbx
parent2794d1de7a94f7716bcb98058a505b17a15cb100 (diff)
closes issue #11363; where the pattern _20x. buried in an included context, didn't match 2012; There were a small set of problems to fix: 1. I needed NOT to score patterns unless you are at the end of the data string. 2. Capital N,X,Z and small n,x,z are OK in patterns. I canonicalize the patterns in the trie to caps. 3. When a pattern ends with dot or exclamation, CANMATCH/MATCHMORE should always report this pattern, no matter the length. With this commit, I also supplied the wish of Luigi, where the user can select which pattern matching algorithm to use, the old (legacy) pattern matcher, or the new, trie based matcher. The OLD matcher is the default. A new [general] section variable, extenpatternmatchnew, is added to the extensions.conf, and the example config has it set to false. If true, the new matcher is used. In all other respects, the context/exten structs are the same; the tries and hashtabs are formed, but in the new mode the tries are not used. A new CLI command 'dialplan set extenpatternmatch true/false' is provided to allow switching at run time. I beg users that are forced to return to the old matcher to please report the reason in the bug tracker. Measured the speed benefit of the new matcher against an impossibly large context with 10,000 extensions: the new matcher is 374 times faster.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89547 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_config.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 0782e7a7b..a200dc663 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -46,6 +46,7 @@ static int static_config = 0;
static int write_protect_config = 1;
static int autofallthrough_config = 1;
static int clearglobalvars_config = 0;
+static int extenpatternmatchnew_config = 0;
AST_MUTEX_DEFINE_STATIC(save_dialplan_lock);
@@ -780,11 +781,12 @@ static char *handle_cli_dialplan_save(struct ast_cli_entry *e, int cmd, struct a
}
/* fireout general info */
- fprintf(output, "[general]\nstatic=%s\nwriteprotect=%s\nautofallthrough=%s\nclearglobalvars=%s\n\n",
+ fprintf(output, "[general]\nstatic=%s\nwriteprotect=%s\nautofallthrough=%s\nclearglobalvars=%s\nextenpatternmatchnew=%s\n\n",
static_config ? "yes" : "no",
write_protect_config ? "yes" : "no",
autofallthrough_config ? "yes" : "no",
- clearglobalvars_config ? "yes" : "no");
+ clearglobalvars_config ? "yes" : "no",
+ extenpatternmatchnew_config ? "yes" : "no");
if ((v = ast_variable_browse(cfg, "globals"))) {
fprintf(output, "[globals]\n");
@@ -1367,6 +1369,7 @@ static int pbx_load_config(const char *config_file)
struct ast_variable *v;
const char *cxt;
const char *aft;
+ const char *newpm;
struct ast_flags config_flags = { 0 };
cfg = ast_config_load(config_file, config_flags);
@@ -1378,7 +1381,10 @@ static int pbx_load_config(const char *config_file)
write_protect_config = ast_true(ast_variable_retrieve(cfg, "general", "writeprotect"));
if ((aft = ast_variable_retrieve(cfg, "general", "autofallthrough")))
autofallthrough_config = ast_true(aft);
+ if ((newpm = ast_variable_retrieve(cfg, "general", "extenpatternmatchnew")))
+ extenpatternmatchnew_config = ast_true(newpm);
clearglobalvars_config = ast_true(ast_variable_retrieve(cfg, "general", "clearglobalvars"));
+
if ((cxt = ast_variable_retrieve(cfg, "general", "userscontext")))
ast_copy_string(userscontext, cxt, sizeof(userscontext));
@@ -1631,6 +1637,7 @@ static int pbx_load_module(void)
ast_context_verify_includes(con);
pbx_set_autofallthrough(autofallthrough_config);
+ pbx_set_extenpatternmatchnew(extenpatternmatchnew_config);
return 0;
}