mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-25 14:06:27 +00:00
Don't write duration if file disappears (bug #1102 -- thanks hmodes)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2275 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1338,6 +1338,7 @@ 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;
|
||||||
char date[256];
|
char date[256];
|
||||||
char dir[256];
|
char dir[256];
|
||||||
char fn[256];
|
char fn[256];
|
||||||
@@ -1473,11 +1474,15 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
|
|||||||
res = play_and_record(chan, NULL, fn, vmmaxmessage, fmt);
|
res = play_and_record(chan, NULL, fn, vmmaxmessage, fmt);
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
res = 0;
|
res = 0;
|
||||||
txt = fopen(txtfile, "a");
|
fd = open(txtfile, O_APPEND | O_WRONLY);
|
||||||
if (txt) {
|
if (fd > -1) {
|
||||||
time(&end);
|
txt = fdopen(fd, "a");
|
||||||
fprintf(txt, "duration=%ld\n", (long)(end-start));
|
if (txt) {
|
||||||
fclose(txt);
|
time(&end);
|
||||||
|
fprintf(txt, "duration=%ld\n", (long)(end-start));
|
||||||
|
fclose(txt);
|
||||||
|
} else
|
||||||
|
close(fd);
|
||||||
}
|
}
|
||||||
stringp = fmt;
|
stringp = fmt;
|
||||||
strsep(&stringp, "|");
|
strsep(&stringp, "|");
|
||||||
|
|||||||
Reference in New Issue
Block a user