Asterisk 11.6-cert2
Ubuntu Server 12.04.4 LTS
unixODBC 2.2.14
When performing a query from the dialplan using func_odbc to a network based MySQL server, if the network become unavailable then the query hangs indefinitely. In fact, all other queries to still available MySQL data sources hang as well. I have tried every setting I can find to add a timeout but I have been unsuccessful. Here is a sample config:
odbc.ini
[code]
[database1]
Description = Database 1.
Driver = MySQL
Database = directory
Server = 10.x.x.1
User = directory
Password = password
Port = 3306
Socket = /var/run/mysqld/mysqld.sock
[database2]
Description = Database 2.
Driver = MySQL
Database = directory
Server = 10.x.x.2
User = directory
Password = password
Port = 3306
Socket = /var/run/mysqld/mysqld.sock[/code]
res_odbc.conf
[code][database1]
enabled => yes
dsn => database1
username => directory
password => password
pooling => no
limit => 1
pre-connect => yes
connect_timeout => 1
[database2]
enabled => yes
dsn => test-connector
username => directory
password => password
pooling => no
limit => 1
pre-connect => yes
connect_timeout => 1
readtimeout = 1[/code]
func_odbc.conf
[code][CLID_NAME]
dsn=databse1
readsql=SELECT name FROM clid_names WHERE clid = ‘${SQL_ESC(${ARG1})}’;
[TEST_CLID_NAME]
dsn=databse2
readsql=SELECT name FROM clid_names WHERE clid = ‘${SQL_ESC(${ARG1})}’;[/code]
I then purposely take one of the two MySQL servers off the network. The point in my dialplan that performs the ODBC functions hangs. I then try to dial a different part of the dialplan that is to the operational server and that dialplan hangs as well. I have searched for any configuration I could find for odbc.ini and res_odbc.conf concerning connection timeouts and nothing has affected this. Does anyone have any ideas? Thank you.