Hi, kind folks. I’m really stuck and hoping someone has some debugging ideas.
I’ve configured two identical (except for hostnames) asterisk servers and set up mysql instances on each with replication between them. I’m trying to store state variables in a “state” table via the realtime engine so I can set and query those variables on either host in the dialplan. These are using the distribution asterisk 16 packages from Debian bullseye.
On one host, this works perfectly. On the other, it won’t even fire a query at the database. Given the configs are identical except for hostnames (I verified with diff!), I’m at a loss and I can’t seem to find a way to pull more useful debugging information out of asterisk. core set debug 20 and core set verbose 20 don’t add any more info. This host even correctly writes cdr records via odbc, so the connection is definitely working.
If someone could point me at a way to get some more debugging info out or another place to look, I’d be super grateful.
nycsip*CLI> odbc show
ODBC DSN Settings
-----------------
Name: mariadb
DSN: asterisk-connector
Number of active connections: 1 (out of 20)
Logging: Disabled
nycsip*CLI> module show like odbc
Module Description Use Count Status Support Level
cdr_adaptive_odbc.so Adaptive ODBC CDR backend 0 Running core
cdr_odbc.so ODBC CDR Backend 0 Running extended
cel_odbc.so ODBC CEL backend 0 Running core
func_odbc.so ODBC lookups 0 Running core
res_config_odbc.so Realtime ODBC configuration 0 Running core
res_odbc.so ODBC resource 6 Running core
res_odbc_transaction.so ODBC transaction resource 1 Running core
7 modules loaded
nycsip*CLI> realtime update state mykey joes/ivr value smart
Failed to update. Check the debug log for possible SQL related entries.
Command 'realtime update state mykey joes/ivr value dumb' failed.
root@nycsip:/etc/asterisk# isql asterisk-connector asterisk XXXXXXXX
SQL> update state set value = 'dumb' where mykey = 'joes/ivr';
SQLRowCount returns 1
/etc/odbcinst.ini
[MariaDB]
Description=ODBC for MariaDB
Driver=/usr/local/lib/mariadb/libmaodbc.so
#Setup=/usr/lib64/libodbcmyS.so
UsageCount=1
/etc/odbc.ini
[asterisk-connector]
Description = MySQL connection to 'asterisk' database
Driver = MariaDB
Database = asterisk
Server = nycsip.loyaltyforge.local
Port = 3306
Socket = /var/run/mysqld/mysqld.sock
/etc/asterisk/res_odbc.conf
;;; odbc setup file
; ENV is a global set of environmental variables that will get set.
; Note that all environmental variables can be seen by all connections,
; so you can't have different values for different connections.
[ENV]
[mariadb]
enabled => yes
dsn => asterisk-connector
username => asterisk
password => XXXXXX
pre-connect => yes
max_connections => 20
/etc/asterisk/extconfig.conf
[settings]
state => odbc,mariadb
/etc/asterisk/modules.conf
[modules]
autoload=yes
preload => res_odbc.so
preload => res_config_odbc.so
noload => pbx_gtkconsole.so
noload => pbx_kdeconsole.so
noload => app_intercom.so
noload => chan_modem.so
noload => chan_modem_aopen.so
noload => chan_modem_bestdata.so
noload => chan_modem_i4l.so
noload => chan_capi.so
load => res_musiconhold.so
noload => chan_alsa.so
noload => chan_console.so
noload => chan_oss.so
noload => cdr_sqlite.so
noload => app_directory_odbc.so
noload => res_config_pgsql.so
[global]