aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/app_voicemail.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 6e9b2df07..097ccfcc1 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -11692,6 +11692,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
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 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
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 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
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 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
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 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
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 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
}
}
}
+ 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 */