我使用 ODBC 与 asterisk 一起写入我的 CDR,然后最近需要检查我的 CDR,发现大约 6 个月内没有写入任何内容。我查看了我的配置,似乎没有任何变化。但随后尝试重新安装除 FREEPBX 之外的所有内容,试图使其正常工作。我尝试了几种不同的配置,但都不起作用……但是,我现在已经设法避免了所有其他错误,但以下情况除外:
ERROR[2917] cdr_odbc.c: Unable to retrieve database handle. CDR failed.
之前和之后均无错误。
Debian 10 搭配 MariaDB 10 Asterisk 16 FreeBPX 16
这是我的配置:
/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
/etc/asterisk/cdr_odbc.conf
[global]
dsn=MySQL-asteriskcdrdb
username=freepbxuser
password=**PASSWORD**
loguniqueid=yes
dispositionstring=yes
table=cdr
usegmtime=no
hrtime=yes
newcdrcolumns=yes
/etc/asterisk/res_odbc_additional.conf
[asteriskcdrdb]
enabled => yes
dsn => MySQL-asteriskcdrdb
pre-connect => yes
max_connections => 5
username => freepbxuser
password => **PASSWORD**
database => asteriskcdrdb
。
cdr show status
Call Detail Record (CDR) settings
----------------------------------
Logging: Enabled
Mode: Simple
Log unanswered calls: Yes
Log congestion: No
* Registered Backends
-------------------
cdr-custom
cdr_manager
ODBC
Adaptive ODBC
。
odbc show asteriskcdrdb
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