[asterisk-users] asterisk realtime

Szasz Szabolcs szasz.szabolcs at gmail.com
Mon Aug 25 07:08:30 CDT 2008


Hi!
I am running CentOS 5 with Asterisk 1.4.21.2  I am trying to setup storage of voicemail messages into MySQL. 
I installed 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:

[MySQL]
Description             = ODBC for MySQL
Driver          = /usr/lib/libmyodbc3.so
Setup           = /usr/lib/libodbcmyS.so
UsageCount              = 3

[MySQL ODBC 3.51 Driver]
Description             = ODBC 3.51 for MySQL
DRIVER          = /usr/lib/libmyodbc3.so
SETUP           = /usr/lib/libmyodbc3S.so
UsageCount              = 3

[root at localhost ~]# cat /usr/local/etc/odbc.ini
[astrealtime]
Description             = MySQL Asterisk database
Trace           = Off
TraceFile               = stderr
Driver          = MySQL
SERVER          = localhost
USER            = asterisk
PASSWORD                = 123qwe
PORT            = 3306
DATABASE                = asterisk

[root at localhost ~]# cat /etc/asterisk/res_odbc.conf
;;; odbc setup file

; ENV is a global set of environmental variables that will get set.
; Note that all environmental variables can be seen by all connections,
; so you can't have different values for different connections.
[ENV]
INFORMIXSERVER => my_special_database
INFORMIXDIR => /opt/informix

; All other sections are arbitrary names for database connections.

[asterisk]
enabled => yes
dsn => astrealtime
username => asterisk
password => 123qwe
pre-connect => yes


;[mysql2]
;enabled => no
;dsn => MySQL-asterisk
;username => myuser
;password => mypass
;pre-connect => yes
;
; On some databases, the connection times out and a reconnection will be
; necessary.  This setting configures the amount of time a connection
; may sit idle (in seconds) before a reconnection will be attempted.
;idlecheck => 3600

; Certain servers, such as MS SQL Server and Sybase use the TDS protocol, which
; limits the number of active queries per connection to 1.  By setting up pools
; of connections, Asterisk can be made to work with these servers.
;[sqlserver]
;enabled => no
;dsn => mickeysoft
;pooling => yes
;limit => 5
;username => oscar
;password => thegrouch
;pre-connect => yes
; Many databases have a default of '\' to escape special characters.  MS SQL
; Server does not.
;backslash_is_escape => no


When I am testing the odbc-mysql connection it seems that's OK:
[root at localhost ~]# isql -v astrealtime
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> 

But when I'm trying to access my voicemail from an extension I get these error messages is Asterisk CLI:

[Aug 25 16:55:58] WARNING[5080]: res_odbc.c:463 ast_odbc_request_obj: Failed to connect to asterisk
[Aug 25 16:55:58] ERROR[5080]: res_config_odbc.c:130 realtime_odbc: No database handle available with the name of 'asterisk' (check res_odbc.conf)
[Aug 25 16:55:58] NOTICE[5080]: res_odbc.c:530 odbc_obj_connect: Connecting asterisk
[Aug 25 16:55:58] WARNING[5080]: res_odbc.c:541 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified

Where is the problem? Please help!

Thanks a lot,

Szasz Szabolcs




More information about the asterisk-users mailing list