Hi all

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
[MySQL]
$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:

[settings]
musiconhold.conf => odbc,asterisk_development,asterisk_files

The modules.conf contains only:

[modules]
preload => res_odbc.so
preload => res_config_odbc.so
autoload=yes

On starting Asterisk with -cv I get the following:
[Dec 16 11:08:38] WARNING[1632]: 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
Name: asterisk
DSN: asterisk-connector
Pooled: no
Connected: yes
*CLI> module reload res_musiconhold.so
*CLI>moh show classes
*CLI>

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!

Regards

Binni

ITAnet
Kirkestien 20
9230  Svenstrup

Telefon: 3020 0868

Email: bi...@itanet.nu<mailto:i...@itanet.nu>
WWW: http://www.itanet.nu<http://www.itanet.nu/>


[cid:image001.gif@01CCBBE7.6E001380]

<<inline: image001.gif>>

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to