Main goal
In this tutorial we will show how to configure Asterisk to receive SIP calls from WebCallServer WebRTC client.
After configuration you will get:
- Audio calls between WebRTC based WebCallServer clients behind different NATed networks
- Audio calls between WebRTC based WebCallServer clients and softphones connected to your Asterisk server
What will not work:
- As current Asterisk version is not supports VP8 video codec, you will not be able to make video calls
Prerequisites
We are not covering Asterisk installation process. There are lot of tutorials on the net that explains how to setup Asterisk.
As a prerequisites, you will need:
- Up and running Asterisk 11.3.0 or latest with SRTP support
- Up and running WebCallServer 3.0-257 or latest (installation process)
- WebCallServer client 3.0.299 or latest
- Chrome 26 or latest
Asterisk ICE support
As WebRTC is using ICE, we will need to enable it at Asterisk side.
All what you will need to do is add ICE support on peer basis in sip conf:
icesupport=yes
Enable SRTP and AVPF
All media streams in WebRTC is encrypted using SRTP. Asterisk using libsrtp to provide SRTP support.
You will need to enable encryption support on each peer that you create for WebCallServer WebRTC based client.
Also, WebRTC is using AVPF so you will need to enable it too.
encryption=yes
avpf=yes
Peers definition in sip.conf
For tests we will configure 3 SIP peers, two of them for WebCallServer WebRTC based client and one for SIP softphone.
[1000]
type=friend
host=dynamic
nat=no
qualify=no
secret=passwordtouprefer
callerid=1000 <1000>
canreinvite=no
context=internal
avpf=yes
encryption=yes
icesupport=yes
disallow=all
allow=alaw
[1001]
type=friend
host=dynamic
nat=no
qualify=no
secret=passwordtouprefer
callerid=1001 <1001>
canreinvite=no
context=internal
avpf=yes
encryption=yes
icesupport=yes
disallow=all
allow=alaw
[1002]
type=friend
host=dynamic
nat=no ;use comedia, force_rport if your softphone is behind nat
qualify=no
secret=passwordtouprefer
callerid=1002 <1002>
canreinvite=no
context=internal
allow=all
After configuration was done, you will need to reload sip.conf:
asterisk -rx "sip reload"
Extensions.conf
Here is sample config for Asterisk extensions.conf that defines "internal" context and enables calls between previously defined sip peers.
Add it to the end of extensions.conf file:
exten => _XXXX,1,Dial(SIP/${EXTEN})
After configuration were done, you will need to reload dialplan:
asterisk -rx "dialplan reload"
Disable video support on WebCallServer client
We need to disable video support on client side because Asterisk is not supporting VP8 video codec.
Change code in file js/rtc/WebRtcMediaManager.js:
}, {"optional": [], "mandatory": {"OfferToReceiveAudio": true, "OfferToReceiveVideo": true}});
}, {"optional": [], "mandatory": {"OfferToReceiveAudio": true, "OfferToReceiveVideo": false}});
Test calls
To test functionality you will need to register all three sip peers as follows:
- peers 1000 and 1001 should be registered using WebCallServer WebRTC based client
- peer 1002 should be registered using sip softphone
After all done, you will be able to call between extensions without any problem.
Asterisk will proxy RTP and SIP, and convert media stream for sip softphone if needed.
If you have any questions, feel free to contact our support at support@flashphoner.com