I’ve been struggling with this problem for days now. I am trying to get Asterisk to connect to a MySQL database which contains the peers, and update from this with the realtime mapping.
I do this by way of ODBC, as the different guides I’ve found on the subject suggested. And have followed this guide from start to finish, adjusting the commands as needed to work with Ubuntu 16.04 Home - Asterisk Documentation.
I’d suggest looking at the console output at startup to see if there’s any messages regarding ODBC. I’d also suggest seeing if you actually have the ODBC module present in /usr/lib/asterisk/modules and finally if those both check out then provide your current configuration files for ODBC and extconfig.
Restarted asterisk, looked through the CLI output with asterisk -rvvvvvvvvvvvvvvvvvvvvvvvvvvv . A lot of warnings in the same catergory came up.
Loading app_confbridge.so.
[May 16 12:22:52] WARNING[22238]: config.c:3050 find_engine: Realtime mapping for ‘sippeers’ found to engine ‘odbc’, but the engine is not available
[May 16 12:22:52] WARNING[22238]: config.c:3050 find_engine: Realtime mapping for ‘sippeers’ found to engine ‘odbc’, but the engine is not available
[May 16 12:22:52] WARNING[22238]: config.c:3050 find_engine: Realtime mapping for ‘sippeers’ found to engine ‘odbc’, but the engine is not available
[May 16 12:22:52] WARNING[22238]: config.c:3050 find_engine: Realtime mapping for ‘sippeers’ found to engine ‘odbc’, but the engine is not available
[May 16 12:22:52] WARNING[22238]: config.c:3050 find_engine: Realtime mapping for ‘sippeers’ found to engine ‘odbc’, but the engine is not available
[May 16 12:22:52] WARNING[22238]: config.c:3050 find_engine: Realtime mapping for ‘sippeers’ found to engine ‘odbc’, but the engine is not available
[May 16 12:22:52] WARNING[22238]: config.c:3050 find_engine: Realtime mapping for ‘sippeers’ found to engine ‘odbc’, but the engine is not available
[May 16 12:22:52] WARNING[22238]: config.c:3050 find_engine: Realtime mapping for ‘sippeers’ found to engine ‘odbc’, but the engine is not available
You can load it from the CLI using “module load res_config_odbc.so”, for automatic loading you would need to check modules.conf to see if autoload is enabled - if not then you’d have to explicitly load it, or you can also just explicitly load it there in the correct order (res_odbc.so first, then res_config_odbc.so). If you do have autoload enabled then loading Asterisk from the console can provide information about why it failed to autoload it.
Found the culprit. /etc/asterisk/modules.conf had ‘autoload=yes’, but for some reason it also contained ‘noload => res_config_odbc.so’
Changing that to ‘load => res_config_odbc.so’ solved the problem, no longer getting the error whenever I write “sip show peers”. It still only shows the static peers from the dialplan and not the realtime ones from the database, though.
The CLI commands will not pull from the database, they only show what is in memory. If caching is enabled in sip.conf then once retrieved and used from the database it would then appear.
The “odbc show all” will tell you if it is connected, and it would also give you a message on the console if it wasn’t. Looking at chan_sip it seems you can also add “load” to the end of the sip show peer command and it’ll pull from the database for that instance, ie: “sip show peer test load”
Name: asterisk
DSN: asterisk-connector
Number of active connections: 1 (out of 1)
So I guess that means the connection is active? If so, ARMS TO THE SKY IN THANKS \o/
However, ‘sip show peer asterisk load’ returns ‘Peer asterisk not found.’, and swapping it out for asterisk-connecter only results in ‘Peer asterisk-connector not found’.
The CLI shows you a peer as configured in the database if using the “load” option from what I remember. If a peer with that name doesn’t exist… then it won’t be found.
I was using it wrong. For some reason I was having my head in the gutter and thought sip show peer x load wanted the -table- not the peers themselves.
Problem solved, database is running, asterisk is connected to it, and can load from it.
Thanks a bunch! Anything I can do to show appreciation? I’m new to this forum so don’t know if liking your comments is the best way to show they were useful.