https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r312174 | alecdavis | 2011-04-01 21:29:49 +1300 (Fri, 01 Apr 2011) | 23 lines
voicemail: get real last_message_index and count_messages, ODBC resequence
change last_message_index to read the max msgnum stored in the database
change count_messages to actually count the number of messages.
last_message_index change:
This fixed overwriting of the last message if msgnum=0 was missing.
Previously every incoming message would overwrite msgnum=1.
count_messages change:
allows us to detect when requencing is required in opneA_mailbox.
resequence enabled for ODBC storage:
Assists with fixing up corrupt databases with gaps, but only when
a user actively opens there mailboxes.
(closes issue #18692,#18582,#19032)
Reported by: elguero
Patches:
based on odbc_resequence_mailbox2.1.diff uploaded by elguero (license 37)
Tested by: elguero, nivek, alecdavis
Review: https://reviewboard.asterisk.org/r/1153/
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@312210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
/* we know the actual number of messages, so stop process when number is hit */
@ -7481,11 +7535,9 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box)
if(last_msg<-1){
returnlast_msg;
#ifndef ODBC_STORAGE
}elseif(vms->lastmsg!=last_msg){
ast_log(LOG_NOTICE,"Resequencing mailbox: %s, expected %d but found %d message(s) in box with max threshold of %d.\n",vms->curdir,last_msg+1,vms->lastmsg+1,vmu->maxmsg);
resequence_mailbox(vmu,vms->curdir,count_msg);
#endif
ast_log(LOG_NOTICE,"Resequencing Mailbox: %s, expected %d but found %d message(s) in box with max threshold of %d.\n",vms->curdir,last_msg+1,vms->lastmsg+1,vmu->maxmsg);