Asterisk 13.17.2/Centos7 ODBC Realtime issues

Hello,

I’m stuck with realtime issue. I use Asterisk 13.17.2 on Centos7. Impossible to display SIP account :

asterisk*CLI> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port Status Description Realtime
0 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 0 offline]

Here my conf :

/etc/odbc.ini
[asterisk-connector]
Description=MySQL connection to ‘asterisk’ database
Driver=MySQL
Database=asterisk
Server=localhost
Port=3306
Socket=/var/lib/mysql/mysql.sock

/etc/odbcinst.ini
[MySQL]
Description=ODBC for MySQL
Driver=/usr/lib/libmyodbc5.so
Setup=/usr/lib/libodbcmyS.so
Driver64=/usr/lib64/libmyodbc5.so
Setup64=/usr/lib64/libodbcmyS.so
FileUsage=1

extconfig.conf
[settings]
sippeers => odbc,asterisk,sippeers
sipusers => odbc,asterisk,sippeers

res_odbc.conf
[asterisk]
enabled => yes
dsn => asterisk-connector
username => asterisk
password => xxxxx
pre-connect => yes

asterisk# isql -v asterisk-connector asterisk xxxxx
±--------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
±--------------------------------------+
SQL> select 1
±--------------------+
| 1 |
±--------------------+
| 1 |
±--------------------+
SQLRowCount returns 1
1 rows fetched
SQL>

Logs /var/log/asterisk/messages :
[Oct 31 15:16:00] Asterisk 13.17.2 built by root @ asterisk@xxx.ch on a x86_64 running Linux on 2017-10-20 10:14:41 UTC
[Oct 31 15:16:00] NOTICE[2872] cdr.c: CDR simple logging enabled.
[Oct 31 15:16:00] NOTICE[2872] loader.c: 289 modules will be loaded.
[Oct 31 15:16:00] NOTICE[2872] res_odbc.c: Registered ODBC class ‘asterisk’ dsn->[asterisk-connector]
[Oct 31 15:16:00] NOTICE[2872] res_odbc.c: res_odbc loaded.
[Oct 31 15:16:01] NOTICE[2872] confbridge/conf_config_parser.c: Adding default_menu menu to app_confbridge
[Oct 31 15:16:01] NOTICE[2872] cel_custom.c: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.

mysql -uasterisk -pxxxxx
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 5.5.56-MariaDB MariaDB Server

Copyright © 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> use asterisk;
MariaDB [asterisk]> select * from sippeers;
±—±-----±------------------±---------------------±-----±-------±-------±----------±-------------±----------±--------±--------------------±-------±------------±---------±----------±---------±----------±---------±---------±-----------±---------±---------±--------±------------±--------±---------±-----------±---------------±-------±---------±--------------±------------±-------±-----±------------±-----------------±------------±----------±---------±---------------±-------------±--------------±------------±----------±-------------±---------------±--------------±-----------------±-------------±---------------±------------------±-------------------±--------------±------------------±---------------±--------±-------±------------±--------------±------------±-------±----------±-----------±----------+
| id | name | context | callingpres | deny | permit | secret | md5secret | remotesecret | transport | host | nat | type | accountcode | amaflags | callgroup | callerid | defaultip | dtmfmode | fromuser | fromdomain | insecure | language | mailbox | pickupgroup | qualify | regexten | rtptimeout | rtpholdtimeout | setvar | disallow | allow | fullcontact | ipaddr | port | defaultuser | subscribecontext | directmedia | trustrpid | sendrpid | progressinband | promiscredir | useclientcode | callcounter | busylevel | allowoverlap | allowsubscribe | allowtransfer | ignoresdpversion | videosupport | maxcallbitrate | rfc2833compensate | t38pt_usertpsource | outboundproxy | callbackextension | registertrying | timert1 | timerb | qualifyfreq | contactpermit | contactdeny | lastms | regserver | regseconds | useragent |
±—±-----±------------------±---------------------±-----±-------±-------±----------±-------------±----------±--------±--------------------±-------±------------±---------±----------±---------±----------±---------±---------±-----------±---------±---------±--------±------------±--------±---------±-----------±---------------±-------±---------±--------------±------------±-------±-----±------------±-----------------±------------±----------±---------±---------------±-------------±--------------±------------±----------±-------------±---------------±--------------±-----------------±-------------±---------------±------------------±-------------------±--------------±------------------±---------------±--------±-------±------------±--------------±------------±-------±----------±-----------±----------+
| 1 | ggg | from-internal-sip | allowed_not_screened | NULL | NULL | NULL | NULL | NULL | NULL | dynamic | force_rport,comedia | friend | NULL | NULL | NULL | NULL | NULL | rfc2833 | NULL | NULL | NULL | NULL | NULL | NULL | yes | NULL | NULL | NULL | NULL | all | ulaw;alaw;gsm | | | 0 | | NULL | no | NULL | NULL | NULL | NULL | NULL | NULL | NULL | yes | yes | yes | no | no | NULL | yes | NULL | NULL | NULL | yes | 500 | NULL | 120 | NULL | NULL | 0 | | 0 | |
±—±-----±------------------±---------------------±-----±-------±-------±----------±-------------±----------±--------±--------------------±-------±------------±---------±----------±---------±----------±---------±---------±-----------±---------±---------±--------±------------±--------±---------±-----------±---------------±-------±---------±--------------±------------±-------±-----±------------±-----------------±------------±----------±---------±---------------±-------------±--------------±------------±----------±-------------±---------------±--------------±-----------------±-------------±---------------±------------------±-------------------±--------------±------------------±---------------±--------±-------±------------±--------------±------------±-------±----------±-----------±----------+
1 row in set (0.00 sec)

Have I forgotten something?
Please help,

The “sip show peers” command will only list things that are in memory. It does not query the database. If you have “rtcachefriends” enabled then it is possible for them to show up as they become cached in memory, but only after they have been used. The “sip show peer” CLI command can be instructed to query the database though by using the “load” argument at the end if I remember correctly.

2 Likes

Thank you , you were right^^