Last Updated: February 25, 2016
· mattisdada

Installing Asterisk 11 with WebRTC / Websockets for Mandriva

This is a self guide for installing Asterisk 11 with WebRTC / Websockets for Mandriva. The instructions given here should work flawlessly for any distro as everything is built from source. (Example, Ubuntu, Gentoo, Mint, CentOS, RHEL, etc)

This is assuming a fresh install.

Install lib dependancies. Not all of these are required for every install, but are very commonly required. (replace urpmi with equivlent [ie, apt-get install, yum, etc])

# making sure we have the mirrors we need. optional 
urpmi.addmedia --distrib --mirrorlist '$MIRRORLIST'

urpmi wget gcc gcc-c++ ncurses-devel libxml2-devel sqlite-devel libuuid-devel openssl-devel mysql lib64mysql-devel git lib64uuid-devel  sqlite3-devel

Change directories to our source folder

cd /usr/local/src

Download the required sources for Asterisk & pre-reqs


Extract sources (replace X/Y with the version numbers, you can use the tab feature to quickly auto-complete)

tar -zxvf libpri-1.X.Y.tar.gz
tar -zxvf dahdi-linux-complete-current.tar.gz
tar -zxvf asterisk-11-current.tar.gz

Next we are going to build out the pre-req's for Asterisk (DAHDI, LibPRI). Each of these lines assume you have the current directory set as /usr/local/src.

If you run into compiling issues, the most likely reason is you have missing libaries / compilers. Googling the error will tell you what you require then use urpmi (or system equivalent) to download & install


cd dahdi-linux-complete-2.X.Y+2.X.Y
make install
make config 


cd libpri-1.X.Y
make install    

Optional (if you want Websockets to work this is required)


tar zxvf srtp-1.4.2.tgz
cd srtp
./configure CFLAGS=-fPIC
make install

Now to actually installing Asterisk 11

cd /usr/local/src/asterisk-11.X.Y

Note: If you have missing dependencies and need to run configure again, I recommend running make distclean beforehand. Trust me, a lot less headaches

Now it's time to pick and choose what features you need in your installation. I do recommend installing the MySQL features, even if you don't immediately intend to use it. I find most people end up using it in some capacity.

make menuselect

To have Websockets work you must enable STRP (Resources -> reset_strp)

Once you have finished picking what features you want all we have to do now is compile and install

make install

Optional Installing sample config files

make samples

Installing Initialization Scripts and Log Rotate

make config
make install-logrotate

Next we have to make sure Websockets can connect to our server.

Create or edit /etc/asterisk/http.conf

bindaddr= ; Or replace this with your IP address for better security

Create or edit /etc/asterisk/sip.conf (please note this is just an example, I stole it from SipJS to make everyone's lives easier than my messy config)

realm= ; Replace this with your IP address
udpbindaddr= ; Replace this with your IP address

[1060] ; This will be WebRTC client
username=1060 ; The Auth user for SIP.js
host=dynamic ; Allows any host to register
secret=password ; The SIP Password for SIP.js
encryption=yes ; Tell Asterisk to use encryption for this peer
avpf=yes ; Tell Asterisk to use AVPF for this peer
icesupport=yes ; Tell Asterisk to use ICE for this peer
context=default ; Tell Asterisk which context to use when this peer is dialing
directmedia=no ; Asterisk will relay media for this peer
transport=udp,ws ; Asterisk will allow this peer to register on UDP or WebSockets
force_avp=yes ; Force Asterisk to use avp. Introduced in Asterisk 11.11

[1061] ; This will be the legacy SIP client

And that should have you up and running. You can use sipml5 or SIPJs to test Websocket connections and VOP Nano to test SIP connection.

Your websocket URL is:

ws://<ip address>:8088/ws