clean up message duration writing code (bug #4285)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
0dc3f6ee76
commit
1eecc81838
1 changed files with 9 additions and 12 deletions
|
@ -1988,7 +1988,6 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
|
||||||
FILE *txt;
|
FILE *txt;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
int msgnum;
|
int msgnum;
|
||||||
int fd;
|
|
||||||
int duration = 0;
|
int duration = 0;
|
||||||
int ausemacro = 0;
|
int ausemacro = 0;
|
||||||
int ousemacro = 0;
|
int ousemacro = 0;
|
||||||
|
@ -2193,23 +2192,21 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
|
||||||
ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
|
ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
|
||||||
date, (long)time(NULL),
|
date, (long)time(NULL),
|
||||||
category ? category : "");
|
category ? category : "");
|
||||||
fclose(txt);
|
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Error opening text file for output\n");
|
ast_log(LOG_WARNING, "Error opening text file for output\n");
|
||||||
res = play_record_review(chan, NULL, fn, vmmaxmessage, fmt, 1, vmu, &duration, dir);
|
res = play_record_review(chan, NULL, fn, vmmaxmessage, fmt, 1, vmu, &duration, dir);
|
||||||
if (res == '0')
|
if (res == '0') {
|
||||||
|
if (txt)
|
||||||
|
fclose(txt);
|
||||||
goto transfer;
|
goto transfer;
|
||||||
|
}
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
res = 0;
|
res = 0;
|
||||||
fd = open(txtfile, O_APPEND | O_WRONLY);
|
if (txt) {
|
||||||
if (fd > -1) {
|
fprintf(txt, "duration=%d\n", duration);
|
||||||
txt = fdopen(fd, "a");
|
fclose(txt);
|
||||||
if (txt) {
|
|
||||||
fprintf(txt, "duration=%d\n", duration);
|
|
||||||
fclose(txt);
|
|
||||||
} else
|
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duration < vmminmessage) {
|
if (duration < vmminmessage) {
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminmessage);
|
ast_verbose( VERBOSE_PREFIX_3 "Recording was %d seconds long but needs to be at least %d - abandoning\n", duration, vmminmessage);
|
||||||
|
|
Loading…
Reference in a new issue