aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-16 13:36:35 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-16 13:36:35 +0000
commit4b5e35ce78177f734e59b8d9fab21de394ad933f (patch)
treeddae7103f7c93142062d137e17c3583602fe4c51 /apps
parent6667d98bfdaaedab6f71ce6aba26da6fd5da3403 (diff)
clean up message duration writing code (bug #4285)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5698 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_voicemail.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 0586a56ee..fc3a18cf6 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1988,7 +1988,6 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
FILE *txt;
int res = 0;
int msgnum;
- int fd;
int duration = 0;
int ausemacro = 0;
int ousemacro = 0;
@@ -2192,24 +2191,22 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
chan->name,
ast_callerid_merge(callerid, sizeof(callerid), chan->cid.cid_name, chan->cid.cid_num, "Unknown"),
date, (long)time(NULL),
- category ? category : "");
- fclose(txt);
+ category ? category : "");
} else
ast_log(LOG_WARNING, "Error opening text file for output\n");
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;
+ }
if (res > 0)
res = 0;
- fd = open(txtfile, O_APPEND | O_WRONLY);
- if (fd > -1) {
- txt = fdopen(fd, "a");
- if (txt) {
- fprintf(txt, "duration=%d\n", duration);
- fclose(txt);
- } else
- close(fd);
+ if (txt) {
+ fprintf(txt, "duration=%d\n", duration);
+ fclose(txt);
}
+
if (duration < vmminmessage) {
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);