<!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>
<DIV><FONT face=Arial size=2>[root@Aiur asterisk]# cat
/etc/odbc.ini<BR>[astrealtime]<BR>Description
= MySQL ODBC For
Asterisk<BR>Trace =
Yes<BR>TraceFile
= /tmp/odbc.log<BR>Driver
= MySQL<BR>Server =
localhost<BR>User
=
astrealtime<BR>Password
=
XXXX<BR>Database
= asterisk<BR>Socket =
/var/lib/mysql/mysql.sock</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>[root@Aiur asterisk]# cat
/etc/odbcinst.ini<BR>[MySQL]<BR>Description
= ODBC for MySQL<BR>Driver
=
/usr/lib/libmyodbc.so<BR>Setup
=
/usr/lib/libodbcmyS.so<BR>UsageCount
= 4</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>[MySQL ODBC 3.51
Driver]<BR>Description
= ODBC 3.51 for
MySQL<BR>DRIVER =
/usr/lib/libmyodbc3.so<BR>SETUP
=
/usr/lib/libmyodbc3S.so<BR>UsageCount
= 4</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>[root@Aiur asterisk]# isql astrealtime astrealtime
XXXX<BR>[ISQL]ERROR: Could not SQLConnect</FONT></DIV>
<DIV><FONT face=Arial size=2>[root@Aiur asterisk]# locate
libmyodbc<BR>/usr/lib64/libmyodbc3-3.51.12.so<BR>/usr/lib64/libmyodbc3.so<BR>/usr/lib64/libmyodbc3_r-3.51.12.so<BR>/usr/lib64/libmyodbc3_r.so<BR>[root@Aiur
asterisk]# locate
libodbcmyS<BR>/usr/lib/libodbcmyS.a<BR>/usr/lib/libodbcmyS.so<BR>/usr/lib/libodbcmyS.so.1<BR>/usr/lib/libodbcmyS.so.1.0.0<BR>/usr/lib64/libodbcmyS.a<BR>/usr/lib64/libodbcmyS.so<BR>/usr/lib64/libodbcmyS.so.1<BR>/usr/lib64/libodbcmyS.so.1.0.0<BR>[root@Aiur
asterisk]# rpm -qa | grep odbc<BR>mysql-connector-odbc-3.51.12-2.2<BR>[root@Aiur
asterisk]# rpm -qa | grep
ODBC<BR>unixODBC-2.2.11-7.1<BR>unixODBC-2.2.11-7.1<BR>unixODBC-devel-2.2.11-7.1<BR>unixODBC-devel-2.2.11-7.1<BR>[root@Aiur
asterisk]# mysql -u astrealtime -p<BR>Enter password:<BR>Welcome to the MySQL
monitor. Commands end with ; or \g.<BR>Your MySQL connection id is 484 to
server version: 5.0.22</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Type 'help;' or '\h' for help. Type '\c' to clear
the buffer.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>mysql> 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</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Database changed<BR>mysql> show
tables;<BR>+--------------------+<BR>| Tables_in_asterisk
|<BR>+--------------------+<BR>|
cdr
|<BR>| extensions_table |<BR>|
iax
|<BR>| queue_members |<BR>|
queues
|<BR>|
sip
|<BR>| voicemail_messages |<BR>| voicemail_users
|<BR>+--------------------+<BR>8 rows in set (0.00 sec)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> -- Executing
[s-NOANSWER@macro-stdexten:1] VoiceMail("SIP/9826-ac087500", "<A
href="mhtml:{0916BD85-977B-435E-8613-81F94FE157CF}mid://00000011/!x-usc:mailto:200@ics%7Cu">200@ics|u</A>")
in new stack<BR>[Mar 11 21:29:36] NOTICE[26144]: res_odbc.c:508
odbc_obj_connect: Connecting mysql<BR>[Mar 11 21:29:36] WARNING[26144]:
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>[Mar 11 21:29:36] WARNING[26144]: res_odbc.c:444
ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11 21:29:36]
WARNING[26144]: app_voicemail.c:1122 retrieve_file: Failed to obtain database
object for 'mysql'!<BR>[Mar 11 21:29:36] NOTICE[26144]: res_odbc.c:508
odbc_obj_connect: Connecting mysql<BR>[Mar 11 21:29:36] WARNING[26144]:
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>[Mar 11 21:29:36] WARNING[26144]: res_odbc.c:444
ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11 21:29:36]
WARNING[26144]: app_voicemail.c:1122 retrieve_file: Failed to obtain database
object for 'mysql'!<BR>[Mar 11 21:29:36] NOTICE[26144]: res_odbc.c:508
odbc_obj_connect: Connecting mysql<BR>[Mar 11 21:29:36] WARNING[26144]:
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>[Mar 11 21:29:36] WARNING[26144]: res_odbc.c:444
ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11 21:29:36]
WARNING[26144]: app_voicemail.c:1122 retrieve_file: Failed to obtain database
object for 'mysql'!<BR> -- <SIP/9826-ac087500> Playing
'vm-theperson' (language 'en')<BR> --
<SIP/9826-ac087500> Playing 'digits/2' (language
'en')<BR> -- <SIP/9826-ac087500> Playing 'digits/0'
(language 'en')<BR> -- <SIP/9826-ac087500> Playing
'digits/0' (language 'en')<BR> -- <SIP/9826-ac087500>
Playing 'vm-isunavail' (language 'en')<BR> --
<SIP/9826-ac087500> Playing 'vm-intro' (language 'en')<BR>[Mar 11
21:29:46] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting
mysql<BR>[Mar 11 21:29:46] WARNING[26144]: 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>[Mar 11 21:29:46] WARNING[26144]:
res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11
21:29:46] WARNING[26144]: app_voicemail.c:1187 last_message_index: Failed to
obtain database object for 'mysql'!<BR> --
<SIP/9826-ac087500> Playing 'beep' (language 'en')<BR>
-- Recording the message<BR> -- x=0, open writing:
/var/spool/asterisk/voicemail/ics/200/tmp/oDVLVZ format: wav49,
0x1230a0a0<BR> -- x=1, open writing:
/var/spool/asterisk/voicemail/ics/200/tmp/oDVLVZ format: gsm,
0x122ea400<BR> -- x=2, open writing:
/var/spool/asterisk/voicemail/ics/200/tmp/oDVLVZ format: wav,
0x122f3740<BR> -- User hung up<BR>[Mar 11 21:30:25]
NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql<BR>[Mar 11
21:30:25] WARNING[26144]: 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>[Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444
ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11 21:30:25]
WARNING[26144]: app_voicemail.c:1233 message_exists: Failed to obtain database
object for 'mysql'!<BR>[Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508
odbc_obj_connect: Connecting mysql<BR>[Mar 11 21:30:25] WARNING[26144]:
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>[Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444
ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11 21:30:25]
WARNING[26144]: app_voicemail.c:1263 delete_file: Failed to obtain database
object for 'mysql'!<BR>[Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508
odbc_obj_connect: Connecting mysql<BR>[Mar 11 21:30:25] WARNING[26144]:
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>[Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444
ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11 21:30:25]
WARNING[26144]: app_voicemail.c:1400 store_file: Failed to obtain database
object for 'mysql'!<BR>[Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508
odbc_obj_connect: Connecting mysql<BR>[Mar 11 21:30:25] WARNING[26144]:
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>[Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444
ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11 21:30:25]
WARNING[26144]: app_voicemail.c:1122 retrieve_file: Failed to obtain database
object for 'mysql'!<BR>[Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508
odbc_obj_connect: Connecting mysql<BR>[Mar 11 21:30:25] WARNING[26144]:
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>[Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444
ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11 21:30:25]
WARNING[26144]: app_voicemail.c:2277 messagecount: Failed to obtain database
object for 'mysql'!<BR>[Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508
odbc_obj_connect: Connecting mysql<BR>[Mar 11 21:30:25] WARNING[26144]:
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>[Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444
ast_odbc_request_obj: Failed to connect to mysql<BR>[Mar 11 21:30:25]
WARNING[26144]: app_voicemail.c:2277 messagecount: Failed to obtain database
object for 'mysql'!<BR> == Spawn extension (macro-stdexten, s-NOANSWER, 1)
exited non-zero on 'SIP/9826-ac087500' in macro 'stdexten'<BR> == Spawn
extension (macro-stdexten, s-NOANSWER, 1) exited non-zero on
'SIP/9826-ac087500'<BR></FONT></DIV></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>----------<BR>Mike Hammett<BR>Intelligent Computing Solutions<BR><A
href="http://www.ics-il.com">http://www.ics-il.com</A></DIV>
<DIV> </DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=asterisk-users@ics-il.net
href="mailto:asterisk-users@ics-il.net">Mike Hammett</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=asterisk-users@lists.digium.com
href="mailto:asterisk-users@lists.digium.com">Asterisk Users Mailing List -
Non-Commercial Discussion</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, February 22, 2008 7:28
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [asterisk-users] MySQL Voicemail
Storage Questions\Errors</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>I am running CentOS 5 with Asterisk 1.4.14.
I am trying to setup storage of voicemail messages into MySQL. It is my
understanding that I can only do this via ODBC. 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>
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. Here is the output of some config
files:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </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> </DIV>
<DIV><FONT face=Arial size=2># Included in the unixODBC
package<BR>#[PostgreSQL]<BR>#Description = ODBC for
PostgreSQL<BR>#Driver =
/usr/lib/libodbcpsql.so<BR>#Setup
= /usr/lib/libodbcpsqlS.so<BR>#FileUsage =
1</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><FONT face=Arial size=2>
<DIV><BR># Driver from the MyODBC package<BR># Setup from the unixODBC
package<BR>[MySQL]<BR>Description = ODBC for
MySQL<BR>Driver =
/usr/lib64/libmyodbc3.so<BR>Setup
= /usr/lib64/libodbcmyS.so<BR>FileUsage =
1<BR>You have new mail in /var/spool/mail/root<BR>[root@Aiur asterisk]# cat
/etc/odbc.ini<BR>[astrealtime]<BR>Description =
Asterisk realtime FUNC_ODBC
access<BR>Driver =
MySQL<BR>Socket =
/var/lib/mysql/mysql.sock<BR>Server
=
localhost<BR>User
=
astrealtime<BR>Pass
= XXXX<BR>Database =
asterisk<BR>Option =
3<BR>[root@Aiur asterisk]# cat /etc/asterisk/res_odbc.conf<BR>;;; odbc
setup file</DIV>
<DIV> </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 =>
my_special_database<BR>INFORMIXDIR => /opt/informix</DIV>
<DIV> </DIV>
<DIV>; All other sections are arbitrary names for database connections.</DIV>
<DIV> </DIV>
<DIV>[asterisk]<BR>enabled => no<BR>dsn => asterisk<BR>;username =>
myuser<BR>;password => mypass<BR>pre-connect => yes</DIV>
<DIV> </DIV>
<DIV><BR>[mysql]<BR>enabled => yes<BR>dsn => MySQL-asterisk<BR>username
=> astrealtime<BR>password => XXXX<BR>pre-connect => yes</DIV>
<DIV> </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. By
setting up pools<BR>; of connections, Asterisk can be made to work with these
servers.<BR>[sqlserver]<BR>enabled => no<BR>dsn => mickeysoft<BR>pooling
=> yes<BR>limit => 5<BR>username => oscar<BR>password =>
thegrouch<BR>pre-connect => yes</DIV>
<DIV> </DIV>
<DIV> </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> == 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->[MySQL-asterisk]<BR>[Feb 22 18:21:46] NOTICE[21214]: res_odbc.c:684
load_module: res_odbc loaded.<BR>res_odbc.so => (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 =>
(ODBC Configuration)<BR> == Parsing '/etc/asterisk/func_odbc.conf':
Found<BR>func_odbc.so => (ODBC lookups)<BR> == Parsing
'/etc/asterisk/cdr_odbc.conf': Found<BR>cdr_odbc.so => (ODBC CDR
Backend)</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>[root@Aiur asterisk]# mysql -u root -p<BR>Enter password:<BR>Welcome to
the MySQL monitor. Commands end with ; or \g.<BR>Your MySQL connection
id is 22 to server version: 5.0.22</DIV>
<DIV> </DIV>
<DIV>Type 'help;' or '\h' for help. Type '\c' to clear the buffer.</DIV>
<DIV> </DIV>
<DIV>mysql> 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> </DIV>
<DIV>Database changed<BR>mysql> describe
voicemail_messages;<BR>+----------------+-------------+------+-----+---------+----------------+<BR>|
Field |
Type | Null | Key | Default |
Extra
|<BR>+----------------+-------------+------+-----+---------+----------------+<BR>|
id |
int(11) | NO | PRI |
NULL | auto_increment |<BR>|
msgnum |
int(11) | NO | |
0
|
|<BR>| dir |
varchar(80) | YES | MUL | NULL
|
|<BR>| context | varchar(80) |
YES | | NULL
|
|<BR>| macrocontext | varchar(80) | YES
| | NULL
|
|<BR>| callerid | varchar(40) | YES
| | NULL
|
|<BR>| origtime | varchar(40) | YES
| | NULL
|
|<BR>| duration | varchar(20) | YES
| | NULL
|
|<BR>| mailboxuser | varchar(80) | YES
| | NULL
|
|<BR>| mailboxcontext | varchar(80) | YES | |
NULL
|
|<BR>| recording | longblob |
YES | | NULL
|
|<BR>+----------------+-------------+------+-----+---------+----------------+<BR>11
rows in set (0.00 sec)</DIV>
<DIV> </DIV>
<DIV>mysql> exit;<BR>Bye</FONT></DIV></BLOCKQUOTE></BODY></HTML>