./ast_tls_cert -C 18.104.22.168 -O "My Super Company" -d /etc/asterisk/keys -o asterisk
Asterisk 11 Tutorial OverviewThe idea for this tutorial is to demonstrate very basic WebRTC support and functionality in Asterisk 11. We will configure Asterisk to support a remote WebRTC client, and then make calls from said client (SIPML5) to Asterisk. ICE and STUN will be used for NAT traversal, and SIP will use a WebSocket transport.
Get dependenciesInstall a variety of essential dependencies to make sure we get them. Plus install the uuid-dev package that isn't included in the Asterisk 11 install_prereq script.
Then go to your Asterisk source /contrib/scripts directory and run the install_prereq script to get everything else that is needed.
Build Asterisk with support for WebRTCUsing menuselect make sure Asterisk will build with res_http_websocket, res_crypto and chan_sip.
In the Asterisk source directory:
After verifying things are as needed in menuselect, then build and install Asterisk
Configure AsteriskNow we need to configure the various Asterisk components necessary for WebRTC support.
I always recommend backing up your current .conf files and using clean, blank text files for trying out a tutorial like this. Especially if you are new to Asterisk.
Configure http.confYou need to configure Asterisk's builtin HTTP server. You could use whatever bindport or bindaddr you want, but make sure you adjust the other configurations to match. This is the port and address that res_http_websocket and chan_sip will talk over when using a WebSocket transport.
Configure rtp.confConfigure the range of ports to use for RTP media, and we can set icesupport=yes (although the default in recent versions of 11 is now "yes") to enable support for the ICE protocol in general. We also set the address of the STUN server to use here. We use Google's STUN server which should work for just about everyone.
Configure sip.confThere is already a lot of content on the wiki and in the sip.conf sample file that explain the options here. The key options for WebRTC support and ICE support are explained at this link for WebRTC and this one for ICE.
Configure extensions.confWe'll make a simple dialplan for receiving a test call from the SIPML5 client.
If you haven't written dialplan before; this is just instructing Asterisk to answer the call and playback the sound file "demo-congrats".
Configure the firewall in front of AsteriskFirewall configuration is outside the scope of the tutorial, however here is the output from my Uncomplicated FireWall service to show you what you may need to open:
You may wish to reconfigure your services to non-standard ports, or narrow the possible source addresses for additional security.
5060: This is the port configured in sip.conf
8088: This is the port configured in http.conf
10000:20000: This is the port range configured in rtp.conf
Configure SIPML5Goto http://sipml5.org/ in your Chrome browser and use the live demo.
On the registration page use the following configuration, replacing the IP addresses with your public IP for the Asterisk server.
Open the "Expert mode" settings page and use the following details, still replacing the IP of course:
Be sure to hit save! Just leave that tab open, or close it and go back to the main tab to make a test call.
Make a test callRestart Asterisk, or start Asterisk if you haven't already.
Click "Login" with the SIPML5 client. On the Asterisk CLI you should see:
Dial extension 1000 from your SIPML5 client and you should see CLI output:
If you don't have VERBOSE messages going to the console, and verbosity turned up at least to 3 then you may not see these messages.
You should hear audio coming from your speakers or headphone! Congrats on making your first call via WebRTC using Asterisk!