]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_voicemail: leave_vociemail doesn't use last_message_index to store next message
authorAlec L Davis <sivad.a@paradise.net.nz>
Fri, 1 Apr 2011 11:02:26 +0000 (11:02 +0000)
committerAlec L Davis <sivad.a@paradise.net.nz>
Fri, 1 Apr 2011 11:02:26 +0000 (11:02 +0000)
trivial change to bring inline with 1.6.2 1.8 and trunk.
The symptom was if msg0000 was missing, and the last was msg0004,
the next msgnum would be msg0000 when it should have been msg0005

(issue #18998)
Reported by: tootai
Patches:
      bug18998.diff2.txt uploaded by alecdavis (license 585)
Tested by: alecdavis

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@312290 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index 6b482e210153e5b7981cdd34272aeb441f6431dd..58e2d55aae939631aafe959ef9d5cc6ccf5f174f 100644 (file)
@@ -4534,12 +4534,10 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                                        ast_unlock_path(dir);
                                        inprocess_count(vmu->mailbox, vmu->context, -1);
                                } else {
-                                       for (;;) {
-                                               make_file(fn, sizeof(fn), dir, msgnum);
-                                               if (!EXISTS(dir, msgnum, fn, NULL))
-                                                       break;
-                                               msgnum++;
-                                       }
+#ifndef IMAP_STORAGE
+                                       msgnum = last_message_index(vmu, dir) + 1;
+#endif
+                                       make_file(fn, sizeof(fn), dir, msgnum);
 
                                        /* assign a variable with the name of the voicemail file */ 
 #ifndef IMAP_STORAGE