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:06:29 -0600 |
commit | ab04a018e45d81c28e834cc6036f891dce7921e3 (patch) | |
tree | 306a66c237ea53c3375d9054d811ed996d6962c8 /pbx | |
parent | 144b09ab41274498637a6cd8601f653658ecca8b (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 08c90aa62..6f5d13738 100644 --- a/pbx/pbx_realtime.c +++ b/pbx/pbx_realtime.c @@ -189,25 +189,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); } |