[UPDATED: 12 April 2013]
- WARNING – sipml5’s PATCH BELOW DOESN’T WORK ON NEW RELEASED AST 11.3 AND/OR THE LATEST CHROME Version 26.0.1410.64 m SEEM TO HAVE BROKE THIS AND CAUSES ONE WAY AUDIO. IF YOU DO NOT ENCOUNTER THIS, PLEASE LET ME KNOW. I COULD BE HAVING ISOLATED NAT ISSUES.
Hi guys, in a few days I’d be introducing WebRTC and all its jazz to our Malaysia Asterisk User Group (MAUG). I was asked to demonstrate WebRTC and how it changes everything (again).
The following guide was taken off various sources as initial references such as Digium’s Wiki and sipML5’s how to for Asterisk found here.
And yes, again, this guide is mainly targeted to Debian users, other OS users, please improvise and do your best. Otherwise, drop me a note at sanjayws@gmail.com
OK, to begin, here are my components I am using
- Debian 6
- Asterisk 11 (11.2.1 with a patch explained later)
- Chrome version 24.0.1312.56 m
- sipML5 (Thanks to Dubango Telekom http://www.doubango.org/)
- FreePBX (optional)
Here’s a step by step with some explanation, remember only # cli codes you can copy paste
- Go to your source
- # cd /usr/src/
- Get libsrtp (as WebRTC only allows comms using secure / encrypted connections)
- # wget http://srtp.sourceforge.net/srtp-1.4.2.tgz && tar -zxvf srtp-1.4.2.tgz && cd srtp
- # ./configure
- # make && make install
- Now, we upgrade/update/install asterisk 11.2.1 if you’re not already running that particular version, if you are, skip the related parts here (points 8-11)
# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11.2.1.tar.gz && tar –zxvf asterisk-11.2.1.tar.gz
# cd /usr/src/asterisk-11.2.1 && make clean - # contrib/scripts/get_mp3_source.sh
- # ./configure --with-crypto --with-ssl --with-srtp
- # make menuselect.makeopts
- # menuselect/menuselect --enable format_mp3 --enable res_config_mysql --enable app_mysql --enable app_saycountpl --enable cdr_mysql --enable EXTRA-SOUNDS-EN-GSM
- # wget http://sipml5.googlecode.com/svn-history/r169/trunk/asterisk/asterisk_379070.patch (see here what this patch do)
- # patch -p0 -i ./asterisk_379070.patch
- Now time to reconfigure and recompile Asterisk with SRTP etc…(WARNING, do not make samples if you have working configurations or use FreePBX etc…)
- # make && make install
(NOTE : THIS BELOW SEEM TO HAVE BEEN FIXED ON ASTERISK 11.2.1 …BUT..if you have issues compiling/recompiling with ccar errors, try removing it like this# nano ./res/pjproject/build/cc-auto.mak
and remove the characters "cc" from "ccar" and "ccranlib" ie just showing only “ar” and “ranlib” respectively.). Rerun the above entire command line. - Configure some parameters on Asterisk / config files
- Edit the /etc/asterisk/sip.conf (or modify Asterisk SIP Settings in FreePBX), add/modify the following settings, in [general]. Notice we add transport ws and wss, these are websocket and websocket secure
udpbindaddr=0.0.0.0:5060
realm=<yourIP or name> e.g. 192.168.2.239
transport=udp,ws,wss
- Edit the /etc/asterisk/rtp.conf and we add support for STUN (now supported on Asterisk 11). Read here for more info. Change/modify to your own if you don’t want to use the sample here.
icesupport=yes
stunaddr=132.177.123.6
NOTE: The above IP was resolved from the free stun server stunserver.org - Edit the http.conf file /etc/asterisk/http.conf, look for and modify or with an empty config, paste this below (uncomment if they are commented with a ; )
[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
Be sure its running after restarting Asterisk, check like below, you should be seeing output showing LISTEN somewhere
# netstat -an | grep 8088
- Now, create one (or more if you wish to do browser to browser calls, for other phones create a normal SIP extensions like how you would do ) SIP accounts in /etc/asterisk/sip.conf with example below (FreePBX users modify it in /etc/asterisk/sip_custom.conf)
[8000]
secret=C@mplEX123
context=from-internal
host=dynamic
trustrpid=yes
sendrpid=no
type=friend
qualify=yes
qualifyfreq=600
transport=udp,wss,ws
encryption=yes
dial=SIP/8000
callerid=Sanjay Willie <8001>
callcounter=yes
avpf=yes
icesupport=yes
directmedia=no
- Note: Since I use FreePBX, I use the context from-internal, where my dialplans are already created by FreePBX for me. For this customized extension to work, I created a SIP extension 2001 but under the DIAL I placed SIP/8000 instead so that it will ring my custom sip account and also the dialplan is now registered inside FreePBX’s dialplan to reach 8000. So. basically, now when I want to reach 8000 I actually dial 2001, get it? Otherwise write a simple dialplan like shown below the image

[from-internal-custom]
exten => 8000,1,Dial(SIP/8000)
same => hangup()
- Now, restart Asterisk (kill and start)
- Now, its time we get the sipML5 softphone and get started!
- Go to your source directory, e.g. /usr/src, get the source using SVN, if you don’t have SVN, you need to install it (see how here)
- Assuming your web(http) default directory is in /var/www
- # svn checkout http://sipml5.googlecode.com/svn/trunk/ /var/www/myphone (note, some systems it may be /var/www/html/myphone)
- # chown -R asterisk:asterisk /var/www/myphone/ (or /var/www/html/myphone)
- Now, head on to your Google Chrome browser and type
- http://<yourIP>/myphone/demos/call.htm (e.g. http://192.168.2.239/myphone/call.htm)
- Click on Expert Mode, select to Disable Video.
- Enter the information like below except change the part where it says the IP, of course, enter your own IP there

Websocket URL: ws://192.168.2.239:8088/ws (Note this is not an SSL enabled site, i.e. using just ws, not wss, if you want to use WSS as the protocol, then you need to enable it on Asterisk’s HTTP server by generating keys etc…) - Click on Save
- Go back to the other tab which the webphone is on, enter the SIP extension detailed you created above, or follow and modify per example below

Display name: Sanjay Intuittech
Private Identity: 8000 (or your extension number)
Public Identity: sip:8000@192.168.2.239 (if you are doing some NAT, it will be like sip:8000@202.188.0.133 where the IP will be a public IP or name)
Password: C@mplEX123
Realm: 192.168.2.239
Now click Login!, you should see the text Connected, like above in my picture - Now, dial and dial away…..e.g. outbound call
- Now I use my Zoiper softphone to dial 2001 (remember, it’s a “virtual” number we manipulated on FreePBX to dial SIP/8000 instead and here’s how it looks! Chrome receiving a call!
- Now you can go ahead and try using it on another Chrome browser or other browsers, like Internet Explorer, Firefox and the rest and do give your feedback. But for other browsers you need a piece of software or set some configuration, see here.
- For mobile browsers with WebRTC support, Google is still working on it with Chrome on Android and iOS. Meantime, you can checkout Bowser (yes BOWSER a WebRTC supported mobile web browser for iPhone and Android, however I had some issues with javascript complaining, hope you have better luck…If you did manage to get it to work, let us know and share with the community.
- An important thing to note, Webrtc definition uses only g711 and OPUS. So, consider bandwidth repercussions using this solution as OPUS is not yet ready on Asterisk, so we have to live with g711 for now.
- SipML5 folks updated the UI to include below buttons…

Don’t want the headaches of all of these installation steps, use PIAX - http://pbxinaflash.com/community/index.php?threads/new-webrtc-with-asterisk-11.15274/#post-99636 …ready to rock with WebRTC
47 comments:
Hi Sanjay,
Thank you for outlining these steps. I know the SRTP steps really trip up a lot of people. I just want to point out that the iOS / Android browser you mention in your last paragraph in step #35 is spelled "Bowser" not "Browser". You should correct that so that people can find Ericsson's WebRTC browser more easily.
James
Thanks James, correction done.
Hello Sanjay,
Thanks for your step by step guide. this is really great news.
What about audio, are you having any difficult to hear the other side on your case?
It looks like I have few problem with audio support via Chrome browser.
Any additional configuration to validate or other suggestions from your side will be appreciated.
Best regards,
Ben.
Hi Ben..no issue for me tho
Hi Ben
I missed out the part of using ice on rtp.conf, please see the updated info above, where rtp.conf is concerned.
Thanks and good luck!
hmm, you might be correct, just tested it does seem to have one 3/4 audio from chrome to chrome...
There's some discussion here:
http://code.google.com/p/sipml5/wiki/Asterisk
Might look into it later...kinda busy today
Hello Sanjay,
Thanks for your kind support.
I will try your last suggestion and will update about the result.
Thanks,
Ben.
Great writeup. For aggregations such as PBX in a Flash, the default web directory should be /var/www/html instead of /var/www. Thanks!!
Thank you for choosing Debian ))
Audio now works all case scenarios and properly with this update.
Thanks, I've "kinda of" got this working using am Amazon AWS instance and peered it with a traditional VoIP service. Problem - I'm getting one way audio. Can hear the far end fine, but they don't hear me.
Looking at Wireshare, doesn't appear as if my 'sending' PC is even attempting to send any packets out. Ugh.
Hi Chris
1) Try loopback test
2) Ensure you got the stun server working properly, you can google and try looking for other alternatives.
3) Make sure any NAT settings are correct
Thanks for help. I conf'd inbound SIP trunk to the WebRTC client, I get 2-way audio and works fine. Outbound FROM the WebRTC client still only 1-way (can only hear the far end).
Will keep investigating, likely something small and overlook.
Great writeup. Works like a champ. Step #25 should be /var/www/html on FreePBX-based systems. We have a working demo on the PIAF Forum. Thanks!
Thanks NerdUno.
Appreciate your efforts for the community too PIAF rocks. :)
Hi Sanjay.
Great work! BTW, I can see that there is a webrtc2sip utility to solve most of the voice issues for sipml5 and Asterisk. Did you have any hands on experience with it?
Thanks.
Hi Sanjay,
thanks for the detailed process, but I have few questions...
After executing step 15 it had two configure error in /usr/src/asterisk-11.2.1 and c++ preprocessor fails in sanity check
Also,when I try to execute step 17 it reports that the folder is not found. Should I create cd /etc/asterisk/ ?
Do you have a working asterisk 11 already installed?
Wonderful article Sanjay,
There is a typo in step no 20. /etc/sip.conf should be /etc/asterisk/sip.conf
--Satish Barot
Thanks and corrected.
sanjay i cannot get to compile. keep getting the following error:
checking for the ability of -lsrtp to be linked in a shared object... no
configure: WARNING: ***
configure: WARNING: *** libsrtp could not be linked as a shared object.
please help i have tried everything
Hi try to configure like this
./configure CFLAGS='-fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops' --prefix=/usr
Thank you for providing this excellent guide.
Do you get video between the endpoints?
Thank you for providing this excellent guide.
Do you get video between the endpoints?
Hi,
I have tried to configure srtp with
./configure CFLAGS='-fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops' --prefix=/usr
Still the same error comes during the asterisk configure
System is Ubuntu 10.04 64bits
Any other ideas?
Could I just continue with the make of asterisk in this state and ignore that error?
Would love to test asterisk with WebRTC
Hi, I have tried and configured srtp with
./configure CFLAGS='-fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops' --prefix=/usr
However, asterisk configure still shows the same error msg at the end :-(
System is Ubuntu 10.04 64bit
I'd love to test asterisk with WebRTC - could I just ignore that error and proceed to the make & install of asterisk?
Your help woud be much appreciated.
Hi, I have a doubt, Can we integrate WebRTC with Asterisk without using any browser? Please clarify it.
Advanced a lot of Thanks.
Hi, I have a doubt, Can we integrate WebRTC with Asterisk without using any browser? Please clarify it.
Advanced a lot of Thanks.
Hi all,
Please tell about configuration between Asterisk and WebRTC with explanation.
Thank you.
Error in paragraph 10 (One --eneble delete). correctly so
menuselect/menuselect --enable format_mp3 --enable res_config_mysql --enable app_mysql --enable app_saycountpl --enable cdr_mysql --enable EXTRA-SOUNDS-EN-GSM menuselect.makeopts
Error in paragraph 10 (One --eneble delete). correctly so
menuselect/menuselect --enable format_mp3 --enable res_config_mysql --enable app_mysql --enable app_saycountpl --enable cdr_mysql --enable EXTRA-SOUNDS-EN-GSM menuselect.makeopts
can I use the video mode?because you said "everything works"?
thanks in advance
can I use the video mode?I'm curious how to make video call using Asterisk+webRTC, since I know video call using webRTC is not using Flash Player,but HTML 5..
thanks in advance.
HI Earl,
I've not tried video, will try in next few days...
If you (or someone) gets it working, please let us know.
I've tried once like last year, it worked only for a short while and Asterisk kept crashing...
Hi Sanjay, I followed the steps mentioned in your blog and compiled asterisk 11.2.1 with the mentioned patch on debian 6. After compilation i found that res_features.so is not getting created which is a must for sip_chan.so. Can you suggest a solution for this .
What error do u get while compiling?
I didnt got any error while compiling... I thought that i might be missing on some libraries that i need to install. i ran the install_prereq script to install any dependency that might be missing. I could see in the make install output that res_features.so was not created. I suspect something is wrong with the patch. Please suggest.
Hi Sanjay,
Can you share the config files which are working for you so that i can validate my asterisk installation(sip.conf,http.conf,modules.conf,extensions.conf,user.conf) Your help is very much required as i am stuck here
using chrome i face this warning then call hanged:
WARNING[15242][C-00000009]: chan_sip.c:10427 process_sdp: Can't provide secure audio requested in SDP offer
>please help
Hello,
On step 15 make && make install I keep getting the following error:
make[1]: Entering directory `/usr/src/srtp/asterisk-11.3.0'
[CC] sip/sdp_crypto.c -> sip/sdp_crypto.o
sip/sdp_crypto.c:53: error: duplicate member âtagâ
make[2]: *** [sip/sdp_crypto.o] Error 1
make[1]: *** [channels] Error 2
make[1]: Leaving directory `/usr/src/srtp/asterisk-11.3.0'
make: *** [_cleantest_all] Error 2
I'm using Asterisk 11.3.0 with FreePBX.
Any help is much appreciated.
Frederik
Frederik89
Looks like its looking for SRTP in the wrong location. Not sure why tho.
Fredrik
Also those steps above was for 11.2.1
Didn't really test on 11.3
Works fine with Chrome (on Linux) 24.0.1312.57 (Official Build 178923)
and does not work on Windows with Chrome 26.....
Hi Sir,
Whenever I am intsalling patch by following your step then I am getting below error,
# patch -p0 -i ./asterisk_379070.patch
patching file channels/chan_sip.c
Hunk #1 succeeded at 12547 (offset -52 lines).
Hunk #2 succeeded at 12569 (offset -52 lines).
Hunk #3 succeeded at 13227 (offset -53 lines).
patching file channels/sip/sdp_crypto.c
Hunk #1 succeeded at 48 with fuzz 2.
Hunk #2 succeeded at 65 with fuzz 2 (offset 1 line).
Hunk #3 FAILED at 283.
Hunk #4 FAILED at 296.
2 out of 4 hunks FAILED -- saving rejects to file channels/sip/sdp_crypto.c.rej
Why it is showing Failed 283 and 296, Am I missing something.
Thanks
Hi Sanjay,
Whenever I am running make command according to your steps then I am getting below error, What could be issue,
ip/sdp_crypto.c:53: error: duplicate member âtagâ
make[2]: *** [sip/sdp_crypto.o] Error 1
make[1]: *** [channels] Error 2
make[1]: Leaving directory `/usr/src/asterisk-11.3.0'
make: *** [_cleantest_all] Error 2
Any help ?
Hi Willi,
When I am running patch command then I am getting below error, What would be resolution for it.
# patch -p0 -i ./asterisk_379070.patch
patching file channels/chan_sip.c
Hunk #1 succeeded at 12547 (offset -52 lines).
Hunk #2 succeeded at 12569 (offset -52 lines).
Hunk #3 succeeded at 13227 (offset -53 lines).
patching file channels/sip/sdp_crypto.c
Hunk #1 succeeded at 48 with fuzz 2.
Hunk #2 succeeded at 65 with fuzz 2 (offset 1 line).
Hunk #3 FAILED at 283.
Hunk #4 FAILED at 296.
2 out of 4 hunks FAILED -- saving rejects to file channels/sip/sdp_crypto.c.rej
if you have any idea about it then please let me know.
Post a Comment