Asterisk+ODBC

I have setup an asterisk server and Configured res_odbc.conf, but it gave an error like this

WARNING[6676]: config.c:920 find_engine: Realtime mapping for ‘sip.conf’ found to engine ‘odbc’ , but the engine is not available

i’ve even tried [localhost]# isql MySQL-asterisk dbuser pasword
but this is the result
[IM002][unixODBC][Driver Manager] Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect

Please help me on this…

Have you compiled in support for ODBC? Asterisk will automatically compile it if it can find the ODBC development files.

Type

ls /usr/lib/asterisk/modules/odbc

It should list three modules.

/usr/lib/asterisk/modules/cdr_odbc.so
/usr/lib/asterisk/modules/res_config_odbc.so
/usr/lib/asterisk/modules/res_odbc.so

If you don’t have these modules then you probably don’t have the development files for unixODBC installed. Install these through your package management system, then recompile.

If you do have these modules then you don’t have unixODBC configured correctly. Run the following commands.

odbcinst -q -d
odbcinst -q -s

This should print the drivers you have installed and configured, and the data sources you have installed. If you don’t have any drivers / datasources installed you’ll need to install and configure them. I’m guessing from the ODBC error that this is the case.

You’ll need to do three things to get setup.

1.) Use you package management software to install the MySQL ODBC driver or install it from source.
2.) Use ‘odbcinst’ to configure the MySQL ODBC driver.
3.) Use ‘odbcinst’ to configure a datasource that uses the MySQL ODBC driver.

After you do this you should be able to use isql to connect to your database. Do not proceed to configuring Asterisk until you can connect with isql. If you cannot connect with isql, then Asterisk cannot either.

Dan

Had the same problem. Here is what solved my problem:

Please verify the following:

  1. The driver configuration file is named odbcinst.ini and is provided in the same path / directory / folder as odbc.ini
    
  2. The ODBC Initialization Path is a path / directory and not an actual path to the file (i.e. /root/odbc.ini). Please provide a directory path to where both odbcinst.ini and odbc.ini files exist.
    
  3. The Driver name defined in odbcinst.ini is the same as the Driver attribute defined in the datasource of odbc.ini.
    
  4. Note: If odbcinst.ini has the driver defined as “[ODBC Driver 13 for SQL Server]” then verify the odbc.ini references “Driver=ODBC Driver 13 for SQL Server”
    

source: https://support.microfocus.com/kb/doc.php?id=7017884