From 03fd2c0c94a52fb054bb30facc638748aba409e8 Mon Sep 17 00:00:00 2001 From: Walter Doekes Date: Tue, 6 Dec 2011 19:28:18 +0000 Subject: 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 --- apps/app_voicemail.c | 129 ++++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 62 deletions(-) (limited to 'apps') diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index c43a0ceaa..901eae230 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -12315,6 +12315,70 @@ static int load_config(int reload) if ((val = ast_variable_retrieve(cfg, "general", "pollmailboxes"))) poll_mailboxes = ast_true(val); + memset(fromstring, 0, sizeof(fromstring)); + memset(pagerfromstring, 0, sizeof(pagerfromstring)); + strcpy(charset, "ISO-8859-1"); + if (emailbody) { + ast_free(emailbody); + emailbody = NULL; + } + if (emailsubject) { + ast_free(emailsubject); + emailsubject = NULL; + } + if (pagerbody) { + ast_free(pagerbody); + pagerbody = NULL; + } + if (pagersubject) { + ast_free(pagersubject); + pagersubject = NULL; + } + if ((val = ast_variable_retrieve(cfg, "general", "pbxskip"))) + ast_set2_flag((&globalflags), ast_true(val), VM_PBXSKIP); + if ((val = ast_variable_retrieve(cfg, "general", "fromstring"))) + ast_copy_string(fromstring, val, sizeof(fromstring)); + if ((val = ast_variable_retrieve(cfg, "general", "pagerfromstring"))) + ast_copy_string(pagerfromstring, val, sizeof(pagerfromstring)); + if ((val = ast_variable_retrieve(cfg, "general", "charset"))) + ast_copy_string(charset, val, sizeof(charset)); + if ((val = ast_variable_retrieve(cfg, "general", "adsifdn"))) { + sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]); + for (x = 0; x < 4; x++) { + memcpy(&adsifdn[x], &tmpadsi[x], 1); + } + } + if ((val = ast_variable_retrieve(cfg, "general", "adsisec"))) { + sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]); + for (x = 0; x < 4; x++) { + memcpy(&adsisec[x], &tmpadsi[x], 1); + } + } + if ((val = ast_variable_retrieve(cfg, "general", "adsiver"))) { + if (atoi(val)) { + adsiver = atoi(val); + } + } + if ((val = ast_variable_retrieve(cfg, "general", "tz"))) { + ast_copy_string(zonetag, val, sizeof(zonetag)); + } + if ((val = ast_variable_retrieve(cfg, "general", "locale"))) { + ast_copy_string(locale, val, sizeof(locale)); + } + if ((val = ast_variable_retrieve(cfg, "general", "emailsubject"))) { + emailsubject = ast_strdup(substitute_escapes(val)); + } + if ((val = ast_variable_retrieve(cfg, "general", "emailbody"))) { + emailbody = ast_strdup(substitute_escapes(val)); + } + if ((val = ast_variable_retrieve(cfg, "general", "pagersubject"))) { + pagersubject = ast_strdup(substitute_escapes(val)); + } + 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")) { @@ -12339,6 +12403,8 @@ static int load_config(int reload) } ast_config_destroy(ucfg); } + + /* load mailboxes from voicemail.conf */ cat = ast_category_browse(cfg, NULL); while (cat) { if (strcasecmp(cat, "general")) { @@ -12379,68 +12445,7 @@ static int load_config(int reload) } cat = ast_category_browse(cfg, cat); } - memset(fromstring, 0, sizeof(fromstring)); - memset(pagerfromstring, 0, sizeof(pagerfromstring)); - strcpy(charset, "ISO-8859-1"); - if (emailbody) { - ast_free(emailbody); - emailbody = NULL; - } - if (emailsubject) { - ast_free(emailsubject); - emailsubject = NULL; - } - if (pagerbody) { - ast_free(pagerbody); - pagerbody = NULL; - } - if (pagersubject) { - ast_free(pagersubject); - pagersubject = NULL; - } - if ((val = ast_variable_retrieve(cfg, "general", "pbxskip"))) - ast_set2_flag((&globalflags), ast_true(val), VM_PBXSKIP); - if ((val = ast_variable_retrieve(cfg, "general", "fromstring"))) - ast_copy_string(fromstring, val, sizeof(fromstring)); - if ((val = ast_variable_retrieve(cfg, "general", "pagerfromstring"))) - ast_copy_string(pagerfromstring, val, sizeof(pagerfromstring)); - if ((val = ast_variable_retrieve(cfg, "general", "charset"))) - ast_copy_string(charset, val, sizeof(charset)); - if ((val = ast_variable_retrieve(cfg, "general", "adsifdn"))) { - sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]); - for (x = 0; x < 4; x++) { - memcpy(&adsifdn[x], &tmpadsi[x], 1); - } - } - if ((val = ast_variable_retrieve(cfg, "general", "adsisec"))) { - sscanf(val, "%2x%2x%2x%2x", &tmpadsi[0], &tmpadsi[1], &tmpadsi[2], &tmpadsi[3]); - for (x = 0; x < 4; x++) { - memcpy(&adsisec[x], &tmpadsi[x], 1); - } - } - if ((val = ast_variable_retrieve(cfg, "general", "adsiver"))) { - if (atoi(val)) { - adsiver = atoi(val); - } - } - if ((val = ast_variable_retrieve(cfg, "general", "tz"))) { - ast_copy_string(zonetag, val, sizeof(zonetag)); - } - if ((val = ast_variable_retrieve(cfg, "general", "locale"))) { - ast_copy_string(locale, val, sizeof(locale)); - } - if ((val = ast_variable_retrieve(cfg, "general", "emailsubject"))) { - emailsubject = ast_strdup(substitute_escapes(val)); - } - if ((val = ast_variable_retrieve(cfg, "general", "emailbody"))) { - emailbody = ast_strdup(substitute_escapes(val)); - } - if ((val = ast_variable_retrieve(cfg, "general", "pagersubject"))) { - pagersubject = ast_strdup(substitute_escapes(val)); - } - if ((val = ast_variable_retrieve(cfg, "general", "pagerbody"))) { - pagerbody = ast_strdup(substitute_escapes(val)); - } + AST_LIST_UNLOCK(&users); ast_config_destroy(cfg); -- cgit v1.2.3