Asterisk ODBC works, but Realtime SIP does not

Hi everyone. I’m having trouble getting SIP to recognise the Realtime users we have in our MySQL database. ODBC works fine within Asterisk 13.1-cert7, so I’m not going to go over that configuration:

template25*CLI> odbc read ODBC_SQL "select context from cc_sip_buddies limit 5" exec
context               suspended
----------            ----------
context               edmonton
----------            ----------
context               suspended
----------            ----------
context               suspended
----------            ----------
context               vancouver
Returned 5 rows.  Query executed on handle 0 [asterisk]

And our extconfig.conf looks like this:

[settings]
sippeers => odbc,asterisk,cc_sip_buddies
sipusers => odbc,asterisk,cc_sip_buddies

The DSN I use in that file matches up with the one in the (working) func_odbc.conf:

[SQL]
dsn=asterisk
readsql=${ARG1}

Sooooo… This doesn’t make any sense to me.

Did you check that you can connect to odbc from command line?

First test the driver

odbcinst -s -q

Are you sure realtime is not working? It’s different than config files because It doesn’t load the peer in memory if it is not live in a call. So you will not see the peers with sip show peers unless they are actually doing something.

I did test with isql first, but don’t you think that testing from within Asterisk the way I did shows definitive proof that the Asterisk ODBC driver is working, and so is the command line ODBC connection?

Just for completeness, here’s your test results:

$ odbcinst -s -q
[mya2billing]
[asteriskcdr]

Ah. Because of course Asterisk would make it easy to actually test something like whether the SIP client is loaded by the database…

You can make asterisk cache realtime peers in memory so it stays loaded. That will make it behave more similar to config files.

The 2 configs are called rtcachefriends and rtautoclear

You can view the peers in the database using this command.

> realtime load sipusers name 123 where 123 is the ext number

I am using A2billing but I think a generic Asterisk install will be the same.

Ok, that works. Looks like SIP realtime is working then. :slight_smile: