[Home]

Summary:ASTERISK-23986: Voicemail msg_id is changed when a voicemail is played or moved.
Reporter:Steven Wheeler (swheeler)Labels:
Date Opened:2014-07-02 13:20:13Date Closed:2014-07-03 16:20:52
Priority:MinorRegression?
Status:Closed/CompleteComponents:Applications/app_voicemail/ODBC
Versions:11.6.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:CentOS 6.5 x86_64 unixODBC 2.2.14-12 MySQL Connector/ODBC 5.3.2 MySQL 5.1.73Attachments:( 0) vm_queries.sql
Description:We are getting ready to make the jump from v1.8 to v11.6-cert4. One of the new features (as listed in https://wiki.asterisk.org/wiki/display/AST/Upgrading+to+Asterisk+11) we were most excited for was the new unique msg_id column in the voicemessages table. The hope was that this would allow us to store additional information related to a message.

However, it appears that the msg_id value changes whenever the message is moved to a different mailbox (i.e. moved from INBOX to Old).  Is this expected behavior or is it a bug?
Comments:By: Steven Wheeler (swheeler) 2014-07-02 13:37:19.104-0500

Here are all the SQL queries which are executed by app_voicemail when checking a new voicemail and moving it from INBOX to Old.

You can see on line 16 that the message is being copied from INBOX to Old, but a new msg_id was generated. And then on line 18 the original message is deleted.

By: Michael L. Young (elguero) 2014-07-03 16:20:33.523-0500

It would appear to be intentional.

https://reviewboard.asterisk.org/r/2220/

Anytime a message is copied, it will receive a new msg_id.  If you read the comments on the code review at the link above, you will see why it was done this way.

By: Steven Wheeler (swheeler) 2014-07-03 16:31:30.644-0500

Michael,
Thanks for following up on this. From looking at the source code yesterday I kind of figured this was the case.

If we can't rely on the msg_id to be a fixed value what purpose does it serve? Why was it added?

By: Michael L. Young (elguero) 2014-07-03 19:07:01.999-0500

One thing that comes to mind would be that msgnum could change but msg_id stays the same.  The msg_id only changes when a new record is made in the database.  The new record is created when moving a message to another folder or when listening to a message.  When listening, the record is automatically created in order to put the message in the Old folder.  Otherwise, as long as you are not copying the message around, the msg_id stays the same, even if you delete or add other messages to the same folder.