Asterisk wouldn't connect through ODBC

Hi everyone,

I’m using Asterisk 1.8 on OpenSuse 11.3 and I’m trying to use a MySQL database to configure Asterisk, but Asterisk doesn’t connect through odbc. MySql and ODBC do function, but Asterisk doesn’t have any to load since I cann’t run odbc show in the CLI. I tried to copy from my source folder to the asterisk module folder and it tells me:

[Apr 26 15:33:28] WARNING[25710]: loader.c:777 inspect_module: Module '' was not compiled with the same compile-time options as this version of Asterisk. [Apr 26 15:33:28] WARNING[25710]: loader.c:778 inspect_module: Module '' will not be initialized as it may cause instability. [Apr 26 15:33:28] WARNING[25710]: loader.c:861 load_resource: Module '' could not be loaded.
My configurations are as follows:

[MySQL] Driver = /usr/lib/unixODBC/ Setup = /usr/lib/unixODBC/ FileUsage = 1
Testing the drive

# odbcinst -q -d [MySQL]

Description           = MySQL connection to 'asterisk' database
Driver                = MySQL
Database              = asterisk
Server                = localhost
UserName              = myusername 
Password              = mypassword
Port                  = 3306
Socket                = /var/run/mysql/mysql.sock[/code]
Validating ODBC
[code] # echo "select 1" | isql -v asterisk-connector
[MYODBCUtilReadDataSource.c][243][ERROR] Unknown attribute (UserName).
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
SQL> +---------------------+
| 1                   |
| 1                   |
SQLRowCount returns 1
1 rows fetched
SQL> # 

Then I did ./configure, make menuselect and make install. I made sure the necessary modules (cdr_odbc, cdr_adaptive_odbc,func_odbc, func_realtime, pbx_realtime, res_config_odbc, and res_odbc) were selected.

enabled => yes
dsn => asterisk-connector
username => myusername
password => mypassword
pre-connect => yes
pooling => no
limit => 1

Then I started Asterisk, but odbc show could not be run.
When I configure something in extconfig.conf, I always receive the warning that the mysql engine is not available.
Does any one have an idea, I’ve been working on this for almost a week now.

Thanks in advance :confused:


I myself am struggling with the ODBC connection, but :

My odbc.ini contains USER= … Yours contains UserName …

Considering it gives an error about the username you might have to change this to User= …

Hope that helps.

With kind regards

Hi Marco,

thanks for the reply. I used User and the isql error is gone, but my problem still remains even after reloading Asterisk.


Did you compile everything from source on the destination machine ?

Hi Marco,

how do you mean it. I compiled from the source, the untared Asterisk directory.


I am not an expert in asterisk, but as far as i can see the odbc module is giving a complaint that could be related to your compile.

That is strange, most people with this error with this error have installed it with a package manager.

There are several step for step tutorials available for a basic install, i would try following one step by step to make sure you dont forget a step. Look carefully at the feedback you are getting during the compile, it might give you some useful hints about what is going wrong. Also try to set the logging of asterisk to the highest debug level and a lot more information will be shown in the logs.

In short i compiled it like this:
In asterisk source directory:

[quote]./configure --with-odbc
make menuconfig (To select the options we need, or don’t need.)
make install [/quote]

I didnt have any problems loading the odbc module with these compile options.
I hope this helps.


Hi Marco,

I solved it by uninstalling Asterisk 1.8 and installing Asterisk 10.3.

Thanks though.