Summary:ASTERISK-06177: Impossible to read voicemessages from database using ODBC.
Reporter:Omar Belakhdar (belakdar)Labels:
Date Opened:2006-01-24 04:18:53.000-0600Date Closed:2011-06-07 14:03:14
Versions:Frequency of
Environment:Attachments:( 0) svn.9025.app_voicemail.c.patch
Description:I've installed the last released asterisk 1.2.2 on my own HLFS system with a kernel. I've also a 2 FXO/ 1 FXS digium card on it. Every thing is working correctly.

For ODBC, I'm using UnixODBC with pgsql. The messages are written corretly to the database and also their number is correctly reported by VoicemailMain dialogue.

However, after reading the time/day of the new message, the system hangup without playing the message and automatically reports that it "couldn't open /var/spool/.../msg0000.WAV, from the file.c (ast_filehelper) and "Unable to open /var/.../msg0000" from the file.c  (ast_streamfile) methods.

After some dubbeguing (I've a sptripped system, I don't have access to all symbols), it seems like the temporary files are lost or not created at all.
The message is reported as read and thus becomes old. I checked that from the code and this heppen from the playing_message method as expected.

NB: I'm candidate to report/share my ODBC experience with others to make the system more stable. So, don't hesistate to propose any setup that I can make for further experience.

Many thanks.



There is no errors at the database level.

For the recording field, I'm using a bytea (Byte Array) type and after experiencing craches for long messages, I modified the SQL_BINARY to SQL_LONGVARBINARY, and then craches stopped. But this doesn't solve the above mentionned problem.
Comments:By: Omar Belakhdar (belakdar) 2006-01-24 04:21:03.000-0600

I forget to mention that the MWI is working correctly for the ODBC setup I have.



By: Lance Kimes (lkimes) 2006-02-06 13:14:18.000-0600

I'm guessing that you're not running this as root?  If that's the case, then I reported this bug and posted the bugfix patch last month.  It was rejected and I was told "Its a minor problem and you should run asterisk as root."

Anyway, if this is your problem I've upload the patch file that we include here at Rhythm & Hues Studios.

Lance Kimes

By: Omar Belakhdar (belakdar) 2006-02-07 11:06:26.000-0600

Hi Lance,
Thanks for your answer.
Yes I'm running asterisk as "asterisk" user.
I applied the patch and now I have another problem related to the size of the left message. Asterish crashes when the message is of longer duration. I've used a LONGBIGBINARY (I'm using postgresql) instead of BINARY which solve the crash problem but another problem comes up. This problem is related to the fact that postgres stores large binary files as "internal files" and put inside the recording colum a internal ID. This makes asterisk looks for RIFF headed file which is not the case. May be I've to make change to the SQL statment to makes it read the file.

Have you experienced any similar problem?

I'm using asterisk 1.2.4

Omar Belakhdar

By: Omar Belakhdar (belakdar) 2006-02-07 11:09:47.000-0600

Sorry: read LONGVARBINARY instead of LONGBINARY.

By: Lance Kimes (lkimes) 2006-02-07 11:47:04.000-0600

How long?  I can run some tests on our side.  We are using the unixODBC rpm package with SuSE 9.3 to create an ODBC connection into our mysql server.  We use a longblob type with a max value of 4.2G.

By: Omar Belakhdar (belakdar) 2006-02-07 14:10:19.000-0600

Hi Lance,
I agree with you concerning the answer of Digium which is really indesirable. I cannot understand how they can recommand people to use asterisk with unpreviliged user and give such answers.

For the messages size, I got asterisk crashed just for 3 minutes of continuous speacking message which is not a lot. Even, I've seen the same problem mentionned by other guys as a bug and they solved that by using LONGVARBINARY. It seems it affect also mysql users. I will look for the id of the bug and send it to you.

Honestly speaking, I have to do the experience to see exactly what is happening because my database contained old files. I will tell you the result.


By: Lance Kimes (lkimes) 2006-02-07 15:06:34.000-0600

Failed on mysql as well.  Looking into it further, but here was the debug log messages:

Feb  7 13:57:17 VERBOSE[4298] logger.c:   == Parsing '/var/spool/asterisk/voicemail/default/7942/INBOX/msg0000.txt': Feb  7 13:57:17 VERBOSE[4298] logger.c:   == Parsing '/var/spool/asterisk/voicemail/default/7942/INBOX/msg0000.txt': Found
Feb  7 13:57:17 WARNING[4298] res_odbc.c: SQL Execute returned an error -1: HYT00: [MySQL][ODBC 3.51 Driver][mysqld-4.1.10a]Got a packet bigger than 'max_allowed_packet' bytes (92)
Feb  7 13:57:17 WARNING[4298] res_odbc.c: SQL Execute returned an error -1: 00000: [MySQL][ODBC 3.51 Driver][mysqld-4.1.10a]Got a packet bigger than 'max_allowed_packet' bytes (92)
Feb  7 13:57:17 WARNING[4298] app_voicemail.c: SQL Execute error!
[INSERT INTO voicemessages (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)]

By: Lance Kimes (lkimes) 2006-02-07 15:23:28.000-0600

Changed mysql's max record size to 1G.  Fixed now for me.

By: Vincent Dubois (vdubois) 2006-02-10 07:19:24.000-0600

Ikimes, I now have the same errors when trying to save a long message...
you changed the max record size of mysql? where did you find that option?

By: Tilghman Lesher (tilghman) 2006-02-23 16:34:37.000-0600

Appears to be fixable by modifying the database parameters.  Not a bug in Asterisk.