[asterisk-commits] jpeeler: branch 1.6.2 r292226 - in /branches/1.6.2: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 18 16:54:40 CDT 2010


Author: jpeeler
Date: Mon Oct 18 16:54:38 2010
New Revision: 292226

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=292226
Log:
Merged revisions 292223 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r292223 | jpeeler | 2010-10-18 16:50:30 -0500 (Mon, 18 Oct 2010) | 11 lines
  
  Fix improper operator key acceptance and clean up temp recording files.
  
  This is a fix for when pressing the operator key after recording an unavailable,
  busy, name, or temporary message in mailbox options. The operator key should not
  be accepted here, but should be allowed during the message recording. If the
  operator key is pressed during ensure the file is saved or deleted as
  apporopriate.  Also, ensure removal of temporary recorded files after an early
  hang up or when message acceptance confirmation times out.
  
  ABE-2518
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/apps/app_voicemail.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: branches/1.6.2/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/apps/app_voicemail.c?view=diff&rev=292226&r1=292225&r2=292226
==============================================================================
--- branches/1.6.2/apps/app_voicemail.c (original)
+++ branches/1.6.2/apps/app_voicemail.c Mon Oct 18 16:54:38 2010
@@ -11692,6 +11692,7 @@
 	char tempfile[PATH_MAX];
 	char *acceptdtmf = "#";
 	char *canceldtmf = "";
+	int canceleddtmf = 0;
 
 	/* Note that urgent and private are for flagging messages as such in the future */
 
@@ -11753,6 +11754,10 @@
 			if (ast_test_flag(vmu, VM_OPERATOR))
 				canceldtmf = "0";
 			cmd = ast_play_and_record_full(chan, playfile, tempfile, maxtime, fmt, duration, silencethreshold, maxsilence, unlockdir, acceptdtmf, canceldtmf);
+			if (strchr(canceldtmf, cmd)) {
+			/* need this flag here to distinguish between pressing '0' during message recording or after */
+				canceleddtmf = 1;
+			}
 			if (record_gain)
 				ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
 			if (cmd == -1) {
@@ -11832,7 +11837,7 @@
 				return 1;
 #endif
 		case '0':
-			if (!ast_test_flag(vmu, VM_OPERATOR) || !outsidecaller) {
+			if (!ast_test_flag(vmu, VM_OPERATOR) || (!canceleddtmf && !outsidecaller)) {
 				cmd = ast_play_and_wait(chan, "vm-sorry");
 				break;
 			}
@@ -11841,6 +11846,7 @@
 				if (!cmd)
 					cmd = ast_waitfordigit(chan, 3000);
 				if (cmd == '1') {
+					ast_filerename(tempfile, recordfile, NULL);
 					ast_play_and_wait(chan, "vm-msgsaved");
 					cmd = '0';
 				} else if (cmd == '4') {
@@ -11852,7 +11858,7 @@
 					cmd = '0';
 				} else {
 					ast_play_and_wait(chan, "vm-deleted");
-					DELETE(recordfile, -1, recordfile, vmu);
+					DELETE(tempfile, -1, tempfile, vmu);
 					cmd = '0';
 				}
 			}
@@ -11897,6 +11903,10 @@
 			}
 		}
 	}
+	if (!outsidecaller && (cmd == -1 || cmd == 't')) {
+		/* Hang up or timeout, so delete the recording. */
+		ast_filedelete(tempfile, NULL);
+	}
 	if (cmd == 't')
 		cmd = 0;
 	else if (outsidecaller) /* won't play if time out occurs */




More information about the asterisk-commits mailing list