CDR and CEL do not work (MySQL Error most likely/ odbc Error)

Hello again! I already looke for a solution but all threads are 10+ years old. The CDR and CEL are not working. They are installed and enabled in FReePBX. The asterisk logs have the following entry:

27489	[2024-03-08 15:26:52] WARNING[353157] res_odbc.c: res_odbc: Error SQLConnect=-1 errno=2002 [unixODBC][MySQL][ODBC 5.3(a) Driver]Can't connect to local MySQL server through socket '/var/lib/m	
27490	[2024-03-08 15:26:52] NOTICE[353157] res_odbc.c: Registered ODBC class 'asteriskcdrdb' dsn->[MySQL-asteriskcdrdb]	
27491	[2024-03-08 15:26:52] NOTICE[353157] cdr.c: CDR simple logging enabled.	
27492	[2024-03-08 15:26:52] WARNING[353157] res_odbc.c: res_odbc: Error SQLConnect=-1 errno=2002 [unixODBC][MySQL][ODBC 5.3(a) Driver]Can't connect to local MySQL server through socket '/var/lib/m	
27493	[2024-03-08 15:26:52] WARNING[353157] cdr_adaptive_odbc.c: No such connection 'asteriskcdrdb' in the 'asteriskcdrdb' section of cdr_adaptive_odbc.conf. Check res_odbc.conf.

When i run isql -v asteriskcdrdb I get this:

root@ubuntu:~# isql -v asteriskcdrdb
[IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified
[ISQL]ERROR: Could not SQLConnect

My odbc.ini looks like this:

[MySQL-asteriskcdrdb]
Description=MySQL connection to 'asteriskcdrdb' database
driver=MySQL ODBC 5.3 Driver
server=localhost
database=asteriskcdrdb
username=>freepbxuser
password=>d631ddbd4c4701d520accf5e93c2ce60
Port=3306
Socket=/var/lib/mysql/mysql.sock
option=3
Charset=utf8

My odbcinst.ini looks like this:

 [PostgreSQL ANSI]
Description=PostgreSQL ODBC driver (ANSI version)
Driver=psqlodbca.so
Setup=libodbcpsqlS.so
Debug=0
CommLog=1
UsageCount=1

[PostgreSQL Unicode]
Description=PostgreSQL ODBC driver (Unicode version)
Driver=psqlodbcw.so
Setup=libodbcpsqlS.so
Debug=0
CommLog=1
UsageCount=1

[MySQL ODBC 5.3 Driver]
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5a.so
SETUP=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc5S.so
UsageCount=1

I had to install libmyodbc with wget from the website.

The mentioned res_odbc.conf in the Error files points to the file res.odbc_additional.conf and this file looks like this (I edited it)

;--------------------------------------------------------------------------------;
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
;--------------------------------------------------------------------------------;
; For information on adding additional paramaters to this file, please visit the ;
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
; is totally deliberate.                                                         ;
;--------------------------------------------------------------------------------;
[asteriskcdrdb]
enabled=>yes
dsn=>MySQL-asteriskcdrdb
pre-connect=>yes
max_connections=>5
username=>freepbxuser
password=>d631ddbd4c4701d520accf5e93c2ce60
database=>asteriskcdrdb

There are multiple locations for the ocbc files and they are not linked.
Thanks in advance for the help! :slight_smile:

I solved it by switching to MariaDD ODBC Driver and then writing the sock path there. Now i have the problem that if i enable call recording it no longer CDR logs anything.

Are the call recording file names longer than the maximum character length in your database’s CDR table column(s) (app arguments or maybe userfield) ?

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