Re: [asterisk-users] ODBC problem - static realtime file not loading SOLVED (properly this time)

2011-12-18 Thread Brynjolfur Thorvardsson
Hi Warren

According to the book I'm using as well as the documentation on Asterisk 1.8 
you should remove the musiconhold.conf file from /etc/asterisk if you want to 
read it from a database. From what you say it looks as if you can have both. 
Maybe not with the same classes?

You are right about the bug ticket. From what I can gather, the database is 
defined once for the ODBC driver for each connector (in /etc/odbc.ini). To 
connect Asterisk to ODBC you need to define a class in res_odbc.conf which 
points to the ODBC connector. After thinking about this I suppose that what is 
actually going on is this:


1)  In odbc.ini you define one or more ODBC connectors. Each connector has 
one database.

2)  In /etc/asterisk/res_odbc.conf you specify one or more ODBC Asterisk 
connectors, each pointing to an ODBC connector.

3)  In /etc/asterisk/extconfig.conf you put in a line that calls the ODBC 
driver, the Asterisk connector and optional database. So the syntax of a line 
should be:

 => ,[,]

In my case, the database user and Asterisk connector were both named 
"asterisk", which confused me into thinking that the extconfig.conf file needed 
the username. That's not very logical, so I tried changing my Asterisk 
connector name to [asterisk-odbc] and the line in extconfig.conf to:
 Musiconhold.conf = 
odbc,asterisk-odbc,asterisk_files

This works fine. In the book, all things are named "asterisk" - the database 
user, the database and the Asterisk connector. If I had done the same, 
everything would have worked fine for me. But since I am working on an 
RoR-based management interface (just for fun ...) I needed a database with the 
_development extension, and from there everything went wrong.

Anyway i've sent in a bug ticket as you suggested, this may of course be 
something that has changed since version 1.14 , and anyway, the "bug" is really 
in the documentation in the Asterisk Wiki and not in Asterisk as such.

Regards

Binni

Fra: asterisk-users-boun...@lists.digium.com 
[mailto:asterisk-users-boun...@lists.digium.com] På vegne af Warren Selby
Sendt: 17. december 2011 21:42
Til: Asterisk Users Mailing List - Non-Commercial Discussion
Emne: Re: [asterisk-users] ODBC problem - static realtime file not loading

On Fri, Dec 16, 2011 at 6:06 AM, Brynjolfur Thorvardsson 
mailto:bi...@itanet.nu>> wrote:


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


I had always thought you still needed the musiconhold.conf file with at least 
one MOH class defined so that asterisk will load the MOH module.  Once it loads 
the module, then it should read from the database as well.  I don't know why 
this works, but it's the way I've always done it. If this behavior resolves 
your issue, perhaps a bug ticket is in order on 
https://issues.asterisk.org/jira/ .


--
Thanks,
--Warren Selby, dCAP
http://www.SelbyTech.com<http://www.selbytech.com>


--
_
-- 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

Re: [asterisk-users] ODBC problem - static realtime file not loading

2011-12-17 Thread Warren Selby
On Fri, Dec 16, 2011 at 6:06 AM, Brynjolfur Thorvardsson wrote:


>
>
> 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
>
>
>
I had always thought you still needed the musiconhold.conf file with at
least one MOH class defined so that asterisk will load the MOH module.
Once it loads the module, then it should read from the database as well.  I
don't know why this works, but it's the way I've always done it. If this
behavior resolves your issue, perhaps a bug ticket is in order on
https://issues.asterisk.org/jira/ .


-- 
Thanks,
--Warren Selby, dCAP
http://www.SelbyTech.com 
--
_
-- 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

Re: [asterisk-users] ODBC problem - static realtime file not loading

2011-12-16 Thread Chet W. Stevens
I am out of the office until 12/16 but I will still be checking my
messages. For immediate assistance, please call Telecommunication Services
at 799-6543. Thank you.

Chet Stevens
Telecommunication Services
Clark County School District

--
_
-- 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

[asterisk-users] ODBC problem - static realtime file not loading

2011-12-16 Thread Brynjolfur Thorvardsson
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
WWW: http://www.itanet.nu


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

<>--
_
-- 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