Installing webrtc2sip on Ubuntu 12.04

Note: this page is unmaintened and could contain incorrect information. As I am no longer involved in the telco business I won’t update this article anymore. I will also not respond to any personal e-mail with regard to this article.

Contents

  1. Introduction
  2. The hard way: building from source
    2.1 Prerequisites
    2.2 ffmpeg
    2.3 doubango
    2.4 webrtc2sip
  3. The easy way: install the packages
  4. Configuration
  5. Run it!

Introduction

From the webrtc2sip website:

webrtc2sip is a smart and powerful gateway using RTCWeb and SIP to turn your browser into a phone with audio, video and SMS capabilities. The gateway allows your web browser to make and receive calls from/to any SIP-legacy network or PSTN.

The contents of this tutorial are loosely based on the webrtc2sip Google Code project Wiki entry Building_Source_v2_0. This tutorial assumes a basic knowledge of administering a Linux system, VoIP/SIP and building software from source.

The hard way: building from source

Prerequisites

You will need a basic up to date Ubuntu 12.04 server install with the necessary packages to build webrtc2sip. To install those packages the following command will do:

sudo -i
apt-get update
apt-get upgrade
apt-get install build-essential libtool automake subversion git-core libsrtp0-dev \
libssl-dev libspeexdsp-dev yasm libvpx-dev libgsm1-dev libxml2-dev libx264-dev \
screen pkg-config

Before you can start building webrtc2sip itself you will first need to build ffmpeg and doubango from source. doubango is the framework on which relies webrtc2sip and for doubango to be able to do the necessary conversion you will need some libraries from the ffmpeg project.

ffmpeg

You will need to build from a recent ffmpeg release because the Doubango framework needs the original ffmpeg development headers and libraries and Ubuntu ships with libav, a slight more conservative fork of ffmpeg. The Doubango framework won’t build against these Ubuntu libav packages. Before building ffmpeg from source make sure your system does not have any libav packages installed. The following command should uninstall all libav related packages:

apt-get remove libavutil51

Build and install ffmpeg with:

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 -j `getconf _NPROCESSORS_ONLN`
make install
ldconfig

doubango

Now you can build doubango from source. Use svn to pull in a recent checkout.

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-h264 --prefix=/usr/local
make -j `getconf _NPROCESSORS_ONLN`
make install
ldconfig

If you want to use Linphone clients with VP8 you will have to disable VP8 extensions otherwise Linphone won’t show any video:

sed -i 's/TDAV_VP8_DISABLE_EXTENSION       0/TDAV_VP8_DISABLE_EXTENSION       1/' \
/usr/local/src/doubango/tinyDAV/src/codecs/vpx/tdav_codec_vp8.c

webrtc2sip

With doubango successfully installed you can now pull in the source of webrtc2sip from svn and build it from source.

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 -j `getconf _NPROCESSORS_ONLN`
make install
mkdir -p /usr/local/etc/webrtc2sip
cp config.xml /usr/local/etc/webrtc2sip/

If you want webrtc2sip to look for /usr/local/etc/webrtc2sip/config.xml on startup you can modify mp_mediaproxy.cc before building webrtc2sip:

sed -i '1,/NULL/s/NULL/"\/usr\/local\/etc\/webrtc2sip\/config.xml"/' mp_mediaproxy.cc

After that you can build webrtc2sip as described above. This step is optional as webrtc2sip now has the --config=/path/to/config.xml command line option that allows you to have webrtc2sip look for the designated config.xml file on startup.

The easy way: install the packages

sudo -i
apt-get install python-software-properties
add-apt-repository ppa:autostatic/doubango
apt-get update
apt-get install webrtc2sip

This will install the Doubango framework, webrtc2sip and all the necessary dependencies. By default webrtc2sip will not run, you will have to edit the file /etc/default/webrtc2sip first and change the following line:

RUN_WEBRTC2SIP=no

to:

RUN_WEBRTC2SIP=yes

Configuration

Configuration of webrtc2sip is done in /usr/local/etc/webrtc2sip/config.xml when built locally and /etc/webrtc2sip/config.xml when installed from the packages. Edit it to your needs with the help of the webrtc2sip Technical Guide. A sample configuration could look like this:

<?xml version="1.0" encoding="utf-8" ?>
<!-- Please check the technical guide (http://webrtc2sip.org/technical-guide-1.0.pdf) for more information on how to adjust this file -->
<config>

  <debug-level>ERROR</debug-level>

  <transport>udp;*;10060</transport>
  <transport>ws;*;10060</transport>
  <transport>wss;*;10062</transport>

  <enable-rtp-symetric>yes</enable-rtp-symetric>
  <enable-100rel>no</enable-100rel>
  <enable-media-coder>yes</enable-media-coder>
  <enable-videojb>yes</enable-videojb>
  <video-size-pref>vga</video-size-pref>
  <rtp-buffsize>65535</rtp-buffsize>
  <avpf-tail-length>100;400</avpf-tail-length>
  <srtp-mode>optional</srtp-mode>
  <srtp-type>sdes;dtls</srtp-type>

  <codecs>pcma;pcmu;gsm;vp8;h264-bp;h264-mp;h263;h263+</codecs>


  <!--nameserver>66.66.66.6</nameserver-->

  <!--ssl-certificates>
    C:/Projects/ssl/priv.pem;
    C:/Projects/ssl/pub.pem;
    C:/Projects/ssl/ca-cert.pem;
    no
  </ssl-certificates-->

</config>

Run it!

If you build everything from source:

screen -dmS webrtc2sip webrtc2sip --config=/usr/local/etc/webrtc2sip/config.xml && \
screen -r webrtc2sip

If you installed the packages:

service webrtc2sip start
screen -r webrtc2sip/webrtc2sip