[SOLVED]No records on CDR

Hello,

centos 8 on raspberry pi4. Installed asterisk 17, everythink is ok except that no cdr records are written.

  1. nano /etc/asterisk/cdr_adaptive_odbc.conf
[asteriskcdrdb]
connection=asteriskcdrdb
loguniqueid=1
table=cdr
alias start => calldate
  1. nano /etc/odbc.ini
[MySQL-asteriskcdrdb]
Description=MySQL connection to 'asteriskcdrdb' database
driver=MySQL
server=localhost
database=asteriskcdrdb
Port=3306
Socket=/var/lib/mysql/mysql.sock
option=3
Charset=utf8

Commands below gives:

localhost*CLI> module reload res_odbc.so
Module 'res_odbc.so' reloaded successfully.
[2021-04-05 13:21:55] 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
[2021-04-05 13:21:55] NOTICE[37570]: res_odbc.c:706 load_odbc_config: Registered ODBC class 'asteriskcdrdb' dsn->[MySQL-asteriskcdrdb]
localhost*CLI> module reload cdr_adaptive_odbc.so
Module 'cdr_adaptive_odbc.so' reloaded successfully.
[2021-04-05 13:22:51] 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
[2021-04-05 13:22:51] WARNING[37570]: cdr_adaptive_odbc.c:136 load_config: No such connection 'asteriskcdrdb' in the 'asteriskcdrdb' section of cdr_adaptive_odbc.conf.  Check res_odbc.conf.
[2021-04-05 13:22:51] WARNING[37570]: cdr_adaptive_odbc.c:136 load_config: No such connection 'asteriskcdrdb' in the 'asteriskcdrdb' section of cdr_adaptive_odbc.conf.  Check res_odbc.conf.
localhost*CLI> cdr show status

Call Detail Record (CDR) settings
----------------------------------
  Logging:                    Enabled
  Mode:                       Simple
  Log unanswered calls:       No
  Log congestion:             No

* Registered Backends
  -------------------
    csv
    cdr_manager (suspended)
    Adaptive ODBC

localhost*CLI> odbc show
localhost*CLI>

ODBC DSN Settings
-----------------

  Name:   asteriskcdrdb
  DSN:    MySQL-asteriskcdrdb
    Last fail connection attempt: 2021-04-05 13:22:51
    Number of active connections: 0 (out of 5)
    Logging: Disabled

Any thoughts?

The MySQL ODBC driver does not appear to be installed at the library location configured in UnixODBC (outside of Asterisk).

Ok,so how is it resolved?

I don’t know CentOS, or Raspberry Pi, so I can’t answer that. Someone else may be able to provide guidance or you can try to figure it out.

First make sure it is installed:


yum install -y unixODBC unixODBC-devel

It is,

[root@localhost lib64]# dnf install -y unixODBC unixODBC-devel
Last metadata expiration check: 0:32:40 ago on Mon 05 Apr 2021 04:28:32 PM UTC.
Package unixODBC-2.3.7-1.el8.aarch64 is already installed.
Package unixODBC-devel-2.3.7-1.el8.aarch64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

ok i found this:

> [root@localhost lib64]# cat /etc/odbcinst.ini
> [PostgreSQL]
> Description=ODBC for PostgreSQL
> Driver=/usr/lib/psqlodbcw.so
> Setup=/usr/lib/libodbcpsqlS.so
> Driver64=/usr/lib64/psqlodbcw.so
> Setup64=/usr/lib64/libodbcpsqlS.so
> FileUsage=1
> 
> [MySQL]
> Description=ODBC for MySQL
> Driver=/usr/lib/libmyodbc5.so  **<--this file does not exists!**
> Setup=/usr/lib/libodbcmyS.so  **<--this file does not exists!**
> Driver64=/usr/lib64/libmyodbc5.so    **<--this file does not exists!**
> Setup64=/usr/lib64/libodbcmyS.so     **<--this file does not exists!**
> FileUsage=1
> 
> [FreeTDS]
> Description=Free Sybase & MS SQL Driver
> Driver=/usr/lib/libtdsodbc.so
> Setup=/usr/lib/libtdsS.so
> Driver64=/usr/lib64/libtdsodbc.so
> Setup64=/usr/lib64/libtdsS.so
> Port=1433
> 
> [MariaDB]
> Description=ODBC for MariaDB
> Driver=/usr/lib/libmaodbc.so **<--this file does not exists!**
> Driver64=/usr/lib64/libmaodbc.so  **<--this file does not exists!**
> FileUsage=1
> 
> [MySQL ODBC 8.0 Unicode Driver]
> Driver=/usr/lib64/libmyodbc8w.so  **<--this file DOES exists!!**
> UsageCount=1
> 
> [MySQL ODBC 8.0 ANSI Driver]
> Driver=/usr/lib64/libmyodbc8a.so  **<--this file DOES exists!!** 
> UsageCount=1

Ok, I found the solution…

[root@localhost lib64]# cat /etc/odbcinst.ini
> [MySQL]
> Description=ODBC for MySQL
> Driver=/usr/lib/libmyodbc5.so  **<--this file does not exists!**
> Setup=/usr/lib/libodbcmyS.so  **<--this file does not exists!**
> Driver64=/usr/lib64/libmyodbc8w.so    <--change this!!!!!
> Setup64=/usr/lib64/libodbcmyS.so     **<--this file does not exists!**
> FileUsage=1

it seems that centos 8 has new libraries…

1 Like