[asterisk-commits] wdoekes: trunk r347157 - in /trunk: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 6 13:28:27 CST 2011


Author: wdoekes
Date: Tue Dec  6 13:28:18 2011
New Revision: 347157

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=347157
Log:
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

Modified:
    trunk/   (props changed)
    trunk/apps/app_voicemail.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=347157&r1=347156&r2=347157
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Tue Dec  6 13:28:18 2011
@@ -12315,6 +12315,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")) {
@@ -12339,6 +12403,8 @@
 			}
 			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 @@
 			}
 			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