mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-27 06:31:54 +00:00
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@292223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -9384,6 +9384,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 */
|
||||
|
||||
@@ -9448,6 +9449,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) {
|
||||
@@ -9514,7 +9519,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;
|
||||
}
|
||||
@@ -9523,11 +9528,12 @@ 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 {
|
||||
ast_play_and_wait(chan, "vm-deleted");
|
||||
DELETE(recordfile, -1, recordfile, vmu);
|
||||
DELETE(tempfile, -1, tempfile, vmu);
|
||||
cmd = '0';
|
||||
}
|
||||
}
|
||||
@@ -9540,8 +9546,7 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
|
||||
return cmd;
|
||||
if (message_exists) {
|
||||
cmd = ast_play_and_wait(chan, "vm-review");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
cmd = ast_play_and_wait(chan, "vm-torerecord");
|
||||
if (!cmd)
|
||||
cmd = ast_waitfordigit(chan, 600);
|
||||
@@ -9566,6 +9571,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 */
|
||||
|
||||
Reference in New Issue
Block a user