]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
fix recording of voicemail duration (bug #4288)
authorRussell Bryant <russell@russellbryant.com>
Tue, 31 May 2005 13:08:45 +0000 (13:08 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 31 May 2005 13:08:45 +0000 (13:08 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@5804 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index 659f0fdc6b1cd4dcde068893270ffb8411e4a3fa..afe34b41c597bac47e1c7ae9e701ab8fc051e536 100755 (executable)
@@ -1301,7 +1301,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;
@@ -1488,22 +1487,19 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
        chan->name,
        chan->callerid ? chan->callerid : "Unknown",
        date, (long)time(NULL));
-                                       fclose(txt);
                                } 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)