CDR backend problem (unable to connect to the database)


I’m having a problem with the CDRs not being written into the database lately. They have never worked, but I think I’m rather close to fix this. I was hoping someone can help understanding what the problem is. I’m running Asterisk 16 and FreePBX 15 on Debian.

I can connect to database with mysql and the below configured user fine. I cannot somehow make connection between asterisk and database and I get this error

– Reloading module ‘’ (ODBC resource)
[2019-01-22 16:20:24] WARNING[7978]: res_odbc.c:941 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
[2019-01-22 16:20:24] NOTICE[7978]: res_odbc.c:596 load_odbc_config: Registered ODBC class ‘asteriskcdrdb’ dsn->[MySQL-asteriskcdrdb]
[2019-01-22 16:20:24] NOTICE[7978]: res_odbc.c:488 load_odbc_config: Adding ENV var: ODBCSYSINI=/etc
[2019-01-22 16:20:24] NOTICE[7978]: res_odbc.c:488 load_odbc_config: Adding ENV var: ODBCINI=/etc/odbc.ini
– Reloading module ‘extconfig’ (Configuration)
– Reloading module ‘’ (Realtime ODBC configuration)
– Reloading module ‘cdr’ (CDR Engine)
[2019-01-22 16:20:24] NOTICE[7978]: cdr.c:4485 cdr_toggle_runtime_options: CDR simple logging enabled.
– Reloading module ‘’ (Adaptive ODBC CDR backend)
[2019-01-22 16:20:24] WARNING[7978]: res_odbc.c:941 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
[2019-01-22 16:20:24] WARNING[7978]: cdr_adaptive_odbc.c:136 load_config: No such connection ‘asteriskcdrdb’ in the ‘asteriskcdrdb’ section of cdr_adaptive_odbc.conf. Check res_odbc.conf.

Description=MySQL connection to ‘asteriskcdrdb’ database

Description = ODBC for MySQL
Driver64 = /usr/lib/x86_64-linux-gnu/
Setup64 = /usr/lib/x86_64-linux-gnu/odbc/
#Driver64 = /usr/lib64/
#Setup64 = /usr/lib64/
FileUsage = 1
Pooling = Yes
CPTimeout = 120

#include res_odbc_custom.conf
#include res_odbc_additional.conf
ODBCINI => /etc/odbc.ini


Now I think that error tries to tell me I don’t have Data Source configured in the odbc.ini, but I don’t know how to configure it. I’ve found this somewhere else, but I’m struggling to see what should I use for Asterisk

[ODBC Data Sources]
MapR Drill 32-bit=MapR Drill ODBC Driver 32-bit
MapR Drill 64-bit=MapR Drill ODBC Driver 64-bit

Secondly, even isql is giving me error.

isql -v asteriskcdrdb cdruser password
[IM004][unixODBC][Driver Manager]Driver’s SQLAllocHandle on SQL_HANDLE_HENV failed
[ISQL]ERROR: Could not SQLConnect

Does anyone please know how to configure Data Source in odbc configuration and how can I perhaps make changes to the configuration in FreePBX GUI (as I cannot make changes to the res_odbc.conf in shell) so I can proceed? I’m out of ideas.

Thank you,
Kind regards,

You have no DSN for MYSQL-asteriskcdrdb just asteriskcdrdb

Hi Tom, just to make sure I’m on the same page. Shall I then change every occurrence of ‘MySQL-asteriskcdrdb’ to ‘asteriskcdrdb’

#Edit: I tried changing the values to asteriskcdrdb but I could still see this in asterisk console

ODBC DSN Settings

Name: asteriskcdrdb
DSN: MySQL-asteriskcdrdb
Last fail connection attempt: 2019-01-22 17:38:43
Number of active connections: 0 (out of 5)

The configuration of res_odbc_additional.conf changes itself after reboot back to MySQL-asteriskcdrdb


My CDR manager is running, I’m still not sure what is the problem.
module load cdr_manager
Unable to load module cdr_manager
Command ‘module load cdr_manager’ failed.
[2019-01-24 21:48:09] WARNING[4328]: loader.c:1631 load_resource: Module ‘cdr_manager’ already loaded and running.

And, I was fixing until I broke it. I can’t use fwconsole anymore (reload, status, restart won’t work)
Whoops\Exception\ErrorException: Methods with the same name as their class will not be constructors in a future version of PHP; gui_link_nw_tab has a deprecated constructor in file /var/www/html/admin/modules/endpointman/ on line 284
Stack trace:
_ 1. Whoops\Exception\ErrorException->() /var/www/html/admin/modules/endpointman/
_ 2. Whoops\Run->handleError() /var/www/html/admin/bootstrap.php:364_
_ 3. require_once() /var/www/html/admin/bootstrap.php:364_
_ 4. require_once() /etc/freepbx.conf:9_
_ 5. include_once() /var/lib/asterisk/bin/fwconsole:12_

Okay, just found out it’s a known issue

Is there any entry in FreePBX for CDR settings? Is it supposed to be changed via shell?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.