From 119d9592741bbbc7d6a47cfaa3c1258713f928c5 Mon Sep 17 00:00:00 2001 From: russell Date: Fri, 27 Oct 2006 16:47:44 +0000 Subject: Add the ability to customize some of the prompts used within the voicemail application by configuring them in voicemail.conf (issue #7415, patch by fkasumovic, with some fixes and documentation updates by myself) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46360 f38db490-d61c-443f-a65b-d21fe96a405b --- CHANGES | 6 ++++-- apps/app_voicemail.c | 42 +++++++++++++++++++++++++++++++++--------- configs/voicemail.conf.sample | 20 +++++++++++++++++++- 3 files changed, 56 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 7d6b9366b..b9c51c02b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,9 @@ Changes since Asterisk 1.4-beta was branched: - * rev.45982: enable https support for builtin web server. + * Added the ability to customize which sound files are used for some of the + prompts within the Voicemail application by changing them in voicemail.conf + * enable https support for builtin web server. See configs/http.conf.sample for details. - * rev.45945: add a new option, match_auth_username, to sip.conf, + * add a new option, match_auth_username, to sip.conf, to improve the matching of incoming requests. If set, and the incoming request carries authentication info, the username to match in the users list is taken from there diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 587f7308b..4aadb911b 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -506,6 +506,13 @@ static int maxgreet; static int skipms; static int maxlogins; +/* cutom password sounds */ +static char vm_password[80] = "vm-password"; +static char vm_newpassword[80] = "vm-newpassword"; +static char vm_passchanged[80] = "vm-passchanged"; +static char vm_reenterpassword[80] = "vm-reenterpassword"; +static char vm_mismatch[80] = "vm-mismatch"; + static struct ast_flags globalflags = {0}; static int saydurationminfo; @@ -5471,7 +5478,7 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct so they won't get here again */ for (;;) { newpassword[1] = '\0'; - newpassword[0] = cmd = ast_play_and_wait(chan,"vm-newpassword"); + newpassword[0] = cmd = ast_play_and_wait(chan, vm_newpassword); if (cmd == '#') newpassword[0] = '\0'; if (cmd < 0 || cmd == 't' || cmd == '#') @@ -5480,7 +5487,7 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct if (cmd < 0 || cmd == 't' || cmd == '#') return cmd; newpassword2[1] = '\0'; - newpassword2[0] = cmd = ast_play_and_wait(chan,"vm-reenterpassword"); + newpassword2[0] = cmd = ast_play_and_wait(chan, vm_reenterpassword); if (cmd == '#') newpassword2[0] = '\0'; if (cmd < 0 || cmd == 't' || cmd == '#') @@ -5491,7 +5498,7 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct if (!strcmp(newpassword, newpassword2)) break; ast_log(LOG_NOTICE,"Password mismatch for user %s (%s != %s)\n", vms->username, newpassword, newpassword2); - cmd = ast_play_and_wait(chan, "vm-mismatch"); + cmd = ast_play_and_wait(chan, vm_mismatch); if (++tries == 3) return -1; } @@ -5501,7 +5508,7 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_change_password_shell(vmu,newpassword); 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"); + cmd = ast_play_and_wait(chan, vm_passchanged); /* If forcename is set, have the user record their name */ if (ast_test_flag(vmu, VM_FORCENAME)) { @@ -5571,7 +5578,7 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct break; } newpassword[1] = '\0'; - newpassword[0] = cmd = ast_play_and_wait(chan,"vm-newpassword"); + newpassword[0] = cmd = ast_play_and_wait(chan, vm_newpassword); if (cmd == '#') newpassword[0] = '\0'; else { @@ -5582,7 +5589,7 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct } } newpassword2[1] = '\0'; - newpassword2[0] = cmd = ast_play_and_wait(chan,"vm-reenterpassword"); + newpassword2[0] = cmd = ast_play_and_wait(chan, vm_reenterpassword); if (cmd == '#') newpassword2[0] = '\0'; else { @@ -5595,7 +5602,7 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct } if (strcmp(newpassword, newpassword2)) { ast_log(LOG_NOTICE,"Password mismatch for user %s (%s != %s)\n", vms->username, newpassword, newpassword2); - cmd = ast_play_and_wait(chan, "vm-mismatch"); + cmd = ast_play_and_wait(chan, vm_mismatch); break; } if (ast_strlen_zero(ext_pass_cmd)) @@ -5604,7 +5611,7 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_change_password_shell(vmu,newpassword); 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"); + cmd = ast_play_and_wait(chan, vm_passchanged); break; case '*': cmd = 't'; @@ -5854,7 +5861,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_ /* saved password is blank, so don't bother asking */ password[0] = '\0'; } else { - if (ast_streamfile(chan, "vm-password", chan->language)) { + if (ast_streamfile(chan, vm_password, chan->language)) { ast_log(LOG_WARNING, "Unable to stream password file\n"); return -1; } @@ -6844,6 +6851,11 @@ static int load_config(void) const char *extpc; const char *emaildateformatstr; const char *volgainstr; + const char *vm_paswd; + const char *vm_newpasswd; + const char *vm_passchange; + const char *vm_reenterpass; + const char *vm_mism; int x; int tmpadsi[4]; @@ -7167,6 +7179,18 @@ static int load_config(void) } else { exitcontext[0] = '\0'; } + + /* load password sounds configuration */ + if ((vm_paswd = ast_variable_retrieve(cfg, "general", "vm-password"))) + ast_copy_string(vm_password, vm_paswd, sizeof(vm_password)); + if ((vm_newpasswd = ast_variable_retrieve(cfg, "general", "vm-newpassword"))) + ast_copy_string(vm_newpassword, vm_newpasswd, sizeof(vm_newpassword)); + if ((vm_passchange = ast_variable_retrieve(cfg, "general", "vm-passchanged"))) + ast_copy_string(vm_passchanged, vm_passchange, sizeof(vm_passchanged)); + if ((vm_reenterpass = ast_variable_retrieve(cfg, "general", "vm-reenterpassword"))) + ast_copy_string(vm_reenterpassword, vm_reenterpass, sizeof(vm_reenterpassword)); + if ((vm_mism = ast_variable_retrieve(cfg, "general", "vm-mismatch"))) + ast_copy_string(vm_mismatch, vm_mism, sizeof(vm_mismatch)); if (!(astdirfwd = ast_variable_retrieve(cfg, "general", "usedirectory"))) astdirfwd = "no"; diff --git a/configs/voicemail.conf.sample b/configs/voicemail.conf.sample index 27c364246..c9d16f21d 100644 --- a/configs/voicemail.conf.sample +++ b/configs/voicemail.conf.sample @@ -203,7 +203,25 @@ sendvoicemail=yes ; Context to Send voicemail from [option 5 from the advanced m ; greetings. The default is "no". ; hidefromdir=yes ; Hide this mailbox from the directory produced by app_directory ; The default is "no". -;tempgreetwarn=yes ; Remind the user that their temporary greeting is set +; tempgreetwarn=yes ; Remind the user that their temporary greeting is set +; vm-password=custom_sound + ; Customize which sound file is used instead of the default + ; prompt that says: "password" +; vm-newpassword=custom_sound + ; Customize which sound file is used instead of the default + ; prompt that says: "Please enter your new password followed by + ; the pound key." +; vm-passchanged=custom_sound + ; Customize which sound file is used instead of the default + ; prompt that says: "Your password has been changed." +; vm-reenterpassword=custom_sound + ; Customize which sound file is used instead of the default + ; prompt that says: "Please re-enter your password followed by + ; the pound key" +; vm-mismatch=custom_sound + ; Customize which sound file is used instead of the default + ; prompt that says: "The passwords you entered and re-entered + ; did not match. Please try again." [zonemessages] eastern=America/New_York|'vm-received' Q 'digits/at' IMp -- cgit v1.2.3