Compiling and Installing WebRTC2SIP.
TweetWhat is WebRTC2SIP and how to use it with the Asterisk PBX in the Amazon AWS EC2 service
NOTE: If you are trying or want to get rid of webrtc2sip and use a plain asterisk installation, see "WebRTC with Asterisk and Amazon AWS".
A lot of sources around the Internet explain how to compile and install Webrtc2sip so one can have SIP as the signaling protocol in a webrtc application, mostly in conjunction with Asterisk and/or FreeSWITCH.
Most of the time those instructions are outdated or incomplete, so here is the updated way of installing webrtc2sip and its dependencies, using Amazon Linux in an EC2 instance inside AWS, altough I'm pretty sure this could also be used for any CentOS like OS.
The original instructions for installing webrtc2sip are located here and this article is a "small" update for it. We try to build webrtc2sip and doubango with as many options as possible, so feel free to skip any dependencies (like codecs) that you are sure will be of no use for you.
NOTE:This will end up with an environment with a mixed license style, so you are warned to check if your product or installation or use of these different pieces of software will violate or not each one the licenses. A good starting point is the Licensing page in the Doubango website.
webrtcsip is made by Doubango, so a big thanks for them to make this available to everyone!
Installing Base Packages needed to build WebRTC2SIP
We first need to install some basic packages, to compile webrtc2sip, doubango, and Asterisk, later on.
Nginx is installed so we can serve our own HTML5 application in the same server, but you can skip it if that will not be your case.
In a similar way, GNU Screen is installed becase I still like to use it, so feel free to also skip it or replace it with another thing.
Install DaemonTools so we can start WebRTC2SIP as a service
It is highly recommended that you manage your asterisk and webrtc2sip installations with daemontools. You can find out how to install them in this article titled: Installing DaemonTools in Amazon Linux (or CentOS like OS).
Install libsrtp as a shared library
libsrtp is used to provide audio by using SRTP and its mandatory for webrtc communications. We need to install libsrtp as a shared library:
Install speex
The Speex codec has been superseded by Opus, and it is optional.
Install YASM
If you want codecs like VP8 or H.264, then you will need YASM to build the libraries VPX and x264 respectively.
Install libvpx (for VP8/9 codecs)
This one is optional but recommended to support video in Chrome or Firefox.
Install libopus
One of the Mandatory to Implement (MTI) audio codecs for WebRTC is Opus.
Install opencore-amr
The AMR Codec is optional, but you can support it by installing the opencore-amr library.
Install libgsm
libgsm is optional and you can install it if you want to provide support for the GSM codec.
You have to download and apply the following patch so you can build libgsm as a shared library:
Install G729
g729 is optional, build it and install it to enable support for the G.729 codec.
Install iLBC
The iLBC codec is also optional, but you can enable support for it by installing the iLBC library that comes with Doubango:
Install x264
The x264 library will provide support for the H.264 codec (also, optional).
Install FFMpeg
FFMpeg is required to support (the optional codecs) H.263 codec, H.264 (requires x264), and MP4V-ES.
Install openh264
According to the original instructions, if you want to support the H.264 "constrained baseline video", you will need openh264, the main repo is located at GitHub: https://github.com/cisco/openh264.
Install Doubango
Doubango are the guys behind the Doubango Cross-platform 3GPP IMS/LTE framework for embedded systems and it's needed to support all what webrtc2sip does:
If you are building with g.729 support, open up the file configure and locate the following couple of lines:
Just above the line that reads char Init_Decod_ld8a (); add:
This is needed because the symbol bad_lsf is declared as "extern" in the g729 library. Perhaps this changed later on in the g729 library and the doubango framework was not updated to reflect that. Let's move on now with building and installing the framework.
Install WebRTC2SIP
Finally, we can build the webrtc2sip tool!
Configuring webrtc2sip
Doubango has written a guide about how to install and configure webrtc2sip, you can find it here: http://webrtc2sip.org/technical-guide-1.0.pdf. Once you're satisfied with your configuration file, you can use the flag --config when starting it to specify the location of your config file.
Make WebRTC2SIP run as a service
To start webrtc2sip when the system boots, you can refer to the article titled Starting WebRTC2SIP as a service without screen or console.
That's it! Start writing cool HTML5 and VoIP enabled applications using WebRTC and the Asterisk PBX
Phew! That was long and tedious, but hopefully effective as well :) You now have your own webrtc2sip installation, clean and shiny to start playing around with webrtc, a fun topic indeed!