[asterisk-commits] tilghman: trunk r49075 - in /trunk: ./ apps/ configs/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Dec 30 21:54:21 MST 2006


Author: tilghman
Date: Sat Dec 30 22:54:20 2006
New Revision: 49075

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49075
Log:
1. Rename 'maxmessage' to 'maxsecs' to differentiate from 'maxmsg'.
2. Rename 'minmessage' to 'minsecs' for parity.
3. Make 'maxsecs' a per-user option, in addition to global.
(Issue # 8624)

Modified:
    trunk/UPGRADE.txt
    trunk/apps/app_voicemail.c
    trunk/configs/voicemail.conf.sample

Modified: trunk/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/trunk/UPGRADE.txt?view=diff&rev=49075&r1=49074&r2=49075
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Sat Dec 30 22:54:20 2006
@@ -23,3 +23,11 @@
   the default sound file layout for non-English sounds is the 'new
   style' layout introduced in Asterisk 1.4 (and used by the automatic
   sound file installer in the Makefile).
+
+Applications:
+
+* The voicemail configuration values 'maxmessage' and 'minmessage' have
+  been changed to 'maxsecs' and 'minsecs' to clarify their purpose and
+  to make them more distinguishable from 'maxmsgs', which sets folder
+  size.  The old variables will continue to work in this version, albeit
+  with a deprecation warning.

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=49075&r1=49074&r2=49075
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Sat Dec 30 22:54:20 2006
@@ -312,6 +312,7 @@
 	unsigned int flags;              /*!< VM_ flags */	
 	int saydurationm;
 	int maxmsg;                      /*!< Maximum number of msgs per folder for this mailbox */
+	int maxsecs;                     /*!< Maximum number of seconds per message for this mailbox */
 #ifdef IMAP_STORAGE
 	char imapuser[80];	/* IMAP server login */
 	char imappassword[80];	/* IMAP server password if authpassword not defined */
@@ -511,8 +512,8 @@
 static struct ast_smdi_interface *smdi_iface = NULL;
 static char vmfmts[80];
 static double volgain;
-static int vmminmessage;
-static int vmmaxmessage;
+static int vmminsecs;
+static int vmmaxsecs;
 static int maxgreet;
 static int skipms;
 static int maxlogins;
@@ -561,6 +562,8 @@
 		ast_copy_string(vmu->dialout, dialcontext, sizeof(vmu->dialout));
 	if (exitcontext)
 		ast_copy_string(vmu->exit, exitcontext, sizeof(vmu->exit));
+	if (vmmaxsecs)
+		vmu->maxsecs = vmmaxsecs;
 	if (maxmsg)
 		vmu->maxmsg = maxmsg;
 	vmu->volgain = volgain;
@@ -617,6 +620,13 @@
 		ast_copy_string(vmu->dialout, value, sizeof(vmu->dialout));
 	} else if (!strcasecmp(var, "exitcontext")) {
 		ast_copy_string(vmu->exit, value, sizeof(vmu->exit));
+	} else if (!strcasecmp(var, "maxmessage")) {
+		if (vmu->maxsecs <= 0) {
+			ast_log(LOG_WARNING, "Invalid max message length of %s. Using global value %i\n", value, vmmaxsecs);
+			vmu->maxsecs = vmmaxsecs;
+		} else {
+			vmu->maxsecs = atoi(value);
+		}
 	} else if (!strcasecmp(var, "maxmsg")) {
 		vmu->maxmsg = atoi(value);
 		if (vmu->maxmsg <= 0) {
@@ -668,6 +678,7 @@
 	struct ast_variable *tmp;
 	tmp = var;
 	while (tmp) {
+		ast_log(LOG_DEBUG, "Name: %s Value: %s\n", tmp->name, tmp->value);
 		if (!strcasecmp(tmp->name, "password")) {
 			ast_copy_string(retval->password, tmp->value, sizeof(retval->password));
 		} else if (!strcasecmp(tmp->name, "uniqueid")) {
@@ -3086,15 +3097,15 @@
 		} else
 			ast_log(LOG_WARNING, "Error opening text file for output\n");
 #ifdef IMAP_STORAGE
-		res = play_record_review(chan, NULL, tmptxtfile, vmmaxmessage, fmt, 1, vmu, &duration, NULL, options->record_gain, vms);
+		res = play_record_review(chan, NULL, tmptxtfile, vmu->maxsecs, fmt, 1, vmu, &duration, NULL, options->record_gain, vms);
 #else
-		res = play_record_review(chan, NULL, tmptxtfile, vmmaxmessage, fmt, 1, vmu, &duration, NULL, options->record_gain, NULL);
+		res = play_record_review(chan, NULL, tmptxtfile, vmu->maxsecs, fmt, 1, vmu, &duration, NULL, options->record_gain, NULL);
 #endif
 
 		if (txt) {
-			if (duration < vmminmessage) {
+			if (duration < vmminsecs) {
 				if (option_verbose > 2) 
-					ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminmessage);
+					ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminsecs);
 				ast_filedelete(tmptxtfile, NULL);
 				unlink(tmptxtfile);
 			} else {
@@ -3157,7 +3168,7 @@
 		} else if (res > 0)
 			res = 0;
 
-		if (duration < vmminmessage)
+		if (duration < vmminsecs)
 			/* XXX We should really give a prompt too short/option start again, with leave_vm_out called only after a timeout XXX */
 			pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
 		else
@@ -7271,25 +7282,50 @@
 			astemail = ASTERISK_USERNAME;
 		ast_copy_string(serveremail, astemail, sizeof(serveremail));
 		
-		vmmaxmessage = 0;
-		if ((s = ast_variable_retrieve(cfg, "general", "maxmessage"))) {
+		vmmaxsecs = 0;
+		if ((s = ast_variable_retrieve(cfg, "general", "maxsecs"))) {
 			if (sscanf(s, "%d", &x) == 1) {
-				vmmaxmessage = x;
+				vmmaxsecs = x;
 			} else {
 				ast_log(LOG_WARNING, "Invalid max message time length\n");
 			}
-		}
-
-		vmminmessage = 0;
-		if ((s = ast_variable_retrieve(cfg, "general", "minmessage"))) {
+		} else if ((s = ast_variable_retrieve(cfg, "general", "maxmessage"))) {
+			static int maxmessage_deprecate = 0;
+			if (maxmessage_deprecate == 0) {
+				maxmessage_deprecate = 1;
+				ast_log(LOG_WARNING, "Setting 'maxmessage' has been deprecated in favor of 'maxsecs'.\n");
+			}
 			if (sscanf(s, "%d", &x) == 1) {
-				vmminmessage = x;
-				if (maxsilence <= vmminmessage)
+				vmmaxsecs = x;
+			} else {
+				ast_log(LOG_WARNING, "Invalid max message time length\n");
+			}
+		}
+
+		vmminsecs = 0;
+		if ((s = ast_variable_retrieve(cfg, "general", "minsecs"))) {
+			if (sscanf(s, "%d", &x) == 1) {
+				vmminsecs = x;
+				if (maxsilence <= vmminsecs)
 					ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
 			} else {
 				ast_log(LOG_WARNING, "Invalid min message time length\n");
 			}
-		}
+		} else if ((s = ast_variable_retrieve(cfg, "general", "minmessage"))) {
+			static int maxmessage_deprecate = 0;
+			if (maxmessage_deprecate == 0) {
+				maxmessage_deprecate = 1;
+				ast_log(LOG_WARNING, "Setting 'minmessage' has been deprecated in favor of 'minsecs'.\n");
+			}
+			if (sscanf(s, "%d", &x) == 1) {
+				vmminsecs = x;
+				if (maxsilence <= vmminsecs)
+					ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
+			} else {
+				ast_log(LOG_WARNING, "Invalid min message time length\n");
+			}
+		}
+
 		fmt = ast_variable_retrieve(cfg, "general", "format");
 		if (!fmt)
 			fmt = "wav";	

Modified: trunk/configs/voicemail.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/voicemail.conf.sample?view=diff&rev=49075&r1=49074&r2=49075
==============================================================================
--- trunk/configs/voicemail.conf.sample (original)
+++ trunk/configs/voicemail.conf.sample Sat Dec 30 22:54:20 2006
@@ -35,10 +35,10 @@
 ; (100) is used.  Maximum value for this option is 9999.
 ;maxmsg=100
 ; Maximum length of a voicemail message in seconds
-;maxmessage=180
+;maxsecs=180
 ; Minimum length of a voicemail message in seconds for the message to be kept
 ; The default is no minimum.
-;minmessage=3
+;minsecs=3
 ; Maximum length of greetings in seconds
 ;maxgreet=60
 ; How many milliseconds to skip forward/back when rew/ff in message playback



More information about the asterisk-commits mailing list