[asterisk-commits] alecdavis: branch 1.4 r312070 - /branches/1.4/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 1 01:47:05 CDT 2011


Author: alecdavis
Date: Fri Apr  1 01:46:56 2011
New Revision: 312070

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=312070
Log:
app_voicemail: close_mailbox needs to respect additional messages while mailbox is open.

close_mailbox leave gaps in message sequence if messages are deleted and new messages
arrive during this time, this is because the shuffle down to slot 0, only shuffles
the number of pre-existing messages when mailbox is opened, ignoring new arrivals.

Fix: in close_mailbox re-evaluate number of messages before the shuffle, this then includes new arrivals.

Happens on filebased or ODBC storage.

(issues #19032,#18582,#18692,#18998)
Reported by: alecdavis,tootai,afosorio

Review: https://reviewboard.asterisk.org/r/1153/


Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=312070&r1=312069&r2=312070
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Fri Apr  1 01:46:56 2011
@@ -6051,6 +6051,7 @@
 static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
 {
 	int x = 0;
+	int last_msg_index;
 #ifndef IMAP_STORAGE
 	int res = 0, nummsg;
 #endif
@@ -6063,9 +6064,14 @@
 	/* Get the deleted messages fixed */ 
 	if (vm_lock_path(vms->curdir))
 		return ERROR_LOCK_PATH;
-	 
+
+	last_msg_index = last_message_index(vmu, vms->curdir);
+	if (last_msg_index !=  vms->lastmsg) {
+		ast_log(LOG_NOTICE, "%d messages arrived while mailbox was open\n", last_msg_index - vms->lastmsg);
+	}
+ 
 	/* must check up to last detected message, just in case it is erroneously greater than maxmsg */
-	for (x = 0; x < vms->lastmsg + 1; x++) { 
+	for (x = 0; x < last_msg_index + 1; x++) { 
 		if (!vms->deleted[x] && (strcasecmp(vms->curbox, "INBOX") || !vms->heard[x])) { 
 			/* Save this message.  It's not in INBOX or hasn't been heard */ 
 			make_file(vms->fn, sizeof(vms->fn), vms->curdir, x); 




More information about the asterisk-commits mailing list