<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16609" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I am running CentOS 5 with Asterisk 1.4.14.&nbsp; I 
am trying to setup storage of voicemail messages into MySQL.&nbsp; It is my 
understanding that I can only do this via ODBC.&nbsp; I installed per <A 
href="http://www.voip-info.org/wiki/view/CentOS+5+and+Asterisk+1.4.x+installation">http://www.voip-info.org/wiki/view/CentOS+5+and+Asterisk+1.4.x+installation</A>&nbsp; 
unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel and 
mysql-connector-odbc. I reconfigured and built Asterisk, using menuconfig to 
turn on ODBC voicemail storage.&nbsp; Here is the output of some config 
files:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>[root@Aiur asterisk]# cat /etc/odbcinst.ini<BR># 
Example driver definitinions<BR>#<BR>#</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2># Included in the unixODBC 
package<BR>#[PostgreSQL]<BR>#Description&nbsp;&nbsp;&nbsp; = ODBC for 
PostgreSQL<BR>#Driver&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
/usr/lib/libodbcpsql.so<BR>#Setup&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
= /usr/lib/libodbcpsqlS.so<BR>#FileUsage&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
1</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><FONT face=Arial size=2>
<DIV><BR># Driver from the MyODBC package<BR># Setup from the unixODBC 
package<BR>[MySQL]<BR>Description&nbsp;&nbsp;&nbsp;&nbsp; = ODBC for 
MySQL<BR>Driver&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
/usr/lib64/libmyodbc3.so<BR>Setup&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
= /usr/lib64/libodbcmyS.so<BR>FileUsage&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
1<BR>You have new mail in /var/spool/mail/root<BR>[root@Aiur asterisk]# cat 
/etc/odbc.ini<BR>[astrealtime]<BR>Description&nbsp;&nbsp;&nbsp;&nbsp; = Asterisk 
realtime FUNC_ODBC 
access<BR>Driver&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
MySQL<BR>Socket&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
/var/lib/mysql/mysql.sock<BR>Server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 

localhost<BR>User&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 

astrealtime<BR>Pass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
= XXXX<BR>Database&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
asterisk<BR>Option&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = 
3<BR>[root@Aiur asterisk]# cat&nbsp; /etc/asterisk/res_odbc.conf<BR>;;; odbc 
setup file</DIV>
<DIV>&nbsp;</DIV>
<DIV>; ENV is a global set of environmental variables that will get set.<BR>; 
Note that all environmental variables can be seen by all connections,<BR>; so 
you can't have different values for different 
connections.<BR>[ENV]<BR>INFORMIXSERVER =&gt; my_special_database<BR>INFORMIXDIR 
=&gt; /opt/informix</DIV>
<DIV>&nbsp;</DIV>
<DIV>; All other sections are arbitrary names for database connections.</DIV>
<DIV>&nbsp;</DIV>
<DIV>[asterisk]<BR>enabled =&gt; no<BR>dsn =&gt; asterisk<BR>;username =&gt; 
myuser<BR>;password =&gt; mypass<BR>pre-connect =&gt; yes</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>[mysql]<BR>enabled =&gt; yes<BR>dsn =&gt; MySQL-asterisk<BR>username 
=&gt; astrealtime<BR>password =&gt; XXXX<BR>pre-connect =&gt; yes</DIV>
<DIV>&nbsp;</DIV>
<DIV>; Certain servers, such as MS SQL Server and Sybase use the TDS protocol, 
which<BR>; limits the number of active queries per connection to 1.&nbsp; By 
setting up pools<BR>; of connections, Asterisk can be made to work with these 
servers.<BR>[sqlserver]<BR>enabled =&gt; no<BR>dsn =&gt; mickeysoft<BR>pooling 
=&gt; yes<BR>limit =&gt; 5<BR>username =&gt; oscar<BR>password =&gt; 
thegrouch<BR>pre-connect =&gt; yes</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>[root@Aiur asterisk]# cat 
/etc/asterisk/voicemail.conf<BR>odbcstorage=mysql<BR>odbctable=voicemail_messages<BR></DIV>
<DIV>[root@Aiur asterisk]# asterisk -vvv | grep odbc<BR>&nbsp; == Parsing 
'/etc/asterisk/res_odbc.conf': Found<BR>[Feb 22 18:21:46] NOTICE[21214]: 
res_odbc.c:229 load_odbc_config: Adding ENV var: 
INFORMIXSERVER=my_special_database<BR>[Feb 22 18:21:46] NOTICE[21214]: 
res_odbc.c:229 load_odbc_config: Adding ENV var: 
INFORMIXDIR=/opt/informix<BR>[Feb 22 18:21:46] NOTICE[21214]: res_odbc.c:508 
odbc_obj_connect: Connecting mysql<BR>[Feb 22 18:21:46] WARNING[21214]: 
res_odbc.c:519 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 
[unixODBC][Driver Manager]Data source name not found, and no default driver 
specified<BR>[Feb 22 18:21:46] WARNING[21214]: res_odbc.c:444 
ast_odbc_request_obj: Failed to connect to mysql<BR>[Feb 22 18:21:46] 
NOTICE[21214]: res_odbc.c:302 load_odbc_config: Registered ODBC class 'mysql' 
dsn-&gt;[MySQL-asterisk]<BR>[Feb 22 18:21:46] NOTICE[21214]: res_odbc.c:684 
load_module: res_odbc loaded.<BR>res_odbc.so =&gt; (ODBC Resource)<BR>[Feb 22 
18:21:46] NOTICE[21214]: config.c:1250 ast_config_engine_register: Registered 
Config Engine odbc<BR>res_config_odbc loaded.<BR>res_config_odbc.so =&gt; (ODBC 
Configuration)<BR>&nbsp; == Parsing '/etc/asterisk/func_odbc.conf': 
Found<BR>func_odbc.so =&gt; (ODBC lookups)<BR>&nbsp; == Parsing 
'/etc/asterisk/cdr_odbc.conf': Found<BR>cdr_odbc.so =&gt; (ODBC CDR 
Backend)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>[root@Aiur asterisk]# mysql -u root -p<BR>Enter password:<BR>Welcome to the 
MySQL monitor.&nbsp; Commands end with ; or \g.<BR>Your MySQL connection id is 
22 to server version: 5.0.22</DIV>
<DIV>&nbsp;</DIV>
<DIV>Type 'help;' or '\h' for help. Type '\c' to clear the buffer.</DIV>
<DIV>&nbsp;</DIV>
<DIV>mysql&gt; use asterisk;<BR>Reading table information for completion of 
table and column names<BR>You can turn off this feature to get a quicker startup 
with -A</DIV>
<DIV>&nbsp;</DIV>
<DIV>Database changed<BR>mysql&gt; describe 
voicemail_messages;<BR>+----------------+-------------+------+-----+---------+----------------+<BR>| 
Field&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 
Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Null | Key | Default | 
Extra&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>+----------------+-------------+------+-----+---------+----------------+<BR>| 
id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 
int(11)&nbsp;&nbsp;&nbsp;&nbsp; | NO&nbsp;&nbsp; | PRI | NULL&nbsp;&nbsp;&nbsp; 
| auto_increment |<BR>| msgnum&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 
int(11)&nbsp;&nbsp;&nbsp;&nbsp; | NO&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; | 
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>| dir&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | 
varchar(80) | YES&nbsp; | MUL | NULL&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>| context&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | varchar(80) | 
YES&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>| macrocontext&nbsp;&nbsp; | varchar(80) | YES&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>| callerid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | varchar(40) | YES&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>| origtime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | varchar(40) | YES&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>| duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | varchar(20) | YES&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>| mailboxuser&nbsp;&nbsp;&nbsp; | varchar(80) | YES&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>| mailboxcontext | varchar(80) | YES&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; | 
NULL&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>| recording&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | longblob&nbsp;&nbsp;&nbsp; | 
YES&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp; | NULL&nbsp;&nbsp;&nbsp; 
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>+----------------+-------------+------+-----+---------+----------------+<BR>11 
rows in set (0.00 sec)</DIV>
<DIV>&nbsp;</DIV>
<DIV>mysql&gt; exit;<BR>Bye<BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Here is an example of the errors I'm getting 
(ignore No route to destination, those phones just aren't on):</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; -- Executing 
Goto("SIP/2441-ac047f90", "rwest|815XXXXXXX|1")<BR>&nbsp;&nbsp;&nbsp; -- Goto 
(rwest,815XXXXXXX,1)<BR>&nbsp;&nbsp;&nbsp; -- Executing 
NoOp("SIP/2441-ac047f90", "CallerID is "WIRELESS CALLER" 
&lt;XXXXXXX&gt;")<BR>&nbsp;&nbsp;&nbsp; -- Executing Dial("SIP/2441-ac047f90", 
"SIP/rwest200&amp;SIP/rwest201&amp;SIP/rwest202&amp;SIP/rwest203|15")<BR>[Feb 22 
18:14:42] WARNING[21068]: app_voicemail.c:2233 inboxcount: Failed to obtain 
database object for 'asterisk'!<BR>&nbsp;&nbsp;&nbsp; -- Called rwest200<BR>[Feb 
22 18:14:42] WARNING[21149]: app_dial.c:1111 dial_exec_full: Unable to create 
channel of type 'SIP' (cause 3 - No route to destination)<BR>[Feb 22 18:14:42] 
WARNING[21149]: app_dial.c:1111 dial_exec_full: Unable to create channel of type 
'SIP' (cause 3 - No route to destination)<BR>[Feb 22 18:14:42] WARNING[21149]: 
app_dial.c:1111 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 
- No route to destination)<BR>[Feb 22 18:14:42] NOTICE[21068]: chan_sip.c:12414 
handle_response_peerpoke: Peer 'rwest200' is now Reachable. (37ms / 
2000ms)<BR>&nbsp;&nbsp;&nbsp; -- SIP/rwest200-19612180 is ringing<BR>[Feb 22 
18:14:53] WARNING[21068]: app_voicemail.c:2233 inboxcount: Failed to obtain 
database object for 'asterisk'!<BR>&nbsp;&nbsp;&nbsp; -- Nobody picked up in 
15000 ms<BR>[Feb 22 18:14:57] NOTICE[21149]: cdr.c:434 ast_cdr_free: CDR on 
channel 'SIP/rwest200-19612180' not posted<BR>&nbsp;&nbsp;&nbsp; -- Executing 
BackGround("SIP/2441-ac047f90", 
"/var/lib/asterisk/sounds/rwestgreeting")<BR>&nbsp;&nbsp;&nbsp; -- 
&lt;SIP/2441-ac047f90&gt; Playing '/var/lib/asterisk/sounds/rwestgreeting' 
(language 'en')<BR>[Feb 22 18:15:04] WARNING[21068]: app_voicemail.c:2233 
inboxcount: Failed to obtain database object for 'asterisk'!<BR>&nbsp; == CDR 
updated on SIP/2441-ac047f90<BR>&nbsp;&nbsp;&nbsp; -- Executing 
Voicemail("SIP/2441-ac047f90", "<A 
href="mailto:200@rwest|u">200@rwest|u</A>")<BR>[Feb 22 18:15:09] WARNING[21149]: 
app_voicemail.c:1122 retrieve_file: Failed to obtain database object for 
'asterisk'!<BR>[Feb 22 18:15:09] WARNING[21149]: app_voicemail.c:1122 
retrieve_file: Failed to obtain database object for 'asterisk'!<BR>[Feb 22 
18:15:09] WARNING[21149]: app_voicemail.c:1122 retrieve_file: Failed to obtain 
database object for 'asterisk'!<BR>&nbsp;&nbsp;&nbsp; -- 
&lt;SIP/2441-ac047f90&gt; Playing 'vm-theperson' (language 
'en')<BR>&nbsp;&nbsp;&nbsp; -- &lt;SIP/2441-ac047f90&gt; Playing 'digits/2' 
(language 'en')<BR>&nbsp;&nbsp;&nbsp; -- &lt;SIP/2441-ac047f90&gt; Playing 
'digits/0' (language 'en')<BR>&nbsp;&nbsp;&nbsp; -- &lt;SIP/2441-ac047f90&gt; 
Playing 'digits/0' (language 'en')<BR>&nbsp;&nbsp;&nbsp; -- 
&lt;SIP/2441-ac047f90&gt; Playing 'vm-isunavail' (language 
'en')<BR>&nbsp;&nbsp;&nbsp; -- &lt;SIP/2441-ac047f90&gt; Playing 'vm-intro' 
(language 'en')<BR>[Feb 22 18:15:15] WARNING[21068]: app_voicemail.c:2233 
inboxcount: Failed to obtain database object for 'asterisk'!<BR>[Feb 22 
18:15:20] WARNING[21149]: app_voicemail.c:1187 last_message_index: Failed to 
obtain database object for 'asterisk'!<BR>&nbsp;&nbsp;&nbsp; -- 
&lt;SIP/2441-ac047f90&gt; Playing 'beep' (language 'en')<BR>&nbsp;&nbsp;&nbsp; 
-- Recording the message<BR>&nbsp;&nbsp;&nbsp; -- x=0, open writing:&nbsp; 
/var/spool/asterisk/voicemail/rwest/200/tmp/me15Bl format: wav, 
0x19652c30<BR>[Feb 22 18:15:26] WARNING[21068]: app_voicemail.c:2233 inboxcount: 
Failed to obtain database object for 'asterisk'!<BR>&nbsp;&nbsp;&nbsp; -- User 
hung up<BR>[Feb 22 18:15:26] WARNING[21149]: app_voicemail.c:1233 
message_exists: Failed to obtain database object for 'asterisk'!<BR>[Feb 22 
18:15:26] WARNING[21149]: app_voicemail.c:1263 delete_file: Failed to obtain 
database object for 'asterisk'!<BR>[Feb 22 18:15:26] WARNING[21149]: 
app_voicemail.c:1400 store_file: Failed to obtain database object for 
'asterisk'!<BR>[Feb 22 18:15:26] WARNING[21149]: app_voicemail.c:1122 
retrieve_file: Failed to obtain database object for 'asterisk'!<BR>[Feb 22 
18:15:26] WARNING[21149]: app_voicemail.c:2277 messagecount: Failed to obtain 
database object for 'asterisk'!<BR>[Feb 22 18:15:26] WARNING[21149]: 
app_voicemail.c:2277 messagecount: Failed to obtain database object for 
'asterisk'!<BR>&nbsp; == Spawn extension (rwest, 300, 1) exited non-zero on 
'SIP/2441-ac047f90'<BR></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>----------<BR>Mike Hammett<BR>Intelligent Computing 
Solutions<BR><A 
href="http://www.ics-il.com">http://www.ics-il.com</A></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV></BODY></HTML>