WARNING: this is an automatic post retrieved from the Asterisk-Users Mailing List, not an authored post
December 16, 2011
Tags: asterisk, definite guide, isql, line loads, musiconhold, MySQL, SQL, sql auto
I’m trying to configure my Asterisk setup to load the musiconhold.conf file from an ODBC connection to MySQL, working through the example given in the excellent book “Asterisk: The Definite Guide”. I’m using Asterisk 1.4.19 and MySQL 5.1.58. I’ve configured the ODBC bit and in my GeneralLog on MySQL I can see the asterisk user connecting and sending a few SQL statements, such as “SET SQL_AUTO_IS_NULL = 0″.
After connecting, the asterisk user never sends another SQL statement, at least nothing that shows up in the General log. Asterisk is running as root. I’ve deleted the musiconhold.conf file from /etc/asterisk
Testing odbc from command line ( there is a difference from what the book says, I need to use sudo for isql to work, presumably since * is running as root)
$ odbcinst -q -d
$echo “select 1″ | sudo isql -v asterisk-connector
| Connected! |
| sql-statement |
| help [tablename] |
| quit |
SQL> select 1
| 1 |
| 1 |
SQLRowCount returns 1
1 rows fetched
The extconfig.conf file gets parsed, and looks like this:
musiconhold.conf => odbc,asterisk_development,asterisk_files
The modules.conf contains only:
preload => res_odbc.so
preload => res_config_odbc.so
On starting Asterisk with -cv I get the following:
[Dec 16 11:08:38] WARNING: res_musiconhold.c:1309 load_module: No music on hold classes configured, disabling music on hold.
[Dec 16 11:08:38] res_musiconhold.so => (Music On Hold Resource)
The second line loads the module in spite of the warning in the first line. The following commands give:
*CLI> moh show classes
*CLI> odbc show
*CLI> module reload res_musiconhold.so
*CLI>moh show classes
I guess the problem could lie with the database itself but I’ve checked and double-checked the column names and defs, and the asterisk user has full access rights to the database.
The SQL insert for the database looks like this:
INSERT INTO `asterisk_files` (`id`, `cat_metric`, `var_metric`, `filename`, `category`, `var_name`, `var_val`, `commented`, `created_at`, `updated_at`) VALUES
(1, 1, 1, ‘musiconhold.conf’, ‘default’, ‘mode’, ‘files’, 0, NULL, NULL),
(2, 1, 2, ‘musiconhold.conf’, ‘default’, ‘directory’, ‘/var/lib/asterisk/moh’, 0, NULL, NULL);
The two last columns (created_at, updated_at) were created by Rails, but I’ve also tried pointing Asterisk to a view without those two columns.
Basically, the ODBC connection works but it seems as if Asterisk never tries to read the definitions from the database. Any help would be greatly appreciated!
Telefon: 3020 0868