It
is assumed that you have installed Astersik successfully from my
previous post.
By
default Asterisk comes with text based configuration files, which
requires reloading of module every time, for the file we changed. But
when we setup Asterisk Real Time architecture we don't need reload.
Here
I will show you example of adding real time SIP users.
1.
First we will take backup of sample
files which we will modify,
cd /etc/asterisk
mv
res_config_mysql.conf res_config_mysql.conf_orig
mv
/etc/asterisk/extensions.conf /etc/asterisk/extensions.conf_orig
mv
/etc/asterisk/extconfig.conf /etc/asterisk/extconfig.conf_orig
mv
/etc/asterisk/sip.conf /etc/asterisk/sip.conf_orig
open
file, nano /etc/asterisk/res_config_mysql.conf and add below database
details in it.
[general]
dbhost
= 127.0.0.1
dbname
= conference
dbuser
= root
dbpass
= yourdbpass
dbport
= 3306
open
file, nano /etc/asterisk/extconfig.conf and add below content in it.
[settings]
sippeers
=> mysql,general,RealTimeUsers
open
file, nano /etc/asterisk/sip.conf and add below details in it.
[general]
callcounter=yes
; enable device states for SIP devices
rtcachefriends=yes
udpbindaddr=0.0.0.0:5060
disallow=all
allow=ulaw
allow=alaw
allow=gsm
open
file, nano /etc/asterisk/extensions.conf and add below code in it
[mycontext]
exten
=> 1000,1,Dial(SIP/1000)
exten
=> 1001,1,Dial(SIP/1001)
Now
apply below command
asterisk
-rvvvv
core
reload
To
check Asterisk realtime status, you can use below command
conference-VirtualBox*CLI>
realtime mysql status
general
connected to conference@127.0.0.1, port 3306 with username root for 5
seconds.
2.
Now login to database and create
database and table
root@conference-VirtualBox:/etc/asterisk#
mysql -uroot -pyourdbpass
mysql>
mysql>
CREATE DATABASE conference;
mysql>
use conference;
mysql>
CREATE TABLE `RealTimeUsers` (
`id` int NOT NULL AUTO_INCREMENT,
`type` varchar(6) DEFAULT NULL,
`name` varchar(128) DEFAULT NULL,
`secret` varchar(128) DEFAULT
NULL,
`context` varchar(128) DEFAULT
NULL,
`host` varchar(128) DEFAULT NULL,
`ipaddr` varchar(128) DEFAULT
NULL,
`port` varchar(5) DEFAULT NULL,
`regseconds` bigint(20) DEFAULT
NULL,
`defaultuser` varchar(128) DEFAULT
NULL,
`fullcontact` varchar(128) DEFAULT
NULL,
`regserver` varchar(128) DEFAULT
NULL,
`useragent` varchar(128) DEFAULT
NULL,
`lastms` int(11) DEFAULT NULL,
`firstname` varchar(128) DEFAULT
NULL,
`lastname` varchar(128) DEFAULT
NULL,
`interpretertype` varchar(255)
DEFAULT NULL,
`isinterpreter` int(1) DEFAULT
'0',
`isused` int(1) NOT NULL DEFAULT
'0',
PRIMARY KEY (id)
);
Adding
real time SIP users with below queries
INSERT
INTO RealTimeUsers
(type,name,secret,context,host,defaultuser,firstname,lastname)
VALUES('friend','1000','1234','mycontext','dynamic','1000','abc','xyz');
INSERT
INTO RealTimeUsers
(type,name,secret,context,host,defaultuser,firstname,lastname)
VALUES('friend','1001','1234','mycontext','dynamic','1001','abc','xyz');
Great
you have configured Astersik real time SIP users. Now, you can
register in softphone like zoiper with above two created users, and
then try to dial out each other.
No comments:
Post a Comment