System preparation
apt-get update apt-get upgrade
As the first step we need to install packages necessary to build the main webrtc2sip gateway:
apt-get install build essential libtool automake subversion git pkg-config screen libxml2-dev / libssl-dev libsrtp0-dev
to support for libspeex (audio codec) and libspeexdsp (audio processing and jitter buffer) add
apt-get install libspeexdsp-dev
adding support for VP8
apt-get install libvpx-dev
adds support for H.264 video codec (requires FFmpeg)
apt-get install libx264-dev
adding support for GSM audio codec
apt-get install libgsm1-dev
Other software components
OpenSSL
If we are planning to support for DTLS, we need at least 1.0.1 version of OpenSSL, which supports for DTLS.
We can check our installed version with:
openssl version
YASM
YASM is required if we are planning to support VP8 or H.264 codecs. To do that we need:
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz tar -xvzf yasm-1.2.0.tar.gz cd yasm-1.2.0 ./configure && make && make install
Opus
Opus is MTI codec for WebRTC. It adds support for Opus audio codec.
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz tar -xvzf opus-1.1.tar.gz cd opus-1.1 ./configure --with-pic --enable-float-approx && make && make install
ffmpeg
Doubango needs the original development headers and libraries. Some distributions of Linux have library named libav. It is something like ffmpeg but Doubango won’t build against this library therefore we need unninstall it:
apt-get remove libavutil51
Then we should continue with installing ffmpeg. We recommend to install the version of 1.0.2, because using a newer version (march 2014) there are some errors during the building of Doubango.
cd /usr/local/src wget -c http://ffmpeg.org/releases/ffmpeg-1.0.2.tar.gz tar zxvf ffmpeg-1.0.2.tar.gz cd ffmpeg ./configure --extra-cflags="-fPIC" --extra-ldflags="-lpthread" --enable-pic \ --enable-memalign-hack --enable-shared --disable-static --disable-network \ --disable-protocols --disable-pthreads --disable-devices --disable-filters \ --disable-bsfs --disable-muxers --disable-demuxers --disable-parsers \ --disable-hwaccels --disable-ffmpeg --disable-ffplay --disable-ffserver \ --disable-encoders --disable-decoders --disable-zlib --enable-gpl --disable-debug \ --enable-encoder=h263 --enable-encoder=h263p --enable-decoder=h263 \ --enable-encoder=mpeg4 --enable-decoder=mpeg4 --enable-libx264 \ --enable-encoder=libx264 --enable-decoder=h264 make make install ldconfig
Doubango
We use svn to pull in a recent checkout and then install.
cd /usr/local/src svn co http://doubango.googlecode.com/svn/branches/2.0/doubango doubango cd doubango sed -i '1,/==/s/==/=/' autogen.sh ./autogen.sh ./configure --with-ssl --with-srtp --with-vpx --with-speex --with-speexdsp \ --enable-speexresampler --enable-speexjb --enable-speexdenoiser --with-gsm \ --with-ffmpeg --with-opus --with-h264 --prefix=/usr/local make make install ldconfig
Webrtc2sip
If we have successfully installed doubango then we can build an install webrtc2sip.
cd /usr/local/src svn co http://webrtc2sip.googlecode.com/svn/trunk/ webrtc2sip cd webrtc2sip sed -i '1,/==/s/==/=/' autogen.sh ./autogen.sh ./configure --with-doubango=/usr/local --prefix=/usr/local make make install mkdir -p /usr/local/etc/webrtc2sip cp config.xml /usr/local/etc/webrtc2sip/
Then we have to customize confug file. It is located within directory /usr/local/etc/webrtc2sip/
For better understanding of all options we recommend to read technical guide, which is available on link:
http://webrtc2sip.org/technical-guide-1.0.pdf
Once we have finished with editing of the config file we may start webrtc2sip as daemon using the command:
screen -dmS webrtc2sip webrtc2sip --config=/usr/local/etc/webrtc2sip/config.xml
If we want see terminal of webrtc2sip:
screen -r webrtc2sip
To be sure that webrtc2sip is listening on defined port we can check it with command:
netstat –tupln
To add support webrtc2sip for DTLS we need SSL certificates. To get needed self signed certs you can follow this guides:
http://codeghar.wordpress.com/2013/04/16/create-private-certificate-authority-on-linux/
http://codeghar.wordpress.com/2013/04/16/generate-certificate-signing-request-on-linux/
From things which you created in previous steps, configuration for the ssl-certificates in config.xml can look like this:
<ssl-certificates> /home/user/mycert/private/key.csr.server1.pem; <!-- private key --> /home/user/myca/certs/crt.server1.pem; <!-- self signed certificate --> *; <!--or /home/user/myca/certs/crt.ca.cg.pem; --> no </ssl-certificates>
Author: Patrik Formanek 2014