Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 58026) +++ apps/app_voicemail.c (working copy) @@ -168,6 +168,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" @@ -528,6 +578,56 @@ 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]; + /* custom password sounds */ static char vm_password[80] = "vm-password"; static char vm_newpassword[80] = "vm-newpassword"; @@ -5740,25 +5858,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) @@ -5836,7 +5954,7 @@ if (ast_test_flag(vmu, VM_FORCENAME)) { snprintf(prefile,sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username); if (ast_fileexists(prefile, NULL, NULL) < 1) { - 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); if (cmd < 0 || cmd == 't' || cmd == '#') return cmd; } @@ -5846,14 +5964,14 @@ if (ast_test_flag(vmu, VM_FORCEGREET)) { snprintf(prefile,sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vms->username); if (ast_fileexists(prefile, NULL, NULL) < 1) { - 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); if (cmd < 0 || cmd == 't' || cmd == '#') return cmd; } snprintf(prefile,sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vms->username); if (ast_fileexists(prefile, NULL, NULL) < 1) { - 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); if (cmd < 0 || cmd == 't' || cmd == '#') return cmd; } @@ -5885,23 +6003,19 @@ while ((cmd >= 0) && (cmd != 't')) { if (cmd) retries = 0; - switch (cmd) { - case '1': + /* was switch statement */ + if (cmd == options_rec_unavail_key) { snprintf(prefile,sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, vms->username); - cmd = play_record_review(chan,"vm-rec-unv",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL); - break; - case '2': + cmd = play_record_review(chan, options_rec_unavail_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL); + } else if (cmd == options_rec_busy_key) { snprintf(prefile,sizeof(prefile), "%s%s/%s/busy", VM_SPOOL_DIR, vmu->context, vms->username); - cmd = play_record_review(chan,"vm-rec-busy",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL); - break; - case '3': + cmd = play_record_review(chan, options_rec_busy_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL); + } else if (cmd == options_rec_name_key) { snprintf(prefile,sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username); - cmd = play_record_review(chan,"vm-rec-name",prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL); - break; - case '4': + cmd = play_record_review(chan,options_rec_name_sound, prefile, maxgreet, fmtc, 0, vmu, &duration, NULL, record_gain, NULL); + } else if (cmd == options_rec_temp_key) { cmd = vm_tempgreeting(chan, vmu, vms, fmtc, record_gain); - break; - case '5': + } else if (cmd == options_rec_password_key) { if (vmu->password[0] == '-') { cmd = ast_play_and_wait(chan, "vm-no"); break; @@ -5942,12 +6056,10 @@ if (option_debug) ast_log(LOG_DEBUG,"User %s set password to %s of length %d\n",vms->username,newpassword,(int)strlen(newpassword)); cmd = ast_play_and_wait(chan, vm_passchanged); - break; - case '*': + } else if (cmd == '*') { cmd = 't'; - break; - default: - cmd = ast_play_and_wait(chan,"vm-options"); + } else { + cmd = ast_play_and_wait(chan, options_sound); if (!cmd) cmd = ast_waitfordigit(chan,6000); if (!cmd) @@ -5991,12 +6103,12 @@ retries = 0; RETRIEVE(prefile, -1); if (ast_fileexists(prefile, NULL, NULL) <= 0) { - 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); cmd = 't'; } else { switch (cmd) { case '1': - 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); break; case '2': DELETE(prefile, -1, prefile); @@ -6470,7 +6582,7 @@ } #endif if (play_auto) { - cmd = '1'; + cmd = main_listen_key; } else { cmd = vm_intro(chan, vmu, &vms); } @@ -6479,17 +6591,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) { @@ -6509,13 +6620,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) { @@ -6525,8 +6635,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) { @@ -6542,8 +6651,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) { @@ -6553,8 +6661,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) { @@ -6565,9 +6672,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) { @@ -6580,26 +6686,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) @@ -6614,24 +6719,21 @@ cmd = 0; vms.repeats = 0; } - break; - case '4': + } else if (cmd == listen_previous_key) { if (vms.curmsg) { 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) { vms.deleted[vms.curmsg] = !vms.deleted[vms.curmsg]; if (useadsi) adsi_delete(chan, &vms); @@ -6650,9 +6752,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) { @@ -6661,8 +6762,7 @@ } } else cmd = ast_play_and_wait(chan, "vm-nomore"); - break; - case '9': + } else if (cmd == listen_save_key) { if (useadsi) adsi_folders(chan, 1, "Save to folder..."); cmd = get_folder2(chan, "vm-savefolder", 1); @@ -6711,26 +6811,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 == '#')) { @@ -7178,6 +7275,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; @@ -7193,6 +7291,50 @@ 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); AST_LIST_LOCK(&users); @@ -7561,6 +7703,91 @@ if ((vm_mism = ast_variable_retrieve(cfg, "general", "vm-mismatch"))) ast_copy_string(vm_mismatch, vm_mism, sizeof(vm_mismatch)); + /* 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"; ast_set2_flag((&globalflags), ast_true(astdirfwd), VM_DIRECFORWARD); @@ -7921,21 +8148,17 @@ 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 */ + } else if (option == advanced_callback_key && !ast_strlen_zero(cid)) { /* Call back */ - if (ast_strlen_zero(cid)) - break; - ast_callerid_parse(cid, &name, &num); while ((res > -1) && (res != 't')) { switch (res) { @@ -7990,7 +8213,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) @@ -8020,13 +8243,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) @@ -8063,7 +8281,6 @@ } res = 0; - break; } #ifndef IMAP_STORAGE Index: configs/voicemail.conf.sample =================================================================== --- configs/voicemail.conf.sample (revision 58026) +++ configs/voicemail.conf.sample (working copy) @@ -236,6 +236,51 @@ ; prompt that says: "The passwords you entered and re-entered ; did not match. Please try again." +; 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