Asterisk CDR can be stored in mysql database using odbc conenctor. We can choose which cdr database module to use at the time of compilation and installation of asterisk using make menuselect .
You may encounter module errors If you configure wrong odbc drivers . For example if you look at following error lines , It says Can't open lib file.
We must install compatible odbc connectors and load the correct drives by editing /etc/odbcinst.in file.
In my case the problem was in /etc/odbcinst.ini it was pointing to libmyodbc5.so and I replaced it with libmyodbc8w.so which is the correct driver . I had to install correct connector files from mysql-connector-odbc-8.0.15-1.el7.x86_64.rpm package on cent OS 8 .
Using command
my /etc/odbcinst.ini is
[MySQL]
Description=ODBC for MySQL
Driver=/usr/lib64/libmyodbc8w.so
UsageCount=1
If you do not sepcify a correct data source you may encounter following error .
You may encounter module errors If you configure wrong odbc drivers . For example if you look at following error lines , It says Can't open lib file.
Code:
WARNING[37570]: res_odbc.c:1067 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Can't open lib '/usr/lib64/libmyodbc5.so' : file not found
NOTICE[37570]: res_odbc.c:706 load_odbc_config: Registered ODBC class 'asteriskcdrdb' dsn->[MySQL-asteriskcdrdb]
We must install compatible odbc connectors and load the correct drives by editing /etc/odbcinst.in file.
In my case the problem was in /etc/odbcinst.ini it was pointing to libmyodbc5.so and I replaced it with libmyodbc8w.so which is the correct driver . I had to install correct connector files from mysql-connector-odbc-8.0.15-1.el7.x86_64.rpm package on cent OS 8 .
Using command
Code:
rpm -ivh http://repo.mysql.com/yum/mysql-connectors-community/el/7/x86_64//mysql-connector-odbc-8.0.15-1.el7.x86_64.rpm
my /etc/odbcinst.ini is
[MySQL]
Description=ODBC for MySQL
Driver=/usr/lib64/libmyodbc8w.so
UsageCount=1
If you do not sepcify a correct data source you may encounter following error .
Code:
freepbx*CLI> module reload cdr_adaptive_odbc.so
Module 'cdr_adaptive_odbc.so' reloaded successfully.
-- Reloading module 'cdr_adaptive_odbc.so' (Adaptive ODBC CDR backend)
WARNING[3232]: res_odbc.c:1067 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
WARNING[3232]: cdr_adaptive_odbc.c:136 load_config: No such connection 'asteriskcdrdb' in the 'asteriskcdrdb' section of cdr_adaptive_odbc.conf. Check res_odbc.conf.