MySQL Database for SIP users

Hello,
I have installed and configured mysql database at my asterisk server. I am able to connect successfully at mysql database.
My question is how Do I configure dialplan [extention.conf] using query from mysql database tables.

Please advice.

1 Like

check extconfig.conf file

I have created two tables…

  1. For Sip friends
  2. For extentions.conf

Below are the two table structure:
For Sip friends

SR_No	    Unique/primary_key
type	    enum
context	    varchar2(200)
disallow    varchar2(200)
host	    varchar2(200)
allow	    varchar2(200)
transport   varchar2(200)
nat	        varchar2(200)
qualify	    varchar2(200)
canreinvite	varchar2(200)
tcpenable	varchar2(200)
allowguest	varchar2(200)
srvlookup	varchar2(200)
udpbindaddr	varchar2(200)
secret	    varchar2(200)

For extentions.conf

id	      Auto_incrt
context	  varchar2(200)
exten	  varchar2(200)
priority  tinyint(4) 
app	      varchar2(200)
appdata	  varchar2(200)

Please advice how to configure extconfig.conf

I think you should take a look at https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration#RealtimeDatabaseConfiguration-Twomodes:StaticandRealtime and http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/I_section12_tt1465 to understand how ARA works.

I have created the above two tables and I inserted the data in it. The below configuration I have made at extconfig.conf.

[settings]
sip.conf => odbc,root,sipfriends
;extensions.conf => odbc,root,extensions_conf

The configuration for odbc.ini

[asterisk-connector]
Description=MySQL connection to 'asterisk' database
Driver=MySQL
Database=asterisk
Server=localhost
user=root
password=xxxx
Port=xxxx
Socket=/var/lib/mysql/mysql.sock

The configuration from /etc/asterisk/res_odbc.conf

[root]
enabled => yes
dsn => asterisk-connector
username  => root
password => xxxx
pre-connect => yes

But when I am trying to connect I am getting error. please advice

What errors do you see?

I am not able to connect. Users are not able to register from xlite. The below are the error from /var/log/asterisk/messages

[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] WARNING[1501] res_phoneprov.c: Unable to find a valid server address or name.
[Feb 24 14:14:33] NOTICE[1501] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_pjsip_publish_asterisk.c: Entity ID is not set.
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] NOTICE[1501] chan_skinny.c: Configuring skinny from skinny.conf
[Feb 24 14:14:33] NOTICE[1501] chan_sip.c: Unable to load config sip.conf
[Feb 24 14:14:33] ERROR[1501] message.c: No 'sip' message technology found.
[Feb 24 14:14:33] ERROR[1501] ari/config.c: No configured users for ARI
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] ERROR[1501] res_sorcery_config.c: Unable to load config file 'pjsip.conf'
[Feb 24 14:14:33] NOTICE[1501] confbridge/conf_config_parser.c: Adding default_menu menu to app_confbridge
[Feb 24 14:14:33] NOTICE[1501] cdr_radius.c: Cannot load radiusclient-ng configuration file /etc/radiusclient-ng/radiusclient.conf.
[Feb 24 14:14:33] NOTICE[1501] cel_custom.c: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.
[Feb 24 14:14:33] WARNING[1501] cel_pgsql.c: CEL pgsql config file missing global section.
[Feb 24 14:14:33] NOTICE[1501] cel_radius.c: Cannot load radiusclient-ng configuration file /etc/radiusclient-ng/radiusclient.conf.
[Feb 24 14:14:33] NOTICE[1501] cdr_pgsql.c: cdr_pgsql configuration contains no global section, skipping module load.
[Feb 24 14:14:33] NOTICE[1501] cel_tds.c: cel_tds has no global category, nothing to configure.
[Feb 24 14:14:33] WARNING[1501] cel_tds.c: cel_tds module had config problems; declining load
[Feb 24 14:14:33] WARNING[1501] pbx_dundi.c: Entity ID is not set.
[Feb 24 14:14:33] WARNING[1501] loader.c: Some non-required modules failed to load.
[Feb 24 14:14:33] ERROR[1501] loader.c: res_pjsip_publish_asterisk declined to load.
[Feb 24 14:14:33] ERROR[1501] loader.c: chan_sip declined to load.
[Feb 24 14:14:33] ERROR[1501] loader.c: cdr_radius declined to load.
[Feb 24 14:14:33] ERROR[1501] loader.c: cdr_tds declined to load.
[Feb 24 14:14:33] ERROR[1501] loader.c: cdr_sqlite3_custom declined to load.
[Feb 24 14:14:33] ERROR[1501] loader.c: cel_radius declined to load.
[Feb 24 14:14:33] ERROR[1501] loader.c: cdr_pgsql declined to load.
[Feb 24 14:14:33] ERROR[1501] loader.c: cel_tds declined to load.
[Feb 24 14:14:33] ERROR[1501] loader.c: cel_sqlite3_custom declined to load.

Solved the issue. The issue I have faced is below

  1. changed the table name from bit_sipfriends to sipfriends. Do not put bit_*. It will give you error

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.