Asterisk and sipml5 interoperability

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. Setting up webrtc2sip
  3. Setting up Asterisk
    3.1 Installation
    3.2 Configuration
    3.2.1 /etc/asterisk/sip.conf
    3.2.2 /etc/asterisk/extensions.conf
  4. Setting up sipml5
    4.1 Prerequisites
    4.2 sipml5: Registration
    4.3 sipml5: Expert settings
  5. Make a call!
  6. Some notes

Introduction

At the moment Asterisk has limited functionality to communicate with clients that use WebRTC, like sipml5. Asterisk understands the offered media profile but it still has some issues with setting up the ICE connections. So the signaling works (setting up a call) but setting up the media streams fails.  Also Asterisk can’t do videocalls with standard WebRTC clients because WebRTC uses VP8 as its video codec and Asterisk has no support for VP8.

Enter webrtc2sip. webrtc2sip is a media gateway developed by Doubango that can connect any SIP client, regardless of the underlying framework. webrtc2sip effectively takes care of all the communication between legacy SIP clients and WebRTC clients, it not only handles media profile and codec conversion but also all ICE connections.

Setting up webrtc2sip

See Installing webrtc2sip on Ubuntu 12.04.

Setting up Asterisk

Installation

sudo apt-get install libncurses5-dev libnewt-dev libsqlite3-dev
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
tar zxvf asterisk-11-current.tar.gz
cd asterisk-11.1.2
./configure
make menuselect # optional step
make -j `getconf _NPROCESSORS_ONLN`
make install
make config
make samples

VP8 Passthrough Support

If you want to connect SIP clients to Asterisk using VP8 then you can patch Asterisk to add VP8 passthrough support. Note that this patch is experimental so use at your own risk.

Before running ./configure download the patch and apply it:

wget https://raw.github.com/AutoStatic/asterisk-vp8/master\
/asterisk_11_vp8_passthrough_support.patch
patch -p1 -i asterisk_11_vp8_passthrough_support.patch

After that you can continue with compiling and installing.

Configuration

Create md5 hashes for your users. Even though md5 is far from being secure it is always better to have hashed passwords then plain-text passwords in your sip.conf.

echo -n WebRTCClient:mydomain.tld:mystrongpassword | md5sum | cut -d " " -f 1
echo -n LegacySIPClient:mydomain.tld:mystrongpassword | md5sum | cut -d " " -f 1

Of course you can also use plain text passwords in your sip.conf and use the secret option instead of md5secret.

/etc/asterisk/sip.conf

[general]
context = public
allowoverlap = no
realm = mydomain.tld
udpbindaddr = 111.222.333.444
allow = !all,alaw,ulaw,gsm
useragent = Name of your PBX
nat = auto_force_rport,auto_comedia
videosupport = yes

[webrtc-template](!)
type = friend
context = webrtc
host = dynamic
allow = h264,h263p,mpeg4

[WebRTCClient](webrtc-template)
callerid = “WebRTCClient” <100>
md5secret = md5hashofuser
directmedia = outgoing

[LegacySIPClient](webrtc-template)
callerid = “LegacySIPClient” <200>
md5secret = md5hashofuser
directmedia = no

If you have compiled Asterisk with VP8 passthrough support you can simply add vp8 to the list of allowed videcodecs in your webrtc template.

/etc/asterisk/extensions.conf

[public]
exten => s,1,NoOp()
 same => n,Hangup()

[webrtc]
exten => 100,1,Dial(SIP/WebRTCClient)
same => n,Hangup()

exten => 200,1,Dial(SIP/LegacySIPClient)
same => n,Hangup()

Setting up sipml5

Prerequisites

Download Google Chrome if you haven’t done so yet. If Google Chrome is already installed make sure you’re using the latest stable version (currently 24.0.1312.52). Start Chrome and browse to http://sipml5.org/call.htm

sipml5: Registration

Display Name: WebRTCClient
Private Identity: WebRTCClient
Public Identity: sip:WebRTCClient@mydomain.tld
Password: mystrongpassword
Realm: mydomain.tld

sipml5: Expert settings

Disable Video: unticked
Enable RTCWeb Breaker: ticked
WebSocket Server URL: ws://mydomain.tld:10060
SIP outbound Proxy: N/A

Make a call!

In sipml5 you should now be connected.  You can make a call by entering 200 in the Call control field. The client that you used with the LegacySIPClient account should now start ringing. Once the call gets accepted audio and video should start flowing between both endpoints.

Some notes

This setup has only been tested on a server directly connected to the internet. Apparently running a combined webrtc2sip/Asterisk server on a local network can cause issues especially if this local network has no or limited internet access. Signaling will work but setting up the mediastreams will probably fail because webrtc2sip wants to set up ICE connections to an outside STUN server (stun.l.google.com) and if this fails the media streams will not get set up.