Add the ability to customize some of the prompts used within the voicemail
authorRussell Bryant <russell@russellbryant.com>
Fri, 27 Oct 2006 16:47:44 +0000 (16:47 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 27 Oct 2006 16:47:44 +0000 (16:47 +0000)
application by configuring them in voicemail.conf (issue #7415, patch by
fkasumovic, with some fixes and documentation updates by myself)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46360 65c4cc65-6c06-0410-ace0-fbb531ad65f3

CHANGES
apps/app_voicemail.c
configs/voicemail.conf.sample

diff --git a/CHANGES b/CHANGES
index 7d6b936..b9c51c0 100644 (file)
--- 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
index 587f730..4aadb91 100644 (file)
@@ -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";
index 27c3642..c9d16f2 100644 (file)
@@ -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