[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 firstname.lastname@example.org
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
realm=<yourIP or name> e.g. 192.168.2.239
- 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.
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 ; )
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)
callerid=Sanjay Willie <8001>
- 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
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:email@example.com (if you are doing some NAT, it will be like sip:firstname.lastname@example.org where the IP will be a public IP or name)
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.
- 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