Asterisk realtime odbc setup

Hello all,

Forgive me if I’ve missed something silly, but I’m new to Asterisk…

I am trying to integrate Asterisk and openSIPS using the tutorial found here: http://www.opensips.org/Resources/DocsTutAsterisk18. After many days debugging, I finally managed to get the ODBC engine working and now, have a sipusers table(View exported from opensips table) in my asterisk MySQL database.

However, it would seem that although the odbc driver is initiatised and does connect at startup, sippeers are still populated from the sip.conf file rather than the database. I have included a number of log files below:

[quote]sudo cat /etc/odbc.ini
[MySQL-asterisk]
Description = MySQL Asterisk database
Trace = Off
TraceFile = stderr
Driver = MySQL
SERVER = localhost
USER = asterisk
PASSWORD = passwd
PORT = 3306
DATABASE = asterisk[/quote]

[quote]sudo cat /etc/odbcinst.ini
[MySQL]
Description = MySQL driver
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
CPTimeout =
CPReuse =
UsageCount = 1
[/quote]

sudo service asterisk restart
Stopping Asterisk PBX: asterisk.
Starting Asterisk PBX: asterisk.

[quote]sudo tail /var/log/asterisk/messages -n 50

[Apr 12 16:14:40] NOTICE[27473] loader.c: 2 modules will be loaded.
[Apr 12 16:14:40] NOTICE[27473] res_odbc.c: Connecting asterisk
[Apr 12 16:14:40] NOTICE[27473] res_odbc.c: res_odbc: Connected to asterisk [MySQL-asterisk]
[Apr 12 16:14:40] NOTICE[27473] res_odbc.c: Registered ODBC class ‘asterisk’ dsn->[MySQL-asterisk]
[Apr 12 16:14:40] NOTICE[27473] res_odbc.c: res_odbc loaded.
[Apr 12 16:14:40] NOTICE[27473] config.c: Registered Config Engine odbc
[Apr 12 16:14:40] NOTICE[27473] cdr.c: CDR simple logging enabled.
[Apr 12 16:14:40] NOTICE[27473] loader.c: 228 modules will be loaded.
[Apr 12 16:14:40] NOTICE[27473] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.
[Apr 12 16:14:40] NOTICE[27473] config.c: Registered Config Engine mysql
[Apr 12 16:14:40] NOTICE[27473] res_config_ldap.c: No directory user found, anonymous binding as default.
[Apr 12 16:14:40] ERROR[27473] res_config_ldap.c: No directory URL or host found.
[Apr 12 16:14:40] ERROR[27473] res_config_ldap.c: Cannot load LDAP RealTime driver.
[Apr 12 16:14:40] NOTICE[27473] config.c: Registered Config Engine sqlite
[Apr 12 16:14:40] NOTICE[27473] config.c: Registered Config Engine curl
[Apr 12 16:14:40] NOTICE[27473] chan_skinny.c: Configuring skinny from skinny.conf
[Apr 12 16:14:40] WARNING[27473] chan_dahdi.c: Ignoring any changes to ‘userbase’ (on reload) at line 23.
[Apr 12 16:14:40] WARNING[27473] chan_dahdi.c: Ignoring any changes to ‘vmsecret’ (on reload) at line 31.
[Apr 12 16:14:40] WARNING[27473] chan_dahdi.c: Ignoring any changes to ‘hassip’ (on reload) at line 35.
[Apr 12 16:14:40] WARNING[27473] chan_dahdi.c: Ignoring any changes to ‘hasiax’ (on reload) at line 39.
[Apr 12 16:14:40] WARNING[27473] chan_dahdi.c: Ignoring any changes to ‘hasmanager’ (on reload) at line 47.
[Apr 12 16:14:40] WARNING[27473] chan_sip.c: No valid transports available, falling back to ‘udp’.
[Apr 12 16:14:40] NOTICE[27473] cel_tds.c: cel_tds has no global category, nothing to configure.
[Apr 12 16:14:40] WARNING[27473] cel_tds.c: cel_tds module had config problems; declining load
[Apr 12 16:14:40] WARNING[27473] cel_pgsql.c: CEL pgsql config file missing global section.
[Apr 12 16:14:40] NOTICE[27473] pbx_ael.c: Starting AEL load process.
[Apr 12 16:14:40] NOTICE[27473] pbx_ael.c: AEL load process: parsed config file name ‘/etc/asterisk/extensions.ael’.
[Apr 12 16:14:40] NOTICE[27473] pbx_ael.c: AEL load process: checked config file name ‘/etc/asterisk/extensions.ael’.
[Apr 12 16:14:40] NOTICE[27473] pbx_ael.c: AEL load process: compiled config file name ‘/etc/asterisk/extensions.ael’.
[Apr 12 16:14:40] NOTICE[27473] pbx_ael.c: AEL load process: merged config file name ‘/etc/asterisk/extensions.ael’.
[Apr 12 16:14:40] NOTICE[27473] pbx_ael.c: AEL load process: verified config file name ‘/etc/asterisk/extensions.ael’.
[Apr 12 16:14:40] ERROR[27473] ais/clm.c: Could not initialize cluster membership service: Try Again
[Apr 12 16:14:40] ERROR[27473] codec_dahdi.c: Failed to open /dev/dahdi/transcode: No such file or directory
[Apr 12 16:14:41] ERROR[27473] chan_vpb.cc: No Voicetronix cards detected
[/quote]

mysql query list showing odbc connecting…

I think that is everything, however, if I have missed something please let me know.

Any help would be much appreciated.

Best regards,

Steven

Just to expand the exact issue, in my database I have two users, ‘alice’ and ‘bob’, but in my file sip.conf I have two other users called demo-alice, demo-bob.

From the asterisk command line:

[quote]Connected to Asterisk 1.8.10.1~dfsg-1ubuntu1 currently running on swannserver (pid = 27473)
Verbosity is at least 3
swannserverCLI> sip reload
Reloading SIP
swannserver
CLI> sip show peers
Name/username Host Dyn Forcerport ACL Port Status Realtime
demo-alice (Unspecified) D N A 0 Unmonitored
demo-bob (Unspecified) D N A 0 Unmonitored
2 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 2 offline]
swannserver*CLI> [/quote]

So shouldn’t I have the ‘alice’ and ‘bob’ users here instead of the demo-* users?

Also, I notice that when I try to register with user ‘alice’ using twinkle on another server, I get the following error:

[quote] sudo tail /var/log/asterisk/messages -n 4
[Apr 12 16:42:45] ERROR[27503] chan_sip.c: Peer ‘alice’ is trying to register, but not configured as host=dynamic
[Apr 12 16:42:45] NOTICE[27503] chan_sip.c: Registration from ‘“alice” sip:alice@swannsips.com’ failed for ‘192.168.5.10:5060’ - Peer is not supposed to register
[Apr 12 16:42:45] ERROR[27503] chan_sip.c: Peer ‘alice’ is trying to register, but not configured as host=dynamic
[Apr 12 16:42:45] NOTICE[27503] chan_sip.c: Registration from ‘“alice” sip:alice@swannsips.com’ failed for ‘192.168.5.10:5060’ - Peer is not supposed to register[/quote]

And also notice that my MySQL query log is as follows:

So obviously it is referring to the database, but should it not list these users when issuing the ‘sip show peers’ command?

Many thanks,

Steven

To see the peers with the command sip show peer try before: sip show peer bob load & sip show peer alice load

And those peers set the host as dynamic in order to allow the registration.

Hello navaismo,

Thanks for getting back to me. I entered the commands as follows but I still don’t see the peers with the command ‘sip show peers’:

Could this be because the peers I’ve set up in the database are not dynamic? That is, because I have created the ‘sipsusers’ table as a view of the ‘subscriber’ table in the openSIPS database, a number of the fields are linked - as instructed to by the tutorial linked above - such as the domain, host, defaultip…

That being the case I should probably modify the table syntax further. My version of the tutorial’s table is as follows: