[Home]

Summary:ASTERISK-17207: Problem reading a message which was previously saved as unread in INBOX.
Reporter:Andres Felipe Osorio (afosorio)Labels:
Date Opened:2011-01-05 15:31:54.000-0600Date Closed:2011-04-01 05:37:20
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_voicemail/ODBC
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I am using odbc voicemail store but I am having a problem when trying to listen a new message which was previously saved as unread in INBOX (option 9 and option 0). When a message is saved I see that database field msgnum increments by one, this causes that when trying to read the message again, asterisk show the next messages:

 == Parsing '/var/spool/asterisk/voicemail/default/8101/INBOX/msg0000.txt':   == Found
   -- <SIP/8101-00000007> Playing 'vm-message.gsm' (language 'es')
[Jan  5 16:20:24] WARNING[26037]: app_voicemail.c:7560 play_message: No origtime?!

Below appears what is happening:

The database fields without reading the message:

mysql> select id, msgnum, dir, context, origtime, duration, mailboxuser, mailboxcontext from voicemessages;
+----+--------+--------------------------------------------------+-------------+------------+----------+-------------+----------------+
| id | msgnum | dir                                              | context     | origtime   | duration | mailboxuser | mailboxcontext |
+----+--------+--------------------------------------------------+-------------+------------+----------+-------------+----------------+
|  1 |      0 | /var/spool/asterisk/voicemail/default/8101/INBOX | macro-exten | 1294262263 | 5        | 8101        | default        |
+----+--------+--------------------------------------------------+-------------+------------+----------+-------------+----------------+

The database fields after reading and saving the message as unread in INBOX:

mysql> select id, msgnum, dir, context, origtime, duration, mailboxuser, mailboxcontext from voicemessages;
+----+--------+--------------------------------------------------+-------------+------------+----------+-------------+----------------+
| id | msgnum | dir                                              | context     | origtime   | duration | mailboxuser | mailboxcontext |
+----+--------+--------------------------------------------------+-------------+------------+----------+-------------+----------------+
|  2 |      1 | /var/spool/asterisk/voicemail/default/8101/INBOX | macro-exten | 1294262263 | 5        | 8101        | default        |
+----+--------+--------------------------------------------------+-------------+------------+----------+-------------+----------------+

I am using asterisk version 1.8.1

Thanks in advance for your collaboration
Comments:By: TGIFriday.com, Inc. (tgifriday) 2011-02-23 11:38:50.000-0600

This issue appears in 1.4.38 as well, is a bug-fix in the works?  I can manually fix the database by renumbering the msgnum in the database for messages that are out of sequence.  (ie msgnum(s)- 34,56,77,79,89  / switch to 0,1,2,3,4)

Messages than once again be listened to and deleted by end user.



By: Alec Davis (alecdavis) 2011-03-28 20:12:07

While msgnum=0 is missing, only the last message is saved, over wrting the last.

And the only way you become aware of it, is when a user cannot read their message. Until then they are losing messages.

By: Alec Davis (alecdavis) 2011-03-30 22:24:56

Added reviewboard link, as I'm sure it's related.

By: Digium Subversion (svnbot) 2011-04-01 01:46:58

Repository: asterisk
Revision: 312070

U   branches/1.4/apps/app_voicemail.c

------------------------------------------------------------------------
r312070 | alecdavis | 2011-04-01 01:46:56 -0500 (Fri, 01 Apr 2011) | 16 lines

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 ASTERISK-17613,ASTERISK-17207,ASTERISK-17299,ASTERISK-17580)
Reported by: alecdavis,tootai,afosorio

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


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=312070

By: Digium Subversion (svnbot) 2011-04-01 02:25:56

Repository: asterisk
Revision: 312103

_U  branches/1.6.2/
U   branches/1.6.2/apps/app_voicemail.c

------------------------------------------------------------------------
r312103 | alecdavis | 2011-04-01 02:25:55 -0500 (Fri, 01 Apr 2011) | 22 lines

Merged revisions 312070 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r312070 | alecdavis | 2011-04-01 19:46:56 +1300 (Fri, 01 Apr 2011) | 16 lines
 
 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 ASTERISK-17613,ASTERISK-17207,ASTERISK-17299,ASTERISK-17580)
 Reported by: alecdavis,tootai,afosorio
 
 Review: https://reviewboard.asterisk.org/r/1153/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=312103

By: Digium Subversion (svnbot) 2011-04-01 02:32:14

Repository: asterisk
Revision: 312117

_U  branches/1.8/
U   branches/1.8/apps/app_voicemail.c

------------------------------------------------------------------------
r312117 | alecdavis | 2011-04-01 02:32:13 -0500 (Fri, 01 Apr 2011) | 29 lines

Merged revisions 312103 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
 r312103 | alecdavis | 2011-04-01 20:25:54 +1300 (Fri, 01 Apr 2011) | 22 lines
 
 Merged revisions 312070 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r312070 | alecdavis | 2011-04-01 19:46:56 +1300 (Fri, 01 Apr 2011) | 16 lines
   
   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 ASTERISK-17613,ASTERISK-17207,ASTERISK-17299,ASTERISK-17580)
   Reported by: alecdavis,tootai,afosorio
   
   Review: https://reviewboard.asterisk.org/r/1153/
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=312117

By: Digium Subversion (svnbot) 2011-04-01 02:43:02

Repository: asterisk
Revision: 312118

_U  trunk/
U   trunk/apps/app_voicemail.c

------------------------------------------------------------------------
r312118 | alecdavis | 2011-04-01 02:43:00 -0500 (Fri, 01 Apr 2011) | 36 lines

Merged revisions 312117 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r312117 | alecdavis | 2011-04-01 20:32:12 +1300 (Fri, 01 Apr 2011) | 29 lines
 
 Merged revisions 312103 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ................
   r312103 | alecdavis | 2011-04-01 20:25:54 +1300 (Fri, 01 Apr 2011) | 22 lines
   
   Merged revisions 312070 via svnmerge from
   https://origsvn.digium.com/svn/asterisk/branches/1.4
   
   ........
     r312070 | alecdavis | 2011-04-01 19:46:56 +1300 (Fri, 01 Apr 2011) | 16 lines
     
     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 ASTERISK-17613,ASTERISK-17207,ASTERISK-17299,ASTERISK-17580)
     Reported by: alecdavis,tootai,afosorio
     
     Review: https://reviewboard.asterisk.org/r/1153/
   ........
 ................
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=312118

By: Digium Subversion (svnbot) 2011-04-01 03:29:50

Repository: asterisk
Revision: 312174

U   branches/1.4/apps/app_voicemail.c

------------------------------------------------------------------------
r312174 | alecdavis | 2011-04-01 03:29:49 -0500 (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 ASTERISK-17299,ASTERISK-17207,ASTERISK-17613)
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/


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=312174

By: Digium Subversion (svnbot) 2011-04-01 03:47:30

Repository: asterisk
Revision: 312210

_U  branches/1.6.2/
U   branches/1.6.2/apps/app_voicemail.c

------------------------------------------------------------------------
r312210 | alecdavis | 2011-04-01 03:47:30 -0500 (Fri, 01 Apr 2011) | 29 lines

Merged revisions 312174 via svnmerge from
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 ASTERISK-17299,ASTERISK-17207,ASTERISK-17613)
 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/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=312210

By: Digium Subversion (svnbot) 2011-04-01 04:03:12

Repository: asterisk
Revision: 312211

_U  branches/1.8/
U   branches/1.8/apps/app_voicemail.c

------------------------------------------------------------------------
r312211 | alecdavis | 2011-04-01 04:03:12 -0500 (Fri, 01 Apr 2011) | 36 lines

Merged revisions 312210 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
 r312210 | alecdavis | 2011-04-01 21:47:29 +1300 (Fri, 01 Apr 2011) | 29 lines
 
 Merged revisions 312174 via svnmerge from
 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 ASTERISK-17299,ASTERISK-17207,ASTERISK-17613)
   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/
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=312211

By: Digium Subversion (svnbot) 2011-04-01 04:08:40

Repository: asterisk
Revision: 312212

_U  trunk/
U   trunk/apps/app_voicemail.c

------------------------------------------------------------------------
r312212 | alecdavis | 2011-04-01 04:08:39 -0500 (Fri, 01 Apr 2011) | 43 lines

Merged revisions 312211 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r312211 | alecdavis | 2011-04-01 22:03:11 +1300 (Fri, 01 Apr 2011) | 36 lines
 
 Merged revisions 312210 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ................
   r312210 | alecdavis | 2011-04-01 21:47:29 +1300 (Fri, 01 Apr 2011) | 29 lines
   
   Merged revisions 312174 via svnmerge from
   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 ASTERISK-17299,ASTERISK-17207,ASTERISK-17613)
     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/
   ........
 ................
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=312212