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
On Monday 25 August 2008 07:08:30 Szasz Szabolcs wrote:> 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!Might be something as simple as having two different libraries installed, one in /usr/local, and the other in /usr. A simple way to fix this would be to: ln -s /usr/local/etc/odbc.ini /etc/odbc.ini ln -s /usr/local/etc/odbcinst.ini /etc/odbcinst.ini If that works, you have library skew. Remove either one of the library sets, re-configure, and recompile Asterisk. -- Tilghman
Hi list! Thank for the help. Now, I can call the 8500 to listen to the inbound messages, change pin, but I have another problem. When I call a SIP extension configured in the MySQL database it says: "Call from '101' to extension '102' rejected because extension not found." My vmusers table: +----------+-------------+---------+---------+----------+----------+----------+-------+---------------------+ | uniqueid | customer_id | context | mailbox | password | fullname | email | pager | stamp | +----------+-------------+---------+---------+----------+----------+----------+-------+---------------------+ | 1 | 101 | default | 101 | 264241 | | mail at k.l | NULL | 2008-08-12 11:59:34 | | 2 | 102 | default | 102 | NULL | | mail at k.l | NULL | 2008-08-12 11:59:40 | +----------+-------------+---------+---------+----------+----------+----------+-------+---------------------+ sipusers table: +------+----------+--------+--------+------+----------+---------+---------+-----+---------+----------+----------+------------+----------+-------------+----------+-------+-------------+-----------+--------+------+------------+ | name | username | type | secret | host | callerid | context | mailbox | nat | qualify | fromuser | authuser | fromdomain | insecure | canreinvite | disallow | allow | restrictcid | defaultip | ipaddr | port | regseconds | +------+----------+--------+--------+------+----------+---------+---------+-----+---------+----------+----------+------------+----------+-------------+----------+-------+-------------+-----------+--------+------+------------+ | 101 | 101 | friend | NULL | home | NULL | default | 101 | yes | no | 101 | NULL | home | NULL | no | NULL | NULL | NULL | home | home | 5060 | NULL | | 102 | 102 | friend | NULL | home | NULL | default | 102 | yes | no | 102 | NULL | home | NULL | no | NULL | NULL | NULL | home | home | 5060 | NULL | +------+----------+--------+--------+------+----------+---------+---------+-----+---------+----------+----------+------------+----------+-------------+----------+-------+-------------+-----------+--------+------+------------+ Can you see the problem? Please help. Szasz Szabolcs ------------------------------ Message: 16 Date: Mon, 25 Aug 2008 10:23:31 -0500 From: Tilghman Lesher <tilghman at mail.jeffandtilghman.com> Subject: Re: [asterisk-users] asterisk realtime To: Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users at lists.digium.com> Message-ID: <200808251023.31584.tilghman at mail.jeffandtilghman.com> Content-Type: text/plain; charset="iso-8859-1" On Monday 25 August 2008 07:08:30 Szasz Szabolcs wrote:> > 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! >Might be something as simple as having two different libraries installed, one in /usr/local, and the other in /usr. A simple way to fix this would be to: ln -s /usr/local/etc/odbc.ini /etc/odbc.ini ln -s /usr/local/etc/odbcinst.ini /etc/odbcinst.ini If that works, you have library skew. Remove either one of the library sets, re-configure, and recompile Asterisk. -- Tilghman ------------------------------