[svn-commits] wdoekes: branch 10 r347124 - in /branches/10: ./ apps/app_voicemail.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 6 13:20:22 CST 2011


Author: wdoekes
Date: Tue Dec  6 13:20:10 2011
New Revision: 347124

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

Merged revisions 347111 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/10/   (props changed)
    branches/10/apps/app_voicemail.c

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

Modified: branches/10/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/apps/app_voicemail.c?view=diff&rev=347124&r1=347123&r2=347124
==============================================================================
--- branches/10/apps/app_voicemail.c (original)
+++ branches/10/apps/app_voicemail.c Tue Dec  6 13:20:10 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 svn-commits mailing list