mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user