CDR not working on fresh install

CDR doesnt work on a fresh install of Asterisk 20 and FreePBX 16, manually installed, on Ubuntu LTS 22.04

I have enabled “CDR Logging” in the Advanced settings, rebooted, and “cdr show status” shows:

cdr show status

Call Detail Record (CDR) settings

Logging: Enabled
Mode: Simple
Log calls by default: Yes
Log unanswered calls: No
Log congestion: No

Ignore bridging changes: No

Ignore dial state changes: No

  • Registered Backends

    cdr_manager (suspended)
    Adaptive ODBC

Whenever I make a call, its not logged in the CDR table.

Could be related to the issue I’m having with the cdr module: Unable to access old CDR reports and call recordings after upgrade from 15 to 16 - #7 by kamilk

You can try downgrading the module version, as per above link.

tried it, didnt work unfortunately. Im going to try with Asterisk 18 now.

I had an issue with CDR not showing as well and was baffled beyond words but after much trial and error I have found the solution.

#Install FreePBX
cd /usr/src
tar zxf freepbx-16.0-latest.tgz
cd freepbx

#Create Asterisk Database and Privileges
mysqladmin -p create asterisk

mysqladmin -p create asteriskcdrdb

mysql -p

GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY ‘PASSWORD’;
GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY ‘PASSWORD’;
flush privileges;
\q

#Update PEAR modules
pear channel-update pear.php.net
pear install DB MDB2 MDB2 MDB2#mysql MDB2#mysqli MDB2#sqlite

#Install MySQL Connector
cd /usr/src
tar zxf mariadb-connector-odbc-3.1.19-ubuntu-focal-amd64.tar.gz
cd mariadb-connector-odbc-3.1.19-ubuntu-focal-amd64
install lib/mariadb/libmaodbc.so /usr/lib64/
install -d /usr/lib64/mariadb/
install -d /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/caching_sha2_password.so /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/client_ed25519.so /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/dialog.so /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/mysql_clear_password.so /usr/lib64/mariadb/plugin/
install lib/mariadb/plugin/sha256_password.so /usr/lib64/mariadb/plugin/
systemctl restart mariadb

#Create Asterisk Conf files
tee /usr/src/odbc_template.ini<<EOF
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/lib64/libmaodbc.so
FileUsage = 1
EOF

cd /usr/src
odbcinst -i -d -n MariaDB -f odbc_template.ini

tee /etc/odbc.ini<<EOF
[MySQL-asteriskcdrdb]
Description=MySQL connection to ‘asteriskcdrdb’ database
driver=MySQL
server=localhost
database=asteriskcdrdb
username=ROOTUSERNAME
password=PASSWORD
Port=3306
Socket=/run/mysqld/mysqld.sock
option=3
Charset=utf8
EOF

tee /etc/asterisk/cdr_adaptive_odbc.conf<<EOF
[asteriskcdrdb]
connection=asteriskcdrdb
loguniqueid=1
table=cdr
alias start => calldate
EOF

tee /etc/asterisk/res_odbc_additional.conf<<EOF
[asteriskcdrdb]
enabled=>yes
dsn=>MySQL-asteriskcdrdb
pre-connect=>yes
max_connections=>5
username=>asterisk
password=>PASSWORD
database=>asteriskcdrdb
EOF

systemctl restart mariadb

reload asterisk

In FreePBX Advanced Settings Enable CDR Logging

Apply Settings and make a test call

Remember to change ROOTUSERNAME to your MySQL root user aka root and PASSWORD to your respective MySQL user password

this indeed worked for me :smiley: It seemed the odbc driver isnt part of the Ubuntu package anymore.I have it working with this approach using asterisk 20, Freepbx 16 on Ubuntu 22.04.

I downloaded and installed the following ODBC connector for MariaDB: https://dlm.mariadb.com/3286263/Connectors/odbc/connector-odbc-3.1.19/mariadb-connector-odbc-3.1.19-ubuntu-kinetic-amd64.tar.gz

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