I have a very odd problem, and am running out of ideas of what could be causing the issue.
We are running Asterisk 17.4.0 within a Docker Container, running Debian 9. The asterisk instance is reading from a mounted sqlite3 db file. The purpose of this is to build an IAX2 registry based on the database entries.
For some reason, the Asterisk instance is attempting to access the db file when it is initialised, but then seems to get stuck, leaving the db file locked. The sqlite3 db file can be opened, read + adjusted normally from the CLI within the docker instance, so I suspect the db in itself is sound. The db only has 1 table, ‘iaxpeers’ which contains all the IAX2 subscriber details.
[settings] iaxusers => sqlite3,asterisk,iaxpeers iaxpeers => sqlite3,asterisk,iaxpeers
[asterisk] enabled => yes dsn => asterisk pre-connect => yes
[general] iaxdebug=no authdebug=no jitterbuffer=no forcejitterbuffer=no maxjitterbuffer=40 maxexcessbuffer=0 callerid="Guest IAX User" calltokenoptional=0.0.0.0/0.0.0.0; bandwidth=low codecpriority=mine ;allow=g729,alaw,ulaw,gsm disallow=all allow=alaw,speex,gsm maxregexpire=3600 minregexpire=60 ;tos=ef ;cos=5 iaxmaxthreadcount=1000 maxcallnumbers=32000 maxcallnumbers_nonvalidated=32000 ; if we don't know this peer, then don't try it, to speed up failure ; reporting to the ut server ; unknownpeerdonttry=yes rtcachefriends=yes ; Cache realtime friends by adding them to the internal list ; just like friends added from the config file only on a ; as-needed basis? (yes|no) rtupdate=no ; Send registry updates to database using realtime? (yes|no) ; If set to yes, when a IAX2 peer registers successfully, ; the ip address, the origination port, the registration period, ; and the username of the peer will be set to database via realtime. ; If not present, defaults to 'yes'. rtautoclear=yes ; Auto-Expire friends created on the fly on the same schedule ; as if it had just registered? (yes|no|<seconds>) ; If set to yes, when the registration expires, the friend will ; vanish from the configuration until requested again. ; If set to an integer, friends expire within this number of ; seconds instead of the registration interval. rtignoreregexpire=no ; When reading a peer from Realtime, if the peer's registration ; has expired based on its registration interval, used the stored ; address information regardless. (yes|no)
; Define a realtime database name to use in extconfig.conf [asterisk] dbfile => /iax/iax_sqlite3.db ; debug - Turn on debugging information debug=yes ; ; requirements - At startup, each realtime family will make requirements ; on the backend. There are several strategies for handling requirements: ; warn - Warn if the required column does not exist. ; createclose - Create columns as close to the requirements as possible. ; createchar - Create char columns only ; requirements=warn ; ;batch=0 ; batch - SQLite 3 write performance can be greatly improved by wrapping ; multiple writes in transactions. This option specifies the duration in ; milliseconds of auto-generated transactions. Any changes made during an ; unfinished transaction will be immediately available to the same database ; connection, but any external connections could see a delay up to the value ; of this setting. It is also possible that if asterisk crashes, any changes ; made during this time could be lost. Due to the nearly 100x performance ; benefit, the default is 100 ms. Set to 0 to disable batching. ; ; PLEASE NOTE: If you need to write to the database from another connection ; you will need to set batch=0 as the transactions will cause the database ; to lock for writing. ; ;sbatch=1000 ; ; busy timeout - timeout in miliseconds to stop waiting for locked database. ; More info at https://www.sqlite.org/c3ref/busy_timeout.html ; ;busy_timeout=1000
[asterisk] Description=SQLite3 database Driver=SQLite3 Database=/iax/iax_sqlite3.db # optional lock timeout in milliseconds Timeout=2000
ODBC output from the CLI
ODBC DSN Settings ----------------- Name: asterisk DSN: asterisk Number of active connections: 1 (out of 1) Logging: Disabled
As you can see, the db connection is being made, but the asterisk database is never populated with anything. I have noted nothing from the logger for odbc related things with regards the db link, so I am none the wiser why the issue is occurring.
database show /pbx/UUID : d5014138-f3b7-4539-92e8-b69e39130768 1 results found.
There is more to this story, which I feel I should mention. This docker image is in use on other servers and works perfectly. We just have 2 servers however that has the above issue. The config between all the servers are the same. The OS is also the same.
I guess the main question is, any thoughts? Is there a way to get more logging/debug output from the odbc/sqlite3 functions within asterisk, as at the moment, I am getting nothing at all.