[asterisk-commits] wdoekes: branch 1.8 r347111 - /branches/1.8/apps/app_voicemail.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 6 13:17:11 CST 2011
Author: wdoekes
Date: Tue Dec 6 13:17:03 2011
New Revision: 347111
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=347111
Log:
Move setting of voicemail zonetag and locale up a bit.
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
Modified:
branches/1.8/apps/app_voicemail.c
Modified: branches/1.8/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_voicemail.c?view=diff&rev=347111&r1=347110&r2=347111
==============================================================================
--- branches/1.8/apps/app_voicemail.c (original)
+++ branches/1.8/apps/app_voicemail.c Tue Dec 6 13:17:03 2011
@@ -12325,6 +12325,70 @@
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")) {
@@ -12349,6 +12413,8 @@
}
ast_config_destroy(ucfg);
}
+
+ /* load mailboxes from voicemail.conf */
cat = ast_category_browse(cfg, NULL);
while (cat) {
if (strcasecmp(cat, "general")) {
@@ -12389,68 +12455,7 @@
}
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);
More information about the asterisk-commits
mailing list