mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 11:58:40 +00:00
The voicemail [general] zonetag and locale variables weren't loaded
until after the mailboxes were initialized. This caused the settings to be unset for those mailboxes until a reload was performed. (closes issue ASTERISK-18838) Review: https://reviewboard.asterisk.org/r/1570 Reviewed by: Matt Jordan ........ Merged revisions 347111 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 347124 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -12315,70 +12315,6 @@ static int load_config(int reload)
|
||||
if ((val = ast_variable_retrieve(cfg, "general", "pollmailboxes")))
|
||||
poll_mailboxes = ast_true(val);
|
||||
|
||||
if (ucfg) {
|
||||
for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
|
||||
if (!strcasecmp(cat, "general")) {
|
||||
continue;
|
||||
}
|
||||
if (!ast_true(ast_config_option(ucfg, cat, "hasvoicemail")))
|
||||
continue;
|
||||
if ((current = find_or_create(userscontext, cat))) {
|
||||
populate_defaults(current);
|
||||
apply_options_full(current, ast_variable_browse(ucfg, cat));
|
||||
ast_copy_string(current->context, userscontext, sizeof(current->context));
|
||||
if (!ast_strlen_zero(current->password) && current->passwordlocation == OPT_PWLOC_VOICEMAILCONF) {
|
||||
current->passwordlocation = OPT_PWLOC_USERSCONF;
|
||||
}
|
||||
|
||||
switch (current->passwordlocation) {
|
||||
case OPT_PWLOC_SPOOLDIR:
|
||||
snprintf(secretfn, sizeof(secretfn), "%s%s/%s/secret.conf", VM_SPOOL_DIR, current->context, current->mailbox);
|
||||
read_password_from_file(secretfn, current->password, sizeof(current->password));
|
||||
}
|
||||
}
|
||||
}
|
||||
ast_config_destroy(ucfg);
|
||||
}
|
||||
cat = ast_category_browse(cfg, NULL);
|
||||
while (cat) {
|
||||
if (strcasecmp(cat, "general")) {
|
||||
var = ast_variable_browse(cfg, cat);
|
||||
if (strcasecmp(cat, "zonemessages")) {
|
||||
/* Process mailboxes in this context */
|
||||
while (var) {
|
||||
append_mailbox(cat, var->name, var->value);
|
||||
var = var->next;
|
||||
}
|
||||
} else {
|
||||
/* Timezones in this context */
|
||||
while (var) {
|
||||
struct vm_zone *z;
|
||||
if ((z = ast_malloc(sizeof(*z)))) {
|
||||
char *msg_format, *tzone;
|
||||
msg_format = ast_strdupa(var->value);
|
||||
tzone = strsep(&msg_format, "|,");
|
||||
if (msg_format) {
|
||||
ast_copy_string(z->name, var->name, sizeof(z->name));
|
||||
ast_copy_string(z->timezone, tzone, sizeof(z->timezone));
|
||||
ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
|
||||
AST_LIST_LOCK(&zones);
|
||||
AST_LIST_INSERT_HEAD(&zones, z, list);
|
||||
AST_LIST_UNLOCK(&zones);
|
||||
} else {
|
||||
ast_log(AST_LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
|
||||
ast_free(z);
|
||||
}
|
||||
} else {
|
||||
AST_LIST_UNLOCK(&users);
|
||||
ast_config_destroy(cfg);
|
||||
return -1;
|
||||
}
|
||||
var = var->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
cat = ast_category_browse(cfg, cat);
|
||||
}
|
||||
memset(fromstring, 0, sizeof(fromstring));
|
||||
memset(pagerfromstring, 0, sizeof(pagerfromstring));
|
||||
strcpy(charset, "ISO-8859-1");
|
||||
@@ -12441,6 +12377,75 @@ static int load_config(int reload)
|
||||
if ((val = ast_variable_retrieve(cfg, "general", "pagerbody"))) {
|
||||
pagerbody = ast_strdup(substitute_escapes(val));
|
||||
}
|
||||
|
||||
/* load mailboxes from users.conf */
|
||||
if (ucfg) {
|
||||
for (cat = ast_category_browse(ucfg, NULL); cat ; cat = ast_category_browse(ucfg, cat)) {
|
||||
if (!strcasecmp(cat, "general")) {
|
||||
continue;
|
||||
}
|
||||
if (!ast_true(ast_config_option(ucfg, cat, "hasvoicemail")))
|
||||
continue;
|
||||
if ((current = find_or_create(userscontext, cat))) {
|
||||
populate_defaults(current);
|
||||
apply_options_full(current, ast_variable_browse(ucfg, cat));
|
||||
ast_copy_string(current->context, userscontext, sizeof(current->context));
|
||||
if (!ast_strlen_zero(current->password) && current->passwordlocation == OPT_PWLOC_VOICEMAILCONF) {
|
||||
current->passwordlocation = OPT_PWLOC_USERSCONF;
|
||||
}
|
||||
|
||||
switch (current->passwordlocation) {
|
||||
case OPT_PWLOC_SPOOLDIR:
|
||||
snprintf(secretfn, sizeof(secretfn), "%s%s/%s/secret.conf", VM_SPOOL_DIR, current->context, current->mailbox);
|
||||
read_password_from_file(secretfn, current->password, sizeof(current->password));
|
||||
}
|
||||
}
|
||||
}
|
||||
ast_config_destroy(ucfg);
|
||||
}
|
||||
|
||||
/* load mailboxes from voicemail.conf */
|
||||
cat = ast_category_browse(cfg, NULL);
|
||||
while (cat) {
|
||||
if (strcasecmp(cat, "general")) {
|
||||
var = ast_variable_browse(cfg, cat);
|
||||
if (strcasecmp(cat, "zonemessages")) {
|
||||
/* Process mailboxes in this context */
|
||||
while (var) {
|
||||
append_mailbox(cat, var->name, var->value);
|
||||
var = var->next;
|
||||
}
|
||||
} else {
|
||||
/* Timezones in this context */
|
||||
while (var) {
|
||||
struct vm_zone *z;
|
||||
if ((z = ast_malloc(sizeof(*z)))) {
|
||||
char *msg_format, *tzone;
|
||||
msg_format = ast_strdupa(var->value);
|
||||
tzone = strsep(&msg_format, "|,");
|
||||
if (msg_format) {
|
||||
ast_copy_string(z->name, var->name, sizeof(z->name));
|
||||
ast_copy_string(z->timezone, tzone, sizeof(z->timezone));
|
||||
ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
|
||||
AST_LIST_LOCK(&zones);
|
||||
AST_LIST_INSERT_HEAD(&zones, z, list);
|
||||
AST_LIST_UNLOCK(&zones);
|
||||
} else {
|
||||
ast_log(AST_LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
|
||||
ast_free(z);
|
||||
}
|
||||
} else {
|
||||
AST_LIST_UNLOCK(&users);
|
||||
ast_config_destroy(cfg);
|
||||
return -1;
|
||||
}
|
||||
var = var->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
cat = ast_category_browse(cfg, cat);
|
||||
}
|
||||
|
||||
AST_LIST_UNLOCK(&users);
|
||||
ast_config_destroy(cfg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user