summaryrefslogtreecommitdiff
path: root/apps/app_directory.c
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-02-21 11:47:28 -0500
committerSean Bright <sean.bright@gmail.com>2017-02-21 13:45:03 -0500
commitd5522de597cc6fbbc9747fa6798144cd5d00cdb1 (patch)
treee846cdeb4630b435f96f4ab71b0643e8fbb1f31c /apps/app_directory.c
parentf29ea24d9f1d5771f7a5fe2f0bae51c4bf9a657a (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 'apps/app_directory.c')
-rw-r--r--apps/app_directory.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c
index ef3c363f9..b75e85763 100644
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -466,7 +466,7 @@ static struct ast_config *realtime_directory(char *context)
struct ast_config *rtdata = NULL;
struct ast_category *cat;
struct ast_variable *var;
- char *mailbox;
+ char *category = NULL;
const char *fullname;
const char *hidefromdir, *searchcontexts = NULL;
struct ast_flags config_flags = { 0 };
@@ -507,13 +507,12 @@ static struct ast_config *realtime_directory(char *context)
return cfg;
}
- mailbox = NULL;
- while ( (mailbox = ast_category_browse(rtdata, mailbox)) ) {
- struct ast_variable *alias;
- const char *ctx = ast_variable_retrieve(rtdata, mailbox, "context");
+ while ((category = ast_category_browse(rtdata, category))) {
+ const char *mailbox = ast_variable_retrieve(rtdata, category, "mailbox");
+ const char *ctx = ast_variable_retrieve(rtdata, category, "context");
- fullname = ast_variable_retrieve(rtdata, mailbox, "fullname");
- hidefromdir = ast_variable_retrieve(rtdata, mailbox, "hidefromdir");
+ fullname = ast_variable_retrieve(rtdata, category, "fullname");
+ hidefromdir = ast_variable_retrieve(rtdata, category, "hidefromdir");
if (ast_true(hidefromdir)) {
/* Skip hidden */
continue;
@@ -521,8 +520,9 @@ static struct ast_config *realtime_directory(char *context)
/* password,Full Name,email,pager,options */
ast_str_set(&tmp, 0, "no-password,%s,,,", S_OR(fullname, ""));
- if (ast_variable_retrieve(rtdata, mailbox, "alias")) {
- for (alias = ast_variable_browse(rtdata, mailbox); alias; alias = alias->next) {
+ if (ast_variable_retrieve(rtdata, category, "alias")) {
+ struct ast_variable *alias;
+ for (alias = ast_variable_browse(rtdata, category); alias; alias = alias->next) {
if (!strcasecmp(alias->name, "alias")) {
ast_str_append(&tmp, 0, "|alias=%s", alias->value);
}