diff options
author | Sean Bright <sean.bright@gmail.com> | 2017-02-21 11:47:28 -0500 |
---|---|---|
committer | Sean Bright <sean.bright@gmail.com> | 2017-02-21 13:45:03 -0500 |
commit | d5522de597cc6fbbc9747fa6798144cd5d00cdb1 (patch) | |
tree | e846cdeb4630b435f96f4ab71b0643e8fbb1f31c /pbx | |
parent | f29ea24d9f1d5771f7a5fe2f0bae51c4bf9a657a (diff) |
realtime: Fix ast_load_realtime_multientry handling
ast_load_realtime_multientry() returns an ast_config structure whose
ast_categorys are keyed with the empty strings. Several modules were
giving semantic meaning to the category names causing problems at
runtime.
* app_directory: Treated the category name as the mailbox name, and
would fail to direct calls to the appropriate extension after an
entry was chosen.
* app_queue: Queues, queue members, and queue rules were all affected
and needed to be updated.
* pbx_realtime: Pattern matching would never succeed because the
extension entered by the user was always compared to the empty
string.
Change-Id: Ie7e44986344b0b76ea8f6ddb5879f5040c6ca8a7
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/pbx_realtime.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pbx/pbx_realtime.c b/pbx/pbx_realtime.c index 6c8e671ed..1d5800716 100644 --- a/pbx/pbx_realtime.c +++ b/pbx/pbx_realtime.c @@ -191,25 +191,26 @@ static struct ast_variable *realtime_switch_common(const char *table, const char if (!var && !ast_test_flag(&flags, OPTION_PATTERNS_DISABLED)) { cfg = ast_load_realtime_multientry(table, "exten LIKE", "\\_%", "context", context, "priority", pri, SENTINEL); if (cfg) { - char *cat = ast_category_browse(cfg, NULL); + char *cat = NULL; + + while ((cat = ast_category_browse(cfg, cat))) { + const char *realtime_exten = ast_variable_retrieve(cfg, cat, "exten"); - while(cat) { switch(mode) { case MODE_MATCHMORE: - match = ast_extension_close(cat, exten, 1); + match = ast_extension_close(realtime_exten, exten, 1); break; case MODE_CANMATCH: - match = ast_extension_close(cat, exten, 0); + match = ast_extension_close(realtime_exten, exten, 0); break; case MODE_MATCH: default: - match = ast_extension_match(cat, exten); + match = ast_extension_match(realtime_exten, exten); } if (match) { var = ast_category_detach_variables(ast_category_get(cfg, cat, NULL)); break; } - cat = ast_category_browse(cfg, cat); } ast_config_destroy(cfg); } |