[asterisk-commits] jrose: trunk r345120 - in /trunk: ./ apps/app_voicemail.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 14 10:21:10 CST 2011
Author: jrose
Date: Mon Nov 14 10:21:06 2011
New Revision: 345120
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=345120
Log:
Moves voicemail setup password entry to the end of the setup process.
This change was made because forcegreeting and forcename settings in voicemail could be
circumvented by hanging up after entering a password, because the only way voicemail
currently observes whether a mailbox is new or not is by checking to see if the password
is the same as the mailbox number or not.
(closes issue ASTERISK-18282)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/1581/
........
Merged revisions 345062 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 345117 from http://svn.asterisk.org/svn/asterisk/branches/10
Modified:
trunk/ (props changed)
trunk/apps/app_voicemail.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.
Modified: trunk/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=345120&r1=345119&r2=345120
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Mon Nov 14 10:21:06 2011
@@ -9193,8 +9193,37 @@
ast_adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DISPLAY);
}
- /* First, have the user change their password
- so they won't get here again */
+ /* If forcename is set, have the user record their name */
+ 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, NULL, record_gain, vms, NULL);
+ if (cmd < 0 || cmd == 't' || cmd == '#')
+ return cmd;
+ }
+ }
+
+ /* If forcegreetings is set, have the user record their greetings */
+ 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, NULL, record_gain, vms, 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, NULL, record_gain, vms, NULL);
+ if (cmd < 0 || cmd == 't' || cmd == '#')
+ return cmd;
+ }
+ }
+
+ /*
+ * Change the password last since new users will be able to skip over any steps this one comes before
+ * by hanging up and calling back to voicemail main since the password is used to verify new user status.
+ */
for (;;) {
newpassword[1] = '\0';
newpassword[0] = cmd = ast_play_and_wait(chan, vm_newpassword);
@@ -9237,33 +9266,6 @@
ast_debug(1, "User %s set password to %s of length %d\n", vms->username, newpassword, (int) strlen(newpassword));
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)) {
- 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, NULL, record_gain, vms, NULL);
- if (cmd < 0 || cmd == 't' || cmd == '#')
- return cmd;
- }
- }
-
- /* If forcegreetings is set, have the user record their greetings */
- 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, NULL, record_gain, vms, 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, NULL, record_gain, vms, NULL);
- if (cmd < 0 || cmd == 't' || cmd == '#')
- return cmd;
- }
- }
return cmd;
}
More information about the asterisk-commits
mailing list