Hi, I’m trying to setup cdr logged to a mysql server. cdr_odbc works fine, but cdr_adaptive_odbc does not work; both use the same odbc connection and cdr table.
OS: Ubuntu 22.04
Asterisk: 20.8.1
Mysql: 8.0.36
This is my odbc connection status
CLI> odbc show all
ODBC DSN Settings
-----------------
Name: mysql
DSN: asterisk-mysql
Number of active connections: 1 (out of 1)
Logging: Disabled
My res_odbc.conf
[mysql]
enabled => yes
dsn => asterisk-mysql
username => mysql_asterisk_user
password => mysql_asterisk_password
pre-connect => yes
sanitysql => select 1
max_connections => 1
forcecommit => no
isolation => read_committed
backslash_is_escape => yes
connect_timeout => 5
negative_connection_cache => 300
This is how I create the cdr table in msyql 8.0
CREATE TABLE `cdr` (
`calldate` timestamp NOT NULL,
`clid` varchar(80) NOT NULL,
`src` varchar(80) NOT NULL,
`dst` varchar(80) NOT NULL,
`dcontext` varchar(80) NOT NULL,
`channel` varchar(80) NOT NULL,
`dstchannel` varchar(80) NOT NULL,
`lastapp` varchar(80) NOT NULL,
`lastdata` varchar(80) NOT NULL,
`duration` int NOT NULL,
`billsec` int NOT NULL,
`disposition` varchar(45) NOT NULL,
`amaflags` int NOT NULL,
`accountcode` varchar(20) NOT NULL,
`uniqueid` varchar(150) NOT NULL,
`userfield` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
This is the working cdr_odbc
[global]
dsn=mysql
loguniqueid=yes
dispositionstring=yes
table=cdr
usegmtime=no
hrtime=no
newcdrcolumns=no
This is my cdr_adaptive_odbc.conf
[my_cdr_odbc]
connection=mysql
table=cdr
schema=call_center
alias calldate => start
When I reload or restart asterisk, CLI show this:
[2024-06-07 17:44:53] ERROR[2282087]: cdr_adaptive_odbc.c:172 load_config: Unable to query database columns on connection 'mysql'. Skipping.
Please help!