Asterisk 21 | FreePBX 17 | PHP 8.2 | Issue with CDR

Dear Team,

I am running a system based on Debian v12 | Asterisk v21 | Nodejs - v18 | Npm v9.2 | Php v8.2 | Apache2 v2.4 | MariaDB v10.11

All the tools & were chosen based on Sangoma instructions:
https://sangomakb.atlassian.net/wiki/spaces/FP/pages/10682545/How+to+Install+FreePBX+17+on+Debian+12+with+Asterisk+21

Everything I need is okay, however my CDR module is not registering anything.
I can test only for internal calls, I have enabled the recording.
I can see that the files are created in /var/log/spool/asterisk/monitor/*
My suggest here is that asteriskcdrdb table doesn’t co-respond with asterisk table in MySql Database.

When I check modules, I got the following:

asterisk -rx “module show like cdr”
cdr_pgsql.so - not running - due to failed to load the module.
cdr_sqlite3_custom.so - not running - due to failed to load the module.
cdr_tds.so - not running - due to failed to load the module.

When I try to load the module that is not running manually, it fails.
Please if anyone can help, it will be great appreciated.

Best Regards,

Dear Team,

However, when I type asterisk -rx ‘cdr show status’.

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:
    csv
    cdr_manager
    Adaptive ODBC

Best Regards,

I can see in asterisk logs the following report:

7320[2024-11-24 04:09:47] ERROR[808] loader.c: cdr_tds declined to load.

7321[2024-11-24 04:09:47] ERROR[808] loader.c: cdr_sqlite3_custom declined to load.

7322[2024-11-24 04:09:47] ERROR[808] loader.c: cel_tds declined to load.

7323[2024-11-24 04:09:47] ERROR[808] loader.c: cel_sqlite3_custom declined to load.

7324[2024-11-24 04:09:47] ERROR[808] loader.c: cdr_pgsql declined to load.

7325[2024-11-24 04:09:47] ERROR[808] loader.c: res_hep_rtcp declined to load.

7326[2024-11-24 04:09:47] ERROR[808] loader.c: res_hep_pjsip declined to load.

7327[2024-11-24 04:09:47] VERBOSE[808] asterisk.c: Asterisk Ready.

7328[2024-11-24 04:19:47] ERROR[4840] loader.c: Error loading module ‘cdr_mysql.so’: /usr/lib64/asterisk/modules/cdr_mysql.so: cannot open shared object file: No such file or directory

Hi @Agripa FreePBX uses the ODBC driver to update the CDR. You can check if ODBC is connected by running the command below. If you don’t see an active connection, there might be an issue with your ODBC configuration in res_odbc_additional.conf.

Example

asterisk -rx "odbc show all"

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

  Name:   asteriskcdrdb
  DSN:    MySQL-asteriskcdrdb
    Number of active connections: 1 (out of 5)
    Logging: Disabled


Dear @pramarajan,

Name & DNS are identical.
I have the following line: Last Fail connection attempt & it’s today.
That means I have a problem with the connector, do you have a solution for that or just to try to upgrade the driver?

Best Regards,

Hi @Agripa ,

Check the odbc driver is installed or not.

cat /etc/odbcinst.ini
[MySQL]
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
Description=MariaDB Connector/ODBC(Unicode)
Threading=0
UsageCount=1root@uc-ttttt:~#
root@uc-ttttt:~# ls -l /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
-rw-r--r-- 1 root root 336208 Jan 31  2022 /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so

If not installed you can install using the below command

apt install odbc-mariadb

Also you can test the odbc connection using below command

isql  -v MySQL-asteriskcdrdb
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| echo [string]                         |
| quit                                  |
|                                       |
+---------------------------------------+

Dear @pramarajan

Yes, the driver is installed:

cat /etc/odbcinst.ini

[MariaDB Unicode]
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
Description=MariaDB Connector/ODBC(Unicode)
FileUsage=1

I can also find it in the path /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so & root have rights.
When I type:

isql -v MySQL-asteriskcdrdb

[IM002][unixodbc][DriverManager] Data source name not found and no default driver specified
[ISQL]ERROR: Cloud not SQLConnect

Best Regards,

Dear @pramarajan,

Thank you, I’ve found the issue!

cat /etc/odbcinst.ini
In my version, Driver name is: [MariaDB Unicode]
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
Description=MariaDB Connector/ODBC(Unicode)
FileUsage=1

I have used the wrong name for Driver in configuration:

cat /etc/odbc.ini
[MySQL-Asteriskcdrdb]
Description = MySQL connection to ‘asteriskcdrdb’ database
The WRONG versionDriver = MySQL
****The RIGHT versionDriver = MariaDB Unicode

Now i have test the PBX & it’s working, also now i see I am connected:

isql -v MySQL-asteriskcdrdb

±--------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| echo [string] |
| quit |
| |
±--------------------------------------+

Thank you for your assistance!

Best Regards,