]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge script <automerge@asterisk.org>
Mon, 19 Jun 2006 19:04:53 +0000 (19:04 +0000)
committerAutomerge script <automerge@asterisk.org>
Mon, 19 Jun 2006 19:04:53 +0000 (19:04 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@34909 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index 42ccef3c6d877f7ab566c0e0f8456562d324664e..32e9f849e1f8adae33060c3b4b8d55d751dd0cd2 100644 (file)
@@ -2601,6 +2601,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                        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);
+                               fclose(txt);
                                ast_filedelete(tmptxtfile, NULL);
                                unlink(tmptxtfile);
                        } else {
@@ -2611,6 +2612,10 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                                        /* Delete files */
                                        ast_filedelete(tmptxtfile, NULL);
                                        unlink(tmptxtfile);
+                               } else if (ast_fileexists(tmptxtfile, NULL, NULL) <= 0) {
+                                       if (option_debug) 
+                                               ast_log(LOG_DEBUG, "The recorded media file is gone, so we should remove the .txt file too!\n");
+                                       unlink(tmptxtfile);     
                                } else {
                                        for (;;) {
                                                make_file(fn, sizeof(fn), dir, msgnum);
@@ -2644,7 +2649,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                                                        free_user(recip);
                                                }
                                        }
-                                       if (ast_fileexists(fn, NULL, NULL)) {
+                                       if (ast_fileexists(fn, NULL, NULL) > 0) {
                                                STORE(dir, vmu->mailbox, vmu->context, msgnum);
                                                notify_new_message(chan, vmu, msgnum, duration, fmt, chan->cid.cid_num, chan->cid.cid_name);
                                                DISPOSE(dir, msgnum);