Index: apps/app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.138
diff -u -r1.138 app_voicemail.c
--- apps/app_voicemail.c	16 Aug 2004 04:05:43 -0000	1.138
+++ apps/app_voicemail.c	2 Sep 2004 02:40:34 -0000
@@ -147,6 +147,8 @@
 	int review;
 	int operator;
 	int envelope;
+	int sayduration;
+	int saydurationm;
 	struct ast_vm_user *next;
 };
 
@@ -265,6 +267,8 @@
 static int saycidinfo;
 static int svmailinfo;
 static int hearenv;
+static int saydurationinfo;
+static int saydurationminfo;
 static int skipaftercmd;
 static char dialcontext[80];
 static char callcontext[80];
@@ -299,6 +303,10 @@
 		vmu->svmail = 1; 
 	if (hearenv)
 		vmu->envelope = 1;
+	if (saydurationinfo)
+		vmu->sayduration = 1;
+	if (saydurationminfo>0)
+		vmu->saydurationm = saydurationminfo;
 	if (callcontext)
 		strncpy(vmu->callback, callcontext, sizeof(vmu->callback) -1);
 	if (dialcontext)
@@ -313,7 +321,8 @@
 	char *stringp = ast_strdupa(options);
 	char *s;
 	char *var, *value;
-	
+	int x;
+
 	while((s = strsep(&stringp, "|"))) {
 		value = s;
 		if ((var = strsep(&value, "=")) && value) {
@@ -355,6 +364,17 @@
 					vmu->envelope = 1;
 				else
 					vmu->envelope = 0;
+			} else if (!strcasecmp(var, "sayduration")){
+				if(ast_true(value))
+					vmu->sayduration = 1;
+				else
+					vmu->sayduration = 0;
+			} else if (!strcasecmp(var, "saydurationm")){
+				if (sscanf(value, "%d", &x) == 1) {
+                                	vmu->saydurationm = x;
+                        	} else {
+                                	ast_log(LOG_WARNING, "Invalid min duration for say duration\n");
+                        	}
 			} else if (!strcasecmp(var, "callback")) {
 				strncpy(vmu->callback, value, sizeof(vmu->callback) -1);
 			} else if (!strcasecmp(var, "dialout")) {
@@ -2903,10 +2923,35 @@
 	return res;                                                               
 }
 
+static int play_message_duration(struct ast_channel *chan, struct vm_state *vms, char *duration, int minduration)
+{
+
+        int res = 0;
+        int durationm;
+        int durations;
+        /* Verify that we have a duration for the message */
+        if((duration == NULL))
+                return res;
+
+        /* Convert from seconds to minutes */
+        durations=atoi(duration);
+        durationm=(durations / 60);
+
+        ast_log(LOG_DEBUG, "VM-Duration: duration is: %d seconds converted to: %d minutes\n", durations, durationm);
+
+        if((!res)&&(durationm>=minduration)) {
+                res = ast_say_number(chan, durationm, AST_DIGIT_ANY, chan->language, (char *) NULL);
+                res = wait_file2(chan, vms, "vm-minutes");
+        }
+        return res;
+}
+
+
+
 static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms)
 {
 	int res = 0;
-	char filename[256],*origtime, *cid, *context;
+	char filename[256],*origtime, *cid, *context, *duration;
 	struct ast_config *msg_cfg;
 
 	vms->starting = 0; 
@@ -2938,6 +2983,8 @@
 
 	cid = ast_variable_retrieve(msg_cfg, "message", "callerid");
 
+        duration = ast_variable_retrieve(msg_cfg, "message", "duration");
+
 	context = ast_variable_retrieve(msg_cfg, "message", "context");
 	if(!strncasecmp("macro",context,5)) /* Macro names in contexts are useless for our needs */
 		context = ast_variable_retrieve(msg_cfg, "message","macrocontext");
@@ -2946,6 +2993,8 @@
 		res = play_message_datetime(chan, vmu, origtime, filename);
 	if ((!res)&&(vmu->saycid))
 		res = play_message_callerid(chan, vms, cid, context, 0);
+        if ((!res)&&(vmu->sayduration))
+                res = play_message_duration(chan, vms, duration, vmu->saydurationm);
 	/* Allow pressing '1' to skip envelope / callerid */
 	if (res == '1')
 		res = 0;
@@ -4203,6 +4264,8 @@
 	char *astreview;
 	char *astskipcmd;
 	char *asthearenv;
+	char *astsaydurationinfo;
+	char *astsaydurationminfo;
 	char *silencestr;
 	char *thresholdstr;
 	char *fmt;
@@ -4369,6 +4432,22 @@
 			asthearenv = "yes";
 		}
 		hearenv = ast_true(asthearenv);	
+
+		saydurationinfo = 1;
+		if (!(astsaydurationinfo = ast_variable_retrieve(cfg, "general", "sayduration"))) {
+			ast_log(LOG_DEBUG,"Duration info before msg enabled globally\n");
+			astsaydurationinfo = "yes";
+		}
+		saydurationinfo = ast_true(astsaydurationinfo);	
+
+		saydurationminfo = 2;
+		if ((astsaydurationminfo = ast_variable_retrieve(cfg, "general", "saydurationm"))) {
+			if (sscanf(astsaydurationminfo, "%d", &x) == 1) {
+				saydurationminfo = x;
+			} else {
+				ast_log(LOG_WARNING, "Invalid min duration for say duration\n");
+			}
+		}
 
 		skipaftercmd = 0;
 		if (!(astskipcmd = ast_variable_retrieve(cfg, "general", "nextaftercmd"))) {
Index: configs/voicemail.conf.sample
===================================================================
RCS file: /usr/cvsroot/asterisk/configs/voicemail.conf.sample,v
retrieving revision 1.37
diff -u -r1.37 voicemail.conf.sample
--- configs/voicemail.conf.sample	16 Aug 2004 04:05:43 -0000	1.37
+++ configs/voicemail.conf.sample	2 Sep 2004 02:40:34 -0000
@@ -96,6 +96,9 @@
 ; attach=yes 		; Attach the voicemail to the notification email *NOT* the pager email
 ; saycid=yes 		; Say the caller id information before the message. If not described, 
 			;     or set to no, it will be in the envelope
+; cidinternalcontexts=intern	; Internal Context for Name Playback instead of extension digits when saying caller id.
+; sayduration=no 	; Turn on/off the duration information before the message. [ON by default]
+; saydurationm=2        ; Specify the minimum duration to say. Default is 2 minutes
 ; dialout=fromvm 	; Context to dial out from [option 4 from the advanced menu]
 			;     if not listed, dialing out will not be permitted
 sendvoicemail=yes	; Context to Send voicemail from [option 5 from the advanced menu]
@@ -123,7 +126,7 @@
 ;4200 => 9855,Mark Spencer,markster@linux-support.net,mypager@digium.com,attach=no|serveremail=myaddy@digium.com|tz=central
 ;4300 => 3456,Ben Rigas,ben@american-computer.net
 ;4310 => 5432,Sales,sales@marko.net
-;4069 => 6522,Matt Brooks,matt@marko.net,,|tz=central|attach=yes|saycid=yes|dialout=fromvm|callback=fromvm|review=yes|operator=yes|envelope=yes
+;4069 => 6522,Matt Brooks,matt@marko.net,,|tz=central|attach=yes|saycid=yes|dialout=fromvm|callback=fromvm|review=yes|operator=yes|envelope=yes|sayduration=yes|saydurationm=1
 ;4073 => 1099,Bianca Paige,bianca@biancapaige.com,,delete=1
 ;4110 => 3443,Rob Flynn,rflynn@blueridge.net
 
