I had ODBC working with asterisk to write to my CDR then recently needed to check my CDR to realise nothing had been written for about 6 months. I had a look at my config, nothing seamed to have changed. but then tried to re-install everything except FREEPBX trying to get it to work. I have attempted several variations of config, and nothing is working… HOWEVER, I have now managed to avoid all other errors with the exceptoion of :
ERROR[2917] cdr_odbc.c: Unable to retrieve database handle. CDR failed.
NO errors before, of after.
Debian 10 w/ MariaDB 10 Asterisk 16 FreeBPX 16
Here is my config:
/etc/odbc.ini
[MySQL-asteriskcdrdb]
Description = MySQL connection to 'asteriskcdrdb' database
Driver = MySQL
Server = localhost
Database = asteriskcdrdb
Username = freepbxuser
Password = **PASSWORD**
Port = 3306
Socket = /var/run/mysqld/mysqld.sock
Option = 3
/etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/local/lib/libmaodbc.so
FileUsage = 1
/etc/asterisk/cdr_adaptive_odbc.conf
[adaptive_connection]
connection=MySQL-asteriskcdrdb
table=cdr
usegmtime=yes
alias start => calldate
ODBC DSN Settings
-----------------
Name: asteriskcdrdb
DSN: MySQL-asteriskcdrdb
Last fail connection attempt: 2023-06-27 14:29:46
Number of active connections: 0 (out of 5)
Logging: Disabled
Is it a freePBX 16 system? If yes…there was a recent update. Now, there is a new setting in advanced-settings, where you have to switch cdr logging on.
These are not the same problems. The issue you are referring to turns off CDR logging which means it doesnt run and doesnt attempt to connect the backends like ODBC.
This issue is CDR logging is running but the ODBC connections are failing. Both issue result in no CDR logging but they are not the same thing.
cdr show status is a better indicator of whether CDR logging is enabled and working. odbc show asteriskcdrdb always shows logging disabled in my testing.
Hello all, thanks for your replies… well, you were right, I didn’t notice the new CDR button… however, if hasnt changed anything…still comes up with that 1 error message. also changed /etc/asterisk/cdr_adaptive_odbc.conf to
[asteriskcdrdb]
connection=MySQL-asteriskcdrdb
table=cdr
alias start => calldate
Be careful, when you edit the configs…always keep a backup of the original file. As I said, I am no pro, but here are my versions of the config files you posted above. I would suggest that you wait until a pro tells you what to do
cdr_adaptive_odbc.conf
[asteriskcdrdb]
connection=asteriskcdrdb
loguniqueid=1
table=cdr
alias start => calldate
Well,perhaps marginally better than absolutely none on 127.0.0.1 for if/when your webserver’s buffer overflow allows such access, yes that has happened way more than once.
I have tried everything above, a number of times. I even found an old backup from feb. feb still works, i imported all my “working” config and still get that error message… the only thing I think is possible, in the last5-6 months, I have added a conflicting package or damaged a package whilst doing something else