Realtime mapping to odbc, engine not available

Hi all.

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 https://wiki.asterisk.org/wiki/display/AST/Getting+Asterisk+Connected+to+MySQL+via+ODBC.

I have the edited the extconfig.conf file as per the instructions found here: https://www.voip-info.org/wiki/view/Asterisk+RealTime

However when I go to show connected peers, I instead get the static peers from the sip.conf file and a warning from the CLI:

WARNING[21919]: config.c:3050 find_engine: Realtime mapping for ‘sippeers’ found to engine ‘odbc’, but the engine is not available

What am I doing wrong here? I’m at my wits end.

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.

1 Like

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

ODBC exists in the folder provided, and is working per the walkthrough here: https://wiki.asterisk.org/wiki/display/AST/Getting+Asterisk+Connected+to+MySQL+via+ODBC , and extconfig is configured according to https://www.voip-info.org/wiki/view/Asterisk+RealTime , swapping MySQL for ODBC and replacing names/tables with the ones in the database.

And what does “module show like odbc” output? How about “odbc show all”?

1 Like

The below:

asteriskhost*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_odbc.so ODBC resource 0 Running core
res_odbc_transaction.so ODBC transaction resource 0 Running core
6 modules loaded

You do not have the “res_config_odbc.so” module loaded, so the engine is not available.

3 Likes

Found ‘res_config_odbc.so’ in the /usr/lib/asterisk/modules/ folder. How do I load it? (And preferably tell asterisk to load it upon initialisation)?

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.

1 Like

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.

Thanks a lot for your aid so far!

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.

2 Likes

So if the CLI commands won’t pull from the database, is there any quick way to test whether or not there is actually a connection established?

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”

1 Like

odbc show all returns

ODBC DSN Settings

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.

1 Like

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.

You can like things if you desire, otherwise nothing needed.

1 Like

Done! Have an excellent day!