IAX2 / SIP peers in MySQL Database
The SIP and IAX2 channels support definition of friends in a
MySQL database.
To enable this, you need to edit the Makefile in the
channels directory of your source tree and enable
MYSQL_FRIENDS. This enables database definition of both IAX2 and SIP friends. Make sure you have the MySQL development kit (libraries) installed before compilation.
You also need to define the following variables in the general section of sip.conf and iax.conf:
- dbname: Name of database in your Mysql server
- dbhost: Hostname of server
- dbuser: Username in MySQL
- dbpass: Password for user in MySQL
The following data is stored in the database:
- name: Name of peer (used in SIP registration)
- secret: Secret (password)
- context: Default context for incoming calls from user
- ipaddr: Default IP address of user
- port: Default port
Database format:
# Table structure for table `sipfriends`
#
CREATE TABLE `sipfriends` (
`name` varchar(40) NOT NULL default '',
`username` varchar(40) default '',
`secret` varchar(40) NOT NULL default '',
`context` varchar(40) NOT NULL default '',
`ipaddr` varchar(20) NOT NULL default '',
`port` int(6) NOT NULL default '0',
`regseconds` int(11) NOT NULL default '0',
PRIMARY KEY (`name`)
) TYPE=MyISAM;
# Table structure for table `iaxfriends`
#
CREATE TABLE `iaxfriends` (
`name` varchar(40) NOT NULL default '',
`secret` varchar(40) default '',
`context` varchar(40) default '',
`ipaddr` varchar(20) default '',
`port` int(6) default '0',
`regseconds` int(11) default '0',
PRIMARY KEY (`name`)
) TYPE=MyISAM;