Summary:ASTERISK-07804: [patch] Using ODBC storage, the message is not correctly entered into database if reviewed by sender
Reporter:Edwin horton (edhorton)Labels:
Date Opened:2006-09-22 16:53:01Date Closed:2007-06-07 14:54:24
Versions:Frequency of
Environment:Attachments:( 0) app_voicemail.c.odbc.patch
( 1) voice_diff.diff
Description:If a sender leaves a voicemail message, and just hangs up, the message is correctly entered into the database.  However, if the message is reviewed and then accepted, "press 1", then the database entry remains:
/var/spool/asterisk/voicemail/context/extension/tmp/Z6Qvky.. with a message number of -1.  It never seems to be moved to thr INBOX.  As I already mentioned, if the caller just hangs up, it is correctly written into the database with the location:


Also seen in Asterisk 1.2.9 on a different server/database combo.
Comments:By: Sergey Okhapkin (sokhapkin) 2006-10-02 08:05:13

Looks like a bug in play_record_review() functions, the lines

STORE(recordfile, vmu->mailbox, vmu->context, -1);
DISPOSE(recordfile, -1);

should be removed, leave_voicemail() will take care about storing the file later.

I will update the patch in bug 8033 to address the issue.

By: Anthony LaMantia (alamantia) 2006-10-03 18:36:59

I have written a simple patch for the bug and uploaded it to this entry in mantis,
8033 seems to have quite a large scope. and i'm not positive it will be included in 1.4 while this bug is something that would.

any other modifactions that need to be made or input you may have would be valued.
also do you have disclaimer on file with digium? if not can you please put one in before you contribute a patch for this issue..


By: Sergey Okhapkin (sokhapkin) 2006-10-03 19:44:23

My disclaimer is on file.

By: Anthony LaMantia (alamantia) 2006-10-04 09:29:53

cool, no worries then

By: Anthony LaMantia (alamantia) 2006-10-21 14:08:36

hi edhorton,

i have placed your patch in my patch-branch. which you can view here.

By: Anthony LaMantia (alamantia) 2006-11-02 17:28:48.000-0600


By: Jason Parker (jparker) 2006-12-04 13:09:16.000-0600

Fixed in 1.2 svn, revision 48236.

Already fixed in 1.4 and trunk.

By: Jason Parker (jparker) 2006-12-04 15:24:35.000-0600

This patch fixed the issue at hand, but it broke other things.  See 8419

By: Leif Madsen (lmadsen) 2006-12-04 20:51:31.000-0600

Just making a note in passing that bug 8419 was opened due to this patch breaking something else. 8419 is now closed, waiting for OP to report all issues resolved (in relation to this bug :))

By: Edwin horton (edhorton) 2006-12-26 12:45:26.000-0600

An update.  I tried the new Asterisk-1.4.0-beta4 and is has the same problem.  That is, when using ODBC storage for voicemail, and a callers leaves a message and ends with a # either to review or end the call (depending on review option), the message is not stored in the data base.  If the caller hangs up, then it is stored correctly.

By: Leif Madsen (lmadsen) 2006-12-26 19:20:19.000-0600

edhorton: 1.4.0 (non-beta) was released on the 23rd of December. Looks like Qwell put in a patch related to this bug on Dec. 4th, and while this should have been fixed in beta4, its probably worth checking if 1.4.0 still exhibits this bug.

Unfortunately I don't have the means to test this right now, or I'd just do it myself.

By: Anthony LaMantia (alamantia) 2006-12-27 12:41:09.000-0600

the changes from this commit

still exist in the current 1.4 branch, and the 1.4.0 release.
it seems due to another issue in mantis 8419  the changes edhorton  proposed with the patch on this issue had to be removed.

do you want to give this issue another shot?

By: Edwin horton (edhorton) 2006-12-29 14:23:01.000-0600

Today checked 1.4.0 and the problem still exists.  All prompts (mailbox option 0) are saved in the database correctly with a msgnum of -1.  If the caller leaves a message and hits # instead of hanging up, the entry is place in the database with a msgnum of -1 and a location like "/var/spool/asterisk/voicemail/from-sip/205/tmp/5lwger" instead of a correctly placed message with a msgnum of 0 or greater and the location "/var/spool/asterisk/voicemail/from-sip/205/INBOX".  I did not produce the original patch that fixed this but broke the ability to save user prompts, but since it did fix this problem, seems like it is close to the correct path.  The problem with the code as is, it make ODBC voicemail pretty much unusable since some people will exit with a # and these messages will be "lost" unless the database is manually edited.  Also, if you turn off "review" and you exit with #, the result is the same.

By: Leif Madsen (lmadsen) 2007-02-22 08:24:09.000-0600

This is being marked as "Ready for testing" -- does this mean the patch included in this bug report is ready for testing, and is no longer interfering with the solution in 8419?

By: Edwin horton (edhorton) 2007-03-07 09:17:23.000-0600

On 1.4.1 release.
Seems to fix the problem of saving a message when exiting with a # key.  However, I did notice that when recording mailbox unavail, busy and greetings, they remain in the users /var/spool/asterisk/voicemail/context/mailbox directory.  If a caller gets to the mailbox to leave a message, the greetings played are the new ones in the directory.  If they are erased, the old greetings in the database are played.  In a related matter, the directory app seems to use only those greetings stored in the directory, not the database.

By: Caio Begotti (caio1982) 2007-03-28 13:57:48

Tested on trunk today for the ticket 9411: sends the voicemail message after reviewing it just fine.

By: Serge Vecher (serge-v) 2007-03-28 14:24:14

caio1982: just to be clear, you've tested a 'clean' trunk or with the patch?

By: Caio Begotti (caio1982) 2007-03-28 14:26:43

It didn't work with a clean checkout from trunk, serge-v. I had to apply the patch attached in this ticketin order to make it work.

Actually I changed the code manually, but that's ok :-P

By: Serge Vecher (serge-v) 2007-03-28 14:33:08

ciao1982: thanks, just wanted to be clear
edhorton: to avoid any confusion, does this patch fix the original issue for you without causing the breakage of 8419?

By: Caio Begotti (caio1982) 2007-03-28 14:49:27


The answer here (if I was asked about it) would be "no, it indeed doesn't work without causing the breakage of 8419, but at least it solved the issue of this ticket".

I didn't know about 8419 before, so I'm only confirming the breakage now.

By: Edwin horton (edhorton) 2007-03-31 14:48:25

I applied the patch, manually, to 1.4.2 release. I did not try against trunk as yet. It seems to work very well.  All messages that were sent by pressing # were delivered.  Save for sending with a hangup.  In addition, I checked the issue of not saving the user greetings when using ODBC storage (8419), and it is also OK.  Greetings were saved and moved ffom the flat file location iv /var/spool/asterisk/voicemail/context/user.  Great!

By: Leif Madsen (lmadsen) 2007-04-03 11:49:14

Also tested here on latest 1.4. Removing these two lines from the app_voicemail.c file allows this to work for ODBC voicemail upon user review!

By: Caio Begotti (caio1982) 2007-04-17 09:11:25

Edhorton, Russell:

Although the patch is working fine in here using the latest 1.4 code, that issue from 8419 about not saving the "greetings" audios using ODBC storage is still present:

# tree /var/spool/asterisk/voicemail/default/5050/
|-- Old
|-- busy
|-- busy.WAV
|-- greet
|-- greet.WAV
|-- temp
|-- tmp
`-- unavail.WAV

It should be handled in another ticket or is it a blocker anyway?

By: Sergey Okhapkin (sokhapkin) 2007-05-21 16:57:58

Please remove app-voicemail.patch, I uploaded it in error. The diff file app_voicemail.c.odbc.patch (a diff against version 1.4.4) solves the problem with messages not stored in the database after review and "unable to save a new greeting message".

By: Caio Begotti (caio1982) 2007-05-22 08:39:20

I just tested this app_voicemail.c.odbc.patch with SVN-branch-1.4-r65342M and it worked, it's marvelous. Recorded my greeting audios, leaved a voicemail then listened to it and confirmed it sending the file via e-mail. Everything is in my database.

I tested it with the same revision but without the patch just to make sure the problem is still there: the audio message is recorded but stored ending with a "tmp/oqlsTI" sufix in my database and no e-mail is sent anyway.

By: Leif Madsen (lmadsen) 2007-06-07 12:32:38

Deleted app_voicemail.patch per posters request

By: Jason Parker (jparker) 2007-06-07 14:16:21

We looked into this code, and how it affects both ODBC and IMAP storage, and there is a better way to do this.  Stay tuned.

By: Mark Michelson (mmichelson) 2007-06-07 14:54:21

This issue is fixed in 1.4 as of SVN revision 68198.
This issue is fixed in trunk as of SVN revision 68200.