How to configure Webrtc with SIPML on Asterisk 13

1 Answer(s)
Best answer

Here is the steps to configure asterisk with webrtc:

Install Basic Dependencies

  1. yum update
  2. yum install gcc-c++ make gnutls-devel kernel-devel libxml2-devel ncurses-devel subversion doxygen texinfo curl-devel net-snmp-devel neon-devel
  3. yum install uuid-devel libuuid-devel sqlite-devel sqlite git speex-devel gsm-devel

Install Libsrtp

cd /usr/src/
wget http://srtp.sourceforge.net/srtp-1.4.2.tgz
tar zxvf srtp-1.4.2.tgz
cd srtp
autoconf
./configure
make
make install
cp /usr/local/lib/libsrtp.a /lib
Install Jansson:
/usr/src/
wget http://www.digip.org/jansson/releases/jansson-2.5.tar.gz
tar zxvf jansson-2.5.tar.gz
cd jansson-2.5
./configure –prefix=/
make
make install

Install Asterisk 13

cd /usr/src/

wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz

tar –xzvf asterisk-13-current.tar.gz

cd /usr/src/asterisk-13.1.0 && make clean

./configure –with-crypto –with-ssl –with-srtp=/usr/local/lib

contrib/scripts/get_mp3_source.sh

make menuselect.makeopts

menuselect/menuselect –enable format_mp3 –enable res_config_mysql –enable app_mysql –enable app_saycountpl –enable cdr_mysql –enable EXTRA-SOUNDS-EN-GSM

make && make install

make samples

make config

chkconfig asterisk on

 

Configure Asterisk for Secure Calling

# mkdir /etc/asterisk/keys
# cd /usr/src/asterisk-13.1.0/contrib/scripts
# /ast_tls_cert -C youpbxhostname.com -O "Your Company" -d /etc/asterisk/keys


Next, we generate a client certificate for our SIP device.

# ./ast_tls_cert -m client -c /etc/asterisk/keys/ca.crt -k /etc/asterisk/keys/ca.key -C phone1.mycompany.com -O "My Super Company" -d /etc/asterisk/keys


Now make some changes in asterisk conf files like sip.confhttp.conf,  rtp.conf,  extensions.conf

Edit the /etc/asterisk/sip.conf (or modify Asterisk SIP Settings in FreePBX), add/modify the following settings, in [general].

Please note, we added transport ws and wss, these are websocket and websocket secure

udpbindaddr=0.0.0.0:5060
realm=<ip address of the server where asterisk is installed > e.g. 192.168.0.120
transport=udp,ws,wss

Add a Test account

;web client extension

[7001]
host=dynamic
secret=7000
context=outgoing
type=peer
encryption=yes
avpf=yes
icesupport=yes
transport=ws,wss,udp
directmedia=no
disallow=all
allow=all
dtlsenable=yes
dtlsverify=fingerprint
dtlscertfile=/etc/asterisk/keys/asterisk.pem
dtlscafile=/etc/asterisk/keys/ca.crt
dtlssetup=actpass

;web client extension

[7002]
host=dynamic
secret=7000
context=outgoing
type=peer
encryption=yes
avpf=yes
icesupport=yes
transport=ws,wss,udp
directmedia=no
disallow=all
allow=all
dtlsenable=yes
dtlsverify=fingerprint
dtlscertfile=/etc/asterisk/keys/asterisk.pem
dtlscafile=/etc/asterisk/keys/ca.crt
dtlssetup=actpass

;Normal Extension

[7003]
host=dynamic
secret=6002
context=outgoing
type=peer
transport=ws,wss,udp
directmedia=no
disallow=all
allow=all

 

http.conf

Make the following settings on /etc/asterisk/http.conf  file

[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088

rtp.conf

Make the following settings on /etc/asterisk/rtp.conf  file

[general]
rtpstart=10000
rtpend=20000
icesupport=yes
stunaddr=stun.l.google.com:19302

extensions.conf

Add the same context which we applied for the extensions we created on sip.conf

[outgoing]

exten => _X.,1,Dial(SIP/${EXTEN})
;exten => _X.,n,Answer()
exten => _X.,n,Hangup()

Setup SIPML

# svn checkout http://sipml5.googlecode.com/svn/trunk/ /var/www/mywebphone (note, some systems it may be /var/www/html/mywebphone)
# chown -R asterisk:asterisk /var/www/mywebphone/ (or /var/www/html/mywebphone)
Now, head on to your Google Chrome browser and type
http://<yourIP>/mywebphone/demos/call.htm (e.g. http://192.168.1.115/mywebphone/call.htm)
Click on Expert Mode, select to Disable Video.
Enter the information like below except change the part where it says the IP, of course, enter your own IP there

Answered on January 2, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.