[Home]

Summary:ASTERISK-12543: Forwarding a voicemail message with no envelope fails
Reporter:Mike Oliveras (moliveras)Labels:
Date Opened:2008-08-27 16:50:47Date Closed:2008-09-03 09:20:03
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_voicemail/ODBC
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 13387.patch
Description:I have ODBC voicemail set up using a postgres DB.  A message is left in mailbox 201.

From a phone, a user checks mailbox 201 and tries for forward the message to extension 202, by listening to the message, choosing option 8, entering 202 for the extension, and then selection option 2 to send the message without prepending to it.

When that occurs, I see a NOTICE stating that a message was copied from 201 to 202 but the message is not put into the DB.  Instead I am left with a local copy of the message in the originating mailbox folder, as shown below.  If I forward the message using option 1 and prepend to it, then is seems to work as expected, and I get a new message in the DB with a dir of .../202/INBOX

[root@mikeo_asterisk1 cust1]# [Aug 27 17:49:09] NOTICE[27807]: app_voicemail.c:3493 copy_message: Copying message from 201@cust1 to 202@cust1


[root@mikeo_asterisk1 cust1]# pwd
/var/spool/asterisk/voicemail/cust1
[root@mikeo_asterisk1 cust1]# ls 20[12]/*
201/greet:

201/INBOX:
msg0000.txt  msg0000.WAV

201/Old:

201/temp:

201/tmp:

201/unavail:

202/INBOX:

202/Old:
[root@mikeo_asterisk1 cust1]#
Comments:By: Leif Madsen (lmadsen) 2008-09-02 13:40:33

Updating status as putnopvut has been able to reproduce this issue.

By: Mark Michelson (mmichelson) 2008-09-02 15:23:18

Just to give an update about the exact nature of the behavior, it appears that after the first time you forward a message with a prepended message, all forwards from that particular mailbox will work as expected. The weird part is that an extra message is placed in the database and an extra one is left on the file system afterwards. It appears as though this is done so that just a temporary file is modified with any prepended messages that are made. The problem is that the logic used is messed up. This could be a result of the large amount of changes I made when doing the imap_consistency fixups. I'll take a closer look and see if there's something that I mistakenly changed.

By: Mark Michelson (mmichelson) 2008-09-02 17:30:19

I looked more deeply and have found the issue. Thankfully, it is not due to imap_consistency changes, since this problem existed prior to that change.

Here's what's happening. When it comes time to forward a message, Asterisk grabs the file from the database. It then makes a local temporary copy of the file (I suppose this is to protect the original in case you do something like prepend a message). If you press '2' so that Asterisk doesn't prepend a message, then Asterisk attempts to copy the temporary copy to the destination mailbox. The problem is that this temporary copy was never inserted into the DB, so the copy fails. If you press 1 to prepend the message, then the temporary file is stored in the DB prior to copy attempt.

In both cases, there is leftover cruft. In the case where you do not prepend a message, the downloaded copy of the original message is left on the file system even though it should have been removed. In the case where you do prepend a message, the temporary copy of the downloaded message is left in the DB.

My plan for dealing with this is to make all changes locally and then just store the local temporary copy in the DB once all is done. No need to do any extra storing and copying that way, and it should work. I'll leave another note when I have a patch ready for testing.

By: Mark Michelson (mmichelson) 2008-09-02 18:28:41

Please give 13387.patch a test. It cured my local problems when using ODBC storage.

By: Mike Oliveras (moliveras) 2008-09-02 22:20:47

The patch works perfectly. I tried forwarding both with and without prepending a message and in both cases it worked with no leftovers on disk or in the DB.

Thanks for the quick turnaround on this fix.

By: Mark Michelson (mmichelson) 2008-09-03 09:18:29

Great, thanks for the feedback. I'll commit this very soon, then.

By: Digium Subversion (svnbot) 2008-09-03 09:20:00

Repository: asterisk
Revision: 140850

U   branches/1.4/apps/app_voicemail.c

------------------------------------------------------------------------
r140850 | mmichelson | 2008-09-03 09:20:00 -0500 (Wed, 03 Sep 2008) | 9 lines

Fix voicemail forwarding when using ODBC storage.

(closes issue ASTERISK-12543)
Reported by: moliveras
Patches:
     13387.patch uploaded by putnopvut (license 60)
Tested by: putnopvut, moliveras


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

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