[svn-commits] russell: branch group/upenn r89605 - in /team/group/upenn: apps/ configs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 26 12:26:31 CST 2007


Author: russell
Date: Mon Nov 26 12:26:30 2007
New Revision: 89605

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89605
Log:
add configurable prompt support from issue #8994

Modified:
    team/group/upenn/apps/app_voicemail.c
    team/group/upenn/configs/voicemail.conf.sample

Modified: team/group/upenn/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/upenn/apps/app_voicemail.c?view=diff&rev=89605&r1=89604&r2=89605
==============================================================================
--- team/group/upenn/apps/app_voicemail.c (original)
+++ team/group/upenn/apps/app_voicemail.c Mon Nov 26 12:26:30 2007
@@ -153,6 +153,56 @@
 #define VOICEMAIL_CONFIG "voicemail.conf"
 #define ASTERISK_USERNAME "asterisk"
 
+/* Define default prompts for voicemail */
+#define DEFAULT_MAIN_OPTIONS_KEY '0'
+#define DEFAULT_MAIN_LISTEN_KEY '1'
+#define DEFAULT_MAIN_FOLDER_KEY '2'
+#define DEFAULT_MAIN_ADVANCED_KEY '3'
+
+#define DEFAULT_LISTEN_PREVIOUS_KEY '4'
+#define DEFAULT_LISTEN_REPLAY_KEY '5'
+#define DEFAULT_LISTEN_NEXT_KEY '6'
+#define DEFAULT_LISTEN_DELETE_KEY '7'
+#define DEFAULT_LISTEN_FORWARD_KEY '8'
+#define DEFAULT_LISTEN_SAVE_KEY '9'
+
+#define DEFAULT_ADVANCED_REPLY_KEY '1'
+#define DEFAULT_ADVANCED_CALLBACK_KEY '2'
+#define DEFAULT_ADVANCED_ENVELOPE_KEY '3'
+#define DEFAULT_ADVANCED_NEWCALL_KEY '4'
+#define DEFAULT_ADVANCED_MESSAGE_KEY '5'
+
+#define DEFAULT_OPTIONS_REC_UNAVAIL_KEY '1'
+#define DEFAULT_OPTIONS_REC_BUSY_KEY '2'
+#define DEFAULT_OPTIONS_REC_NAME_KEY '3'
+#define DEFAULT_OPTIONS_REC_TEMP_KEY '4'
+#define DEFAULT_OPTIONS_REC_PASSWORD_KEY '5'
+
+#define DEFAULT_MAIN_SOUND "vm-opts"
+#define DEFAULT_MAIN_LISTEN_SOUND "vm-messages"
+#define DEFAULT_MAIN_FOLDER_SOUND "vm-changeto"
+#define DEFAULT_MAIN_ADVANCED_SOUND "vm-advopts"
+
+#define DEFAULT_LISTEN_PREVIOUS_SOUND "vm-prev"
+#define DEFAULT_LISTEN_REPLAY_SOUND "vm-repeat"
+#define DEFAULT_LISTEN_NEXT_SOUND "vm-next"
+#define DEFAULT_LISTEN_DELETE_SOUND "vm-delete"
+#define DEFAULT_LISTEN_UNDELETE_SOUND "vm-undelete"
+#define DEFAULT_LISTEN_FORWARD_SOUND "vm-toforward"
+#define DEFAULT_LISTEN_SAVE_SOUND "vm-savemessage"
+
+#define DEFAULT_ADVANCED_REPLY_SOUND "vm-toreply"
+#define DEFAULT_ADVANCED_CALLBACK_SOUND "vm-tocallback"
+#define DEFAULT_ADVANCED_ENVELOPE_SOUND "vm-tohearenv"
+#define DEFAULT_ADVANCED_NEWCALL_SOUND "vm-tomakecall"
+#define DEFAULT_ADVANCED_MESSAGE_SOUND "vm-leavemsg"
+
+#define DEFAULT_OPTIONS_SOUND "vm-options"
+#define DEFAULT_OPTIONS_REC_UNAVAIL_SOUND "vm-rec-unv"
+#define DEFAULT_OPTIONS_REC_BUSY_SOUND "vm-rec-busy"
+#define DEFAULT_OPTIONS_REC_NAME_SOUND "vm-rec-name"
+#define DEFAULT_OPTIONS_REC_TEMP_SOUND "vm-rec-temp"
+
 /* Default mail command to mail voicemail. Change it with the
     mailcmd= command in voicemail.conf */
 #define SENDMAIL "/usr/sbin/sendmail -t"
@@ -527,6 +577,56 @@
 static int maxgreet;
 static int skipms;
 static int maxlogins;
+
+/* configurable prompt data members */
+static int main_options_key = '0';
+static int main_listen_key = '1';
+static int main_folder_key = '2';
+static int main_advanced_key = '3';
+
+static int listen_previous_key = '4';
+static int listen_replay_key = '5';
+static int listen_next_key = '6';
+static int listen_delete_key = '7';
+static int listen_forward_key = '8';
+static int listen_save_key = '9';
+
+static int advanced_reply_key = '1';
+static int advanced_callback_key = '2';
+static int advanced_envelope_key = '3';
+static int advanced_newcall_key = '4';
+static int advanced_message_key = '5';
+
+static int options_rec_unavail_key = '1';
+static int options_rec_busy_key = '2';
+static int options_rec_name_key = '3';
+static int options_rec_temp_key = '4';
+static int options_rec_password_key = '5';
+
+static char main_sound[80];
+static char main_listen_sound[80];
+static char main_folder_sound[80];
+static char main_advanced_sound[80];
+
+static char listen_previous_sound[80];
+static char listen_replay_sound[80];
+static char listen_next_sound[80];
+static char listen_delete_sound[80];
+static char listen_undelete_sound[80];
+static char listen_forward_sound[80];
+static char listen_save_sound[80];
+
+static char advanced_reply_sound[80];
+static char advanced_callback_sound[80];
+static char advanced_envelope_sound[80];
+static char advanced_newcall_sound[80];
+static char advanced_message_sound[80];
+
+static char options_sound[80];
+static char options_rec_unavail_sound[80];
+static char options_rec_busy_sound[80];
+static char options_rec_name_sound[80];
+static char options_rec_temp_sound[80];
 
 static struct ast_flags globalflags = {0};
 
@@ -4057,9 +4157,9 @@
 
 			/* play name if available, else play extension number */
 			snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, receiver->context, s);
- 			RETRIEVE(fn, -1, s, receiver->context);
+ 			RETRIEVE(fn, -1);
 			if (ast_fileexists(fn, NULL, NULL) > 0) {
-				res = ast_stream_and_wait(chan, fn, ecodes);
+				res = ast_stream_and_wait(chan, fn, NULL, ecodes);
 				if (res) {
 					DISPOSE(fn, -1);
 					return res;
@@ -5818,25 +5918,25 @@
 					res = vm_play_folder_name(chan, vms->vmbox);
 			}
 			if (!res)
-				res = ast_play_and_wait(chan, "vm-opts");
+				res = ast_play_and_wait(chan, main_sound);
 		} else {
 			if (vms->curmsg)
-				res = ast_play_and_wait(chan, "vm-prev");
+				res = ast_play_and_wait(chan, listen_previous_sound);
 			if (!res && !skipadvanced)
-				res = ast_play_and_wait(chan, "vm-advopts");
+				res = ast_play_and_wait(chan, main_advanced_sound);
 			if (!res)
-				res = ast_play_and_wait(chan, "vm-repeat");
+				res = ast_play_and_wait(chan, listen_replay_sound);
 			if (!res && (vms->curmsg != vms->lastmsg))
-				res = ast_play_and_wait(chan, "vm-next");
+				res = ast_play_and_wait(chan, listen_next_sound);
 			if (!res) {
 				if (!vms->deleted[vms->curmsg])
-					res = ast_play_and_wait(chan, "vm-delete");
+					res = ast_play_and_wait(chan, listen_delete_sound);
 				else
-					res = ast_play_and_wait(chan, "vm-undelete");
+					res = ast_play_and_wait(chan, listen_undelete_sound);
 				if (!res)
-					res = ast_play_and_wait(chan, "vm-toforward");
+					res = ast_play_and_wait(chan, listen_forward_sound);
 				if (!res)
-					res = ast_play_and_wait(chan, "vm-savemessage");
+					res = ast_play_and_wait(chan, listen_save_sound);
 			}
 		}
 		if (!res)
@@ -5914,9 +6014,9 @@
 		snprintf(prefile,sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username);
 		if (ast_fileexists(prefile, NULL, NULL) < 1) {
 #ifndef IMAP_STORAGE
-			cmd = play_record_review(chan, "vm-rec-name", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
+			cmd = play_record_review(chan, options_rec_name_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
 #else
-			cmd = play_record_review(chan, "vm-rec-name", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
+			cmd = play_record_review(chan, options_rec_name_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
 #endif
 			if (cmd < 0 || cmd == 't' || cmd == '#')
 				return cmd;
@@ -5928,9 +6028,9 @@
 		snprintf(prefile,sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vms->username);
 		if (ast_fileexists(prefile, NULL, NULL) < 1) {
 #ifndef IMAP_STORAGE
-			cmd = play_record_review(chan, "vm-rec-unv", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
+			cmd = play_record_review(chan, options_rec_unavail_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
 #else
-			cmd = play_record_review(chan, "vm-rec-unv", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
+			cmd = play_record_review(chan, options_rec_unavail_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
 #endif
 			if (cmd < 0 || cmd == 't' || cmd == '#')
 				return cmd;
@@ -5939,9 +6039,9 @@
 		snprintf(prefile,sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vms->username);
 		if (ast_fileexists(prefile, NULL, NULL) < 1) {
 #ifndef IMAP_STORAGE
-			cmd = play_record_review(chan, "vm-rec-busy", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
+			cmd = play_record_review(chan, options_rec_busy_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
 #else
-			cmd = play_record_review(chan, "vm-rec-busy", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
+			cmd = play_record_review(chan, options_rec_busy_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
 #endif
 			if (cmd < 0 || cmd == 't' || cmd == '#')
 				return cmd;
@@ -5978,25 +6078,25 @@
 		case '1':
 			snprintf(prefile,sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vms->username);
 #ifndef IMAP_STORAGE
-			cmd = play_record_review(chan,"vm-rec-unv",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
+			cmd = play_record_review(chan,options_rec_unavail_sound,prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
 #else
-			cmd = play_record_review(chan,"vm-rec-unv",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
+			cmd = play_record_review(chan,options_rec_unavail_sound,prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
 #endif
 			break;
 		case '2': 
 			snprintf(prefile,sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vms->username);
 #ifndef IMAP_STORAGE
-			cmd = play_record_review(chan,"vm-rec-busy",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
+			cmd = play_record_review(chan,options_rec_busy_sound,prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
 #else
-			cmd = play_record_review(chan,"vm-rec-busy",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
+			cmd = play_record_review(chan,options_rec_busy_sound,prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
 #endif
 			break;
 		case '3': 
 			snprintf(prefile,sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username);
 #ifndef IMAP_STORAGE
-			cmd = play_record_review(chan,"vm-rec-name",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
+			cmd = play_record_review(chan,options_rec_name_sound,prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
 #else
-			cmd = play_record_review(chan,"vm-rec-name",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
+			cmd = play_record_review(chan,options_rec_name_sound,prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
 #endif
 			break;
 		case '4': 
@@ -6047,7 +6147,7 @@
 			cmd = 't';
 			break;
 		default: 
-			cmd = ast_play_and_wait(chan,"vm-options");
+			cmd = ast_play_and_wait(chan, options_sound);
 			if (!cmd)
 				cmd = ast_waitfordigit(chan,6000);
 			if (!cmd)
@@ -6092,18 +6192,18 @@
 		RETRIEVE(prefile, -1);
 		if (ast_fileexists(prefile, NULL, NULL) <= 0) {
 #ifndef IMAP_STORAGE
-			play_record_review(chan, "vm-rec-temp", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
+			play_record_review(chan, options_rec_temp_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
 #else
-			play_record_review(chan, "vm-rec-temp", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
+			play_record_review(chan, options_rec_temp_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
 #endif
 			cmd = 't';	
 		} else {
 			switch (cmd) {
 			case '1':
 #ifndef IMAP_STORAGE
-				cmd = play_record_review(chan, "vm-rec-temp", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
+				cmd = play_record_review(chan, options_rec_temp_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL);
 #else
-				cmd = play_record_review(chan, "vm-rec-temp", prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
+				cmd = play_record_review(chan, options_rec_temp_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, vms);
 #endif
 				break;
 			case '2':
@@ -6579,7 +6679,7 @@
 		}
 #endif
 	if (play_auto) {
-		cmd = '1';
+		cmd = main_listen_key;
 	} else {
 		cmd = vm_intro(chan, vmu, &vms);
 	}
@@ -6588,17 +6688,16 @@
 	vms.starting = 1;
 	while ((cmd > -1) && (cmd != 't') && (cmd != '#')) {
 		/* Run main menu */
-		switch (cmd) {
-		case '1':
+		/* was switch command */
+		if (cmd == main_listen_key) {
 			vms.curmsg = 0;
-			/* Fall through */
-		case '5':
 			cmd = vm_browse_messages(chan, &vms, vmu);
-			break;
-		case '2': /* Change folders */
+		} else if (cmd == '5') {
+			cmd = vm_browse_messages(chan, &vms, vmu);
+		} else if (cmd == main_folder_key) { /* Change folders */
 			if (useadsi)
 				adsi_folders(chan, 0, "Change to folder...");
-			cmd = get_folder2(chan, "vm-changeto", 0);
+			cmd = get_folder2(chan, main_folder_sound, 0);
 			if (cmd == '#') {
 				cmd = 0;
 			} else if (cmd > 0) {
@@ -6619,13 +6718,12 @@
 				cmd = vm_play_folder_name(chan, vms.vmbox);
 
 			vms.starting = 1;
-			break;
-		case '3': /* Advanced options */
+		} else if (cmd == main_advanced_key) { /* Advanced options */
 			cmd = 0;
 			vms.repeats = 0;
 			while ((cmd > -1) && (cmd != 't') && (cmd != '#')) {
-				switch (cmd) {
-				case '1': /* Reply */
+				/* was switch statement */
+				if (cmd == advanced_reply_key) { /* Reply */
 					if (vms.lastmsg > -1 && !vms.starting) {
 						cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 1, record_gain);
 						if (cmd == ERROR_LOCK_PATH) {
@@ -6635,8 +6733,7 @@
 					} else
 						cmd = ast_play_and_wait(chan, "vm-sorry");
 					cmd = 't';
-					break;
-				case '2': /* Callback */
+				} else if (cmd == advanced_callback_key) { /* Callback */
 					if (option_verbose > 2 && !vms.starting)
 						ast_verbose( VERBOSE_PREFIX_3 "Callback Requested\n");
 					if (!ast_strlen_zero(vmu->callback) && vms.lastmsg > -1 && !vms.starting) {
@@ -6652,8 +6749,7 @@
 					else 
 						cmd = ast_play_and_wait(chan, "vm-sorry");
 					cmd = 't';
-					break;
-				case '3': /* Envelope */
+				} else if (cmd == advanced_envelope_key) { /* Envelope */
 					if (vms.lastmsg > -1 && !vms.starting) {
 						cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 3, record_gain);
 						if (cmd == ERROR_LOCK_PATH) {
@@ -6663,8 +6759,7 @@
 					} else
 						cmd = ast_play_and_wait(chan, "vm-sorry");
 					cmd = 't';
-					break;
-				case '4': /* Dialout */
+				} else if (cmd == advanced_newcall_key) { /* Dialout */
 					if (!ast_strlen_zero(vmu->dialout)) {
 						cmd = dialout(chan, vmu, NULL, vmu->dialout);
 						if (cmd == 9) {
@@ -6675,9 +6770,8 @@
 					else 
 						cmd = ast_play_and_wait(chan, "vm-sorry");
 					cmd = 't';
-					break;
-
-				case '5': /* Leave VoiceMail */
+
+				} else if (cmd == advanced_message_key) {  /* Leave VoiceMail */
 					if (ast_test_flag(vmu, VM_SVMAIL)) {
 						cmd = forward_message(chan, context, &vms, vmu, vmfmts, 1, record_gain);
 						if (cmd == ERROR_LOCK_PATH) {
@@ -6690,26 +6784,25 @@
 					cmd='t';
 					break;
 					
-				case '*': /* Return to main menu */
+				} else if (cmd == '*') { /* Return to main menu */
 					cmd = 't';
-					break;
-
-				default:
+
+				} else {
 					cmd = 0;
 					if (!vms.starting) {
-						cmd = ast_play_and_wait(chan, "vm-toreply");
+						cmd = ast_play_and_wait(chan, advanced_reply_sound);
 					}
 					if (!ast_strlen_zero(vmu->callback) && !vms.starting && !cmd) {
-						cmd = ast_play_and_wait(chan, "vm-tocallback");
+						cmd = ast_play_and_wait(chan, advanced_callback_sound);
 					}
 					if (!cmd && !vms.starting) {
-						cmd = ast_play_and_wait(chan, "vm-tohearenv");
+						cmd = ast_play_and_wait(chan, advanced_envelope_sound);
 					}
 					if (!ast_strlen_zero(vmu->dialout) && !cmd) {
-						cmd = ast_play_and_wait(chan, "vm-tomakecall");
+						cmd = ast_play_and_wait(chan, advanced_newcall_sound);
 					}
 					if (ast_test_flag(vmu, VM_SVMAIL) && !cmd)
-						cmd=ast_play_and_wait(chan, "vm-leavemsg");
+						cmd=ast_play_and_wait(chan, advanced_message_sound);
 					if (!cmd)
 						cmd = ast_play_and_wait(chan, "vm-starmain");
 					if (!cmd)
@@ -6724,24 +6817,21 @@
 				cmd = 0;
 				vms.repeats = 0;
 			}
-			break;
-		case '4':
+		} else if (cmd == listen_previous_key) {
 			if (vms.curmsg > 0) {
 				vms.curmsg--;
 				cmd = play_message(chan, vmu, &vms);
 			} else {
 				cmd = ast_play_and_wait(chan, "vm-nomore");
 			}
-			break;
-		case '6':
+		} else if (cmd == listen_next_key) {
 			if (vms.curmsg < vms.lastmsg) {
 				vms.curmsg++;
 				cmd = play_message(chan, vmu, &vms);
 			} else {
 				cmd = ast_play_and_wait(chan, "vm-nomore");
 			}
-			break;
-		case '7':
+		} else if (cmd == listen_delete_key) {
 			if (vms.curmsg >= 0 && vms.curmsg <= vms.lastmsg) {
 				vms.deleted[vms.curmsg] = !vms.deleted[vms.curmsg];
 				if (useadsi)
@@ -6773,9 +6863,8 @@
 #ifdef IMAP_STORAGE
 			deleted = 1;
 #endif
-			break;
 	
-		case '8':
+		} else if (cmd == listen_forward_key) {
 			if (vms.lastmsg > -1) {
 				cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain);
 				if (cmd == ERROR_LOCK_PATH) {
@@ -6784,8 +6873,7 @@
 				}
 			} else
 				cmd = ast_play_and_wait(chan, "vm-nomore");
-			break;
-		case '9':
+		} else if (cmd == listen_save_key) {
 			if (vms.curmsg < 0 || vms.curmsg > vms.lastmsg) {
 				/* No message selected */
 				cmd = 0;
@@ -6839,26 +6927,23 @@
 				}
 			}
 			break;
-		case '*':
+		} else if (cmd == '*') {
 			if (!vms.starting) {
 				cmd = ast_play_and_wait(chan, "vm-onefor");
 				if (!cmd)
 					cmd = vm_play_folder_name(chan, vms.vmbox);
 				if (!cmd)
-					cmd = ast_play_and_wait(chan, "vm-opts");
+					cmd = ast_play_and_wait(chan, main_sound);
 				if (!cmd)
 					cmd = vm_instructions(chan, &vms, 1);
 			} else
 				cmd = 0;
-			break;
-		case '0':
+		} else if (cmd == main_options_key) {
 			cmd = vm_options(chan, vmu, &vms, vmfmts, record_gain);
 			if (useadsi)
 				adsi_status(chan, &vms);
-			break;
-		default:	/* Nothing */
+		} else { 	/* Nothing */
 			cmd = vm_instructions(chan, &vms, 0);
-			break;
 		}
 	}
 	if ((cmd == 't') || (cmd == '#')) {
@@ -7310,6 +7395,7 @@
 	const char *astforcename;
 	const char *astforcegreet;
 	const char *s;
+	const char *sound, *key;
 	char *q,*stringp;
 	const char *dialoutcxt = NULL;
 	const char *callbackcxt = NULL;	
@@ -7319,6 +7405,50 @@
 	const char *volgainstr;
 	int x;
 	int tmpadsi[4];
+
+	/* set default voicemail prompts */
+	main_options_key = DEFAULT_MAIN_OPTIONS_KEY;
+	main_listen_key = DEFAULT_MAIN_LISTEN_KEY;
+	main_folder_key = DEFAULT_MAIN_FOLDER_KEY;
+	main_advanced_key = DEFAULT_MAIN_ADVANCED_KEY;
+	listen_previous_key = DEFAULT_LISTEN_PREVIOUS_KEY;
+	listen_replay_key = DEFAULT_LISTEN_REPLAY_KEY;
+	listen_next_key = DEFAULT_LISTEN_NEXT_KEY;
+	listen_delete_key = DEFAULT_LISTEN_DELETE_KEY;
+	listen_forward_key = DEFAULT_LISTEN_FORWARD_KEY;
+	listen_save_key = DEFAULT_LISTEN_SAVE_KEY;
+	advanced_reply_key = DEFAULT_ADVANCED_REPLY_KEY;
+	advanced_callback_key = DEFAULT_ADVANCED_CALLBACK_KEY;
+	advanced_envelope_key = DEFAULT_ADVANCED_ENVELOPE_KEY;
+	advanced_newcall_key = DEFAULT_ADVANCED_NEWCALL_KEY;
+	advanced_message_key = DEFAULT_ADVANCED_MESSAGE_KEY;
+	options_rec_unavail_key = DEFAULT_OPTIONS_REC_UNAVAIL_KEY;
+	options_rec_busy_key = DEFAULT_OPTIONS_REC_BUSY_KEY;
+	options_rec_name_key = DEFAULT_OPTIONS_REC_NAME_KEY;
+	options_rec_temp_key = DEFAULT_OPTIONS_REC_TEMP_KEY;
+	options_rec_password_key = DEFAULT_OPTIONS_REC_PASSWORD_KEY;
+
+	strcpy(main_sound, DEFAULT_MAIN_SOUND);
+	strcpy(main_listen_sound, DEFAULT_MAIN_LISTEN_SOUND);
+	strcpy(main_folder_sound, DEFAULT_MAIN_FOLDER_SOUND);
+	strcpy(main_advanced_sound, DEFAULT_MAIN_ADVANCED_SOUND);
+	strcpy(listen_previous_sound, DEFAULT_LISTEN_PREVIOUS_SOUND);
+	strcpy(listen_replay_sound, DEFAULT_LISTEN_REPLAY_SOUND);
+	strcpy(listen_next_sound, DEFAULT_LISTEN_NEXT_SOUND);
+	strcpy(listen_delete_sound, DEFAULT_LISTEN_DELETE_SOUND);
+	strcpy(listen_undelete_sound, DEFAULT_LISTEN_UNDELETE_SOUND);
+	strcpy(listen_forward_sound, DEFAULT_LISTEN_FORWARD_SOUND);
+	strcpy(listen_save_sound, DEFAULT_LISTEN_SAVE_SOUND);
+	strcpy(advanced_reply_sound, DEFAULT_ADVANCED_REPLY_SOUND);
+	strcpy(advanced_callback_sound, DEFAULT_ADVANCED_CALLBACK_SOUND);
+	strcpy(advanced_envelope_sound, DEFAULT_ADVANCED_ENVELOPE_SOUND);
+	strcpy(advanced_newcall_sound, DEFAULT_ADVANCED_NEWCALL_SOUND);
+	strcpy(advanced_message_sound, DEFAULT_ADVANCED_MESSAGE_SOUND);
+	strcpy(options_sound, DEFAULT_OPTIONS_SOUND);
+	strcpy(options_rec_unavail_sound, DEFAULT_OPTIONS_REC_UNAVAIL_SOUND);
+	strcpy(options_rec_busy_sound, DEFAULT_OPTIONS_REC_BUSY_SOUND);
+	strcpy(options_rec_name_sound, DEFAULT_OPTIONS_REC_NAME_SOUND);
+	strcpy(options_rec_temp_sound, DEFAULT_OPTIONS_REC_TEMP_SOUND);
 
 	cfg = ast_config_load(VOICEMAIL_CONFIG);
 
@@ -7646,6 +7776,91 @@
 		} else {
 			exitcontext[0] = '\0';
 		}
+
+		/* load configurable prompts */
+		if ((sound = ast_variable_retrieve(cfg, "general", "main-sound")))
+			ast_copy_string(main_sound, sound, sizeof(main_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "main-listen-sound")))
+			ast_copy_string(main_listen_sound, sound, sizeof(main_listen_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "main-folder-sound")))
+			ast_copy_string(main_folder_sound, sound, sizeof(main_folder_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "main-advanced-sound")))
+			ast_copy_string(main_advanced_sound, sound, sizeof(main_advanced_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "listen-previous-sound")))
+			ast_copy_string(listen_previous_sound, sound, sizeof(listen_previous_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "listen-replay-sound")))
+			ast_copy_string(listen_replay_sound, sound, sizeof(listen_replay_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "listen-next-sound")))
+			ast_copy_string(listen_next_sound, sound, sizeof(listen_next_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "listen-delete-sound")))
+			ast_copy_string(listen_delete_sound, sound, sizeof(listen_delete_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "listen-undelete-sound")))
+			ast_copy_string(listen_undelete_sound, sound, sizeof(listen_undelete_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "listen-forward-sound")))
+			ast_copy_string(listen_forward_sound, sound, sizeof(listen_forward_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "listen-save-sound")))
+			ast_copy_string(listen_save_sound, sound, sizeof(listen_save_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "advanced-reply-sound")))
+			ast_copy_string(advanced_reply_sound, sound, sizeof(advanced_reply_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "advanced-callback-sound")))
+			ast_copy_string(advanced_callback_sound, sound, sizeof(advanced_callback_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "advanced-envelope-sound")))
+			ast_copy_string(advanced_envelope_sound, sound, sizeof(advanced_envelope_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "advanced-newcall-sound")))
+			ast_copy_string(advanced_newcall_sound, sound, sizeof(advanced_newcall_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "advanced-message-sound")))
+			ast_copy_string(advanced_message_sound, sound, sizeof(advanced_message_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "options-sound")))
+			ast_copy_string(options_sound, sound, sizeof(options_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "options-rec-unavail-sound")))
+			ast_copy_string(options_rec_unavail_sound, sound, sizeof(options_rec_unavail_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "options-rec-busy-sound")))
+			ast_copy_string(options_rec_busy_sound, sound, sizeof(options_rec_busy_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "options-rec-name-sound")))
+			ast_copy_string(options_rec_name_sound, sound, sizeof(options_rec_name_sound));
+		if ((sound = ast_variable_retrieve(cfg, "general", "options-rec-temp-sound")))
+			ast_copy_string(options_rec_temp_sound, sound, sizeof(options_rec_temp_sound));
+		if ((key = ast_variable_retrieve(cfg, "general", "main-options-key")))
+			main_options_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "main-listen-key")))
+			main_listen_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "main-folder-key")))
+			main_folder_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "main-advanced-key")))
+			main_advanced_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "listen-previous-key")))
+			listen_previous_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "listen-replay-key")))
+			listen_replay_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "listen-next-key")))
+			listen_next_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "listen-delete-key")))
+			listen_delete_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "listen-forward-key")))
+			listen_forward_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "listen-save-key")))
+			listen_save_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "advanced-reply-key")))
+			advanced_reply_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "advanced-callback-key")))
+			advanced_callback_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "advanced-envelope-key")))
+			advanced_envelope_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "advanced-newcall-key")))
+			advanced_newcall_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "advanced-message-key")))
+			advanced_message_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "options-rec-unavail-key")))
+			options_rec_unavail_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "options-rec-busy-key")))
+			options_rec_busy_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "options-rec-name-key")))
+			options_rec_name_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "options-rec-temp-key")))
+			options_rec_temp_key = key[0];
+		if ((key = ast_variable_retrieve(cfg, "general", "options-rec-password-key")))
+			options_rec_password_key = key[0];
+		/* end configurable prompts */
 
 		if (!(astdirfwd = ast_variable_retrieve(cfg, "general", "usedirectory"))) 
 			astdirfwd = "no";
@@ -8010,20 +8225,16 @@
 	if (!strncasecmp("macro",context,5)) /* Macro names in contexts are useless for our needs */
 		context = ast_variable_retrieve(msg_cfg, "message","macrocontext");
 #endif
-	switch (option) {
-	case 3:
+	/* Check options - was switch statement */
+	if (option == advanced_envelope_key) {  /* Envelope */
 		if (!res)
 			res = play_message_datetime(chan, vmu, origtime, filename);
 		if (!res)
 			res = play_message_callerid(chan, vms, cid, context, 0);
 
 		res = 't';
-		break;
-
-	case 2:	/* Call back */
-
-		if (ast_strlen_zero(cid))
-			break;
+
+	} else if (option == advanced_callback_key && !ast_strlen_zero(cid)) { /* Call back */
 
 		ast_callerid_parse(cid, &name, &num);
 		while ((res > -1) && (res != 't')) {
@@ -8079,7 +8290,7 @@
 					if (!res)
 						res = play_message_callerid(chan, vms, num, vmu->context, 1);
 					if (!res)
-						res = ast_play_and_wait(chan, "vm-tocallnum");
+						res = ast_play_and_wait(chan, advanced_callback_sound);
 					/* Only prompt for a caller-specified number if there is a dialout context specified */
 					if (!ast_strlen_zero(vmu->dialout)) {
 						if (!res)
@@ -8109,13 +8320,8 @@
 			else if (res == '*')
 				res = -1;
 		}
-		break;
 		
-	case 1:	/* Reply */
-		/* Send reply directly to sender */
-		if (ast_strlen_zero(cid))
-			break;
-
+	} else if (option == advanced_reply_key && !ast_strlen_zero(cid)) { /* Reply */
 		ast_callerid_parse(cid, &name, &num);
 		if (!num) {
 			if (option_verbose > 2)
@@ -8153,7 +8359,6 @@
 		} 
 		res = 0;
 
-		break;
 	}
 
 #ifndef IMAP_STORAGE

Modified: team/group/upenn/configs/voicemail.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/upenn/configs/voicemail.conf.sample?view=diff&rev=89605&r1=89604&r2=89605
==============================================================================
--- team/group/upenn/configs/voicemail.conf.sample (original)
+++ team/group/upenn/configs/voicemail.conf.sample Mon Nov 26 12:26:30 2007
@@ -213,6 +213,51 @@
 			;     The default is "no".
 ;tempgreetwarn=yes	; Remind the user that their temporary greeting is set
 
+; main-sound="vm-opts" 	; This plays the entire main menu 
+; main-options-key=0	; options key, default is 0
+; main-listen-key=1 	; listen key, default is 1
+; main-listen-sound="vm-messages" 
+; main-folder-key=2 	; change folders key, default is 2
+; main-folder-sound="vm-changeto" 
+; main-advanced-key=3 	; advanced options key, default is 3
+; main-advanced-sound="vm-advopts" 
+
+; listen-previous-key=4 	; play previous message key, default is 4
+; listen-previous-sound="vm-prev" 
+; listen-replay-key=5 	; replay message key, default is 5
+; listen-replay-sound="vm-repeat" 
+; listen-next-key=6 	; play next message key, default is 6
+; listen-next-sound="vm-next" 
+; listen-delete-key=7 	; delete message key, default is 7
+; listen-delete-sound="vm-delete" 
+; listen-undelete-sound="vm-undelete" 
+; ; listen-forward-key=8	; forward message key, default is 8
+; listen-forward-sound="vm-toforward" 
+; listen-save-key=9 	; save message key, default is 9
+; listen-save-sound="vm-savemessage" 
+
+; advanced-reply-key=1 	; reply to message key, default is 1
+; advanced-reply-sound="vm-toreply" 
+; advanced-callback-key=2	; call back sender key, default is 2
+; advanced-callback-sound="vm-tocallback"
+; advanced-envelope-key=3	; listen to envelope key, default is 3
+; advanced-envelope-sound="vm-tohearenv" 
+; advanced-newcall-key=4	; make new call key, default is 4
+; advanced-newcall-sound="vm-tomakecall" 
+; advanced-message-key=5	; leave a message key, default is 5
+; advanced-message-sound="vm-leavemsg" 
+
+; options-sound="vm-options"	; This plays the entire options menu (1-5) 
+; options-rec-unavail-key=1	; unavailable recording key, default is 1
+; options-rec-unavail-sound="vm-rec-unv" 
+; options-rec-busy-key=2 	; busy recording key, default is 2
+; options-rec-busy-sound="vm-rec-busy" 
+; options-rec-name-key=3 	; name recording key, default is 3
+; options-rec-name-sound="vm-rec-name" 
+; options-rec-temp-key=4 	; temp greeting recording key, default is 4
+; options-rec-temp-sound="vm-rec-temp" 
+; options-rec-password-key=5 	; password recording key, default is 5
+
 [zonemessages]
 eastern=America/New_York|'vm-received' Q 'digits/at' IMp
 central=America/Chicago|'vm-received' Q 'digits/at' IMp




More information about the svn-commits mailing list