Home » Technology » Internet/Web » WebRTC: Asterisk Joins the Brave New World of Real Time Communications

The Most Versatile VoIP Provider: FREE PORTING

WebRTC: Asterisk Joins the Brave New World of Real Time Communications

This week we’ll be wading into the world of real time communications and the Asterisk® 11 implementation of WebRTC, a JavaScript API that makes it easy to build click-to-call systems and softphone interfaces using nothing more than a web page. To simplify the task of creating an Asterisk 11/WebRTC platform, we’ve created a free virtual appliance for you that can be deployed in a matter of minutes on any Windows®, Mac®, Linux® or Solaris® desktop using Oracle’s VirtualBox®. In producing this WebRTC implementation, the Asterisk Dev Team has introduced an impressive new set of (stable) features formerly lacking in Asterisk: SRTP for secure communications, ICE, STUN, and TURN to allow NAT clients to better communicate with Asterisk. As the old saying goes, a picture is worth a thousand words. So let’s begin with a one-minute video that actually demonstrates Asterisk WebRTC in action. Using nothing more than a Chrome browser, we’re connecting to a web site hosted on the PBX in a Flash™ appliance to dial a news application that’s part of the included Incredible PBX™ 11 build.


Before we walk you through deploying your own WebRTC platform with Asterisk 11, let’s quickly cover some of the WebRTC basics as they apply in the Asterisk environment.

Rolling Your Own. If you’re one of the purists that prefers to roll your own server, then the starting point for your build should be the Asterisk Wiki. The other important component is sipml5, Doubango Telecom‘s terrific HTML5 SIP client. It’s the actual interface demonstrated in the YouTube video above. And this link provides a failsafe recipe for bringing up WebRTC on any Asterisk 11 server. Our appliance just saves you the one-hour hassle. We’ve chosen not to deploy WebRTC2SIP, the middleware that’s currently necessary if you want to add video support to Asterisk WebRTC. And our current build only works with the latest Chrome browser; however, WebRTC4all is available if you prefer Safari, Opera, Firefox, or Internet Explorer. All of the documentation for these components is provided in the links above for our pioneers.

Why WebRTC? Some of you may be asking, "What’s the big deal? Why would I want to deploy WebRTC?" The short answer is that it eliminates the need to install and configure a proprietary softphone on every customers’ desktop computer before they can communicate. Instead, all they need is a web browser that supports Real-Time Communications. By pointing their browser to a server address that you provide, the customer instantly gains a communications platform that’s as feature-rich as you choose to make it. And it’s comparable to the dedicated clients of old… without the cost or hassle of marrying a softphone to every customer’s particular desktop operating system! And your web page could easily provide a directory of supported contact names and numbers as part of the user interface.


The other beauty of WebRTC is it allows you to create your own (secure) Skype-like communications system without a Man in the Middle. And all you need is a browser at both ends. The WebRTC video above demonstrates a video conversation between a Chrome user at Google and a Firefox user at Mozilla.

Deploying PIAF-Green-WebRTC. So much for the theory. Let’s get your own server set up so you can experiment with this yourself. Here are the steps. It’s about a 10-minute procedure once you’ve downloaded our virtual machine appliance from SourceForge.

  1. Install Oracle’s VirtualBox on your Desktop computer
  2. Download PIAF-Green-WebRTC
  3. Import PIAF-Green-WebRTC into VirtualBox
  4. Start the PIAF-Green-WebRTC Appliance
  5. Using Chrome, Access the WebRTC Page Hosted on PIAF-Green-WebRTC
  6. Configure sipml5 to Make a Connection Using an Asterisk Extension
  7. Place Your First Call

1. Install Oracle’s VirtualBox. Download the VirtualBox installer for your desktop platform from VirtualBox.org. Run the installer and accept the default settings. For details, here’s a link to Oracle’s VM VirtualBox User Manual.

2. Download PIAF-Green-WebRTC. To get PIAF-Green-WebRTC installed on your desktop is quick and easy. Because the image tips the scales at over 2GB and due to the 2GB file size limit on many systems, we’ve chosen to split the download into two pieces. You need both of them! Just download them onto any flavor desktop from SourceForge. Once you’ve downloaded the two files, reassemble them into a single file known as an Open Virtualization Appliance (.ova). Then verify the checksums for the reassembled file to be sure everything is in its proper place. Finally, double-click on the .ova file which will initiate the import process into VirtualBox.

So let’s begin by downloading the two halves from SourceForge: PIAF20631aa and PIAF20631ab.

The reassembly procedure depends upon your desktop operating system. For Windows PCs, you’ll need to drop down to the Command Prompt, change to the directory in which you downloaded the two files, and type the following command:
 
copy /b PIAF20631aa + PIAF20631ab PIAF-Green-WebRTC.ova

To check the MD5/SHA1 checksums in Windows, download and run Microsoft’s File Checksum Integrity Verifier.

For Mac or Linux desktops, open a Terminal window, change to the directory in which you downloaded the two files, and type the following commands:
 
cat PIAF20631a{a..b} > PIAF-Green-WebRTC.ova
md5 PIAF-Green-WebRTC.ova (use md5sum for Linux)
openssl sha1 PIAF-Green-WebRTC.ova

The MD5 checksum for PIAF-Green-WebRTC.ova is 946c149c6adb53602ccfcd3ace10e13b. The SHA1 checksum is 285a5b999c761fcbef13d1a97b4c335a81e1cb0d. If you have a match, proceed. Otherwise, rinse and repeat.

3. Import PIAF-Green-WebRTC into VirtualBox. You only perform the import step one time. Once imported into VirtualBox, PIAF-Green-WebRTC is ready to use. There’s no further installation required, just like an OpenVZ template… only better. Double-click on the .ova file you downloaded to begin the procedure and load VirtualBox. When prompted, be sure to check the Reinitialize the Mac address of all network cards box. Read and accept the license agreement. Then click the Import button. Once the import is finished, you’ll see a new PIAF-Green-WebRTC virtual machine in your VM List on the VirtualBox Manager Window. You need to make a couple of one-time adjustments to the PIAF-Green-WebRTC Virtual Machine configuration to account for differences in sound and network cards on different host machines.

Click on PIAF-Green-WebRTC Virtual Machine in the VM List. Then click Settings -> Audio and check the Enable Audio option and choose your sound card. Save your setup by clicking the OK button. Next click Settings -> Network. For Adapter 1, check the Enable Network Adapter option. From the Attached to pull-down menu, choose Bridged Adapter. Then select your network card from the Name list. Then click OK to save your setup. Finally, click Settings -> System, uncheck Hardware clock in UTC time, and click OK. That’s all the configuration that is necessary for the PIAF-Green-WebRTC Virtual Machine. If you blinked, you probably missed it.

4. Start the PIAF-Green-WebRTC Appliance. Once you’ve imported and configured your new Virtual Machine, you’re ready to go. Highlight the appliance in the VM List on the VirtualBox Manager Window and click the Start button. The boot procedure with CentOS 6.3 will begin just as if you had installed PBX in a Flash and Incredible PBX on a standalone machine. You’ll see a couple of dialogue boxes pop up that explain the keystrokes to move back and forth between your host operating system desktop and Incredible PBX.

Here’s what you need to know. To work in the Virtual Machine, just left-click your mouse while it is positioned inside the VM window. To return to your host operating system desktop, press the right Option key on Windows machines or the left Command key on any Mac. For other operating systems, read the dialogue boxes for instructions on moving around. Always shut down your virtual machine gracefully! Click in the VM window with your mouse, log in as root, and type: shutdown -h now. Or, from the VirtualBox Manager Window, Ctl-Click on the PIAF-Green-WebRTC VM and choose Close -> ACPI Shutdown.

Always run Virtual Machines behind a hardware-based firewall with no Internet port exposure!

To begin, position your mouse over the VM window and left-click. Once the virtual machine has booted, log in as root with password as the password. Change your root password immediately by typing passwd at the command prompt. Now set up a secure maint password for FreePBX as well. Type passwd-master. If you’re not in the Eastern U.S. time zone, then you’ll want to adjust your timezone setting so that reminders and other time-sensitive events happen at the correct time. Issue the following command to pick your time zone: /root/timezone-setup. Now type status and write down the IP address of your appliance. Finally, edit /etc/asterisk/sip_custom.conf and replace the secret=8000 entry with a very secure password. This is your WebRTC extension password. Restart Asterisk: amportal restart.

5. Access WebRTC Page Hosted on PIAF-Green-WebRTC Using the latest Chrome browser from a machine on the same subnet as your appliance, point to the WebRTC web page of your appliance using the actual IP address of your virtual machine: http://192.168.0.141/myphone/call.htm.

6. Configure sipml5 to Make a Connection to Asterisk. There are two configuration steps before you can log in and start making calls through your Asterisk server. First, click on the Expert Mode button. Fill out the form as shown below using the actual IP address of your server. Click Save when you’re finished, close this browser window, and return to the main WebRTC page.

Next, fill out the Registration section using the actual IP address of your server and the extension 8000 password that you created above. Private Identity is 8000, Public Identity is sip:8000@ipaddress, Realm is Asterisk ipaddress.

Once you’ve completed your entries, click Login to make a connection to your Asterisk server.

7. Placing a Call with WebRTC. Once you’re logged in, it’s just as if you had registered a softphone to your Asterisk server. Calls from other extensions can reach you by dialing extension 8000. And you can place outbound calls using the Call Control panel. To demonstrate how this works, try the following. To retrieve Today’s News Headlines, enter 951. Then click the Call button. To retrieve the latest Weather Forecast for your city, dial 949 and say the city and state when prompted. You can’t enter touchtone keys so just ignore the "press pound" instruction and wait for the timeout.

We have intentionally not walked you through configuring an outbound trunk even though one can easily be used to make outbound calls. Before doing so, make very certain that your appliance is behind a hardware-based firewall with no Internet port exposure. It’s your phone bill. Enjoy!

WebRTC Conference and Expo. The 2013 WebRTC Conference and Expo is returning to Atlanta on June 25. For everything you ever wanted to know about WebRTC, that’s the place to be. You can sign up now at WebRTCWorld.com. The Half-Price Early Bird discount ends on March 1. And you can save an additional 15% by using Coupon Code: AA.

Originally published: Tuesday, February 26, 2013



Need help with Asterisk? Visit the PBX in a Flash Forum.

 


Some Recent Nerd Vittles Articles of Interest…


4 Comments

  1. Hi, I have a doubt, Can we integrate WebRTC with Asterisk without using any browser? Please clarify it.

    Advanced a lot of Thanks.

  2. Haven’t you missed the entire point. Asterisk supports WebRTC so that you can directly do RTC (SIP, Calls, Video) from a web-browser without a standalone softphone app. But to answer your question, you can still have your own softphone (no browser) that talks webRTC with Asterisk. Asterisk puts an additional layer, you put one too, instead of directly using SIP and other APIs as any normal developer would.

    [WM: Never claimed to be normal. As far as extra layers are concerned, WebRTC still has to have a host somewhere. You obviously prefer "SIP and other APIs." We obviously don’t. If you had actually read the article, you’d know that a standalone softphone app was not required, only a Chrome browser. We’re fully aware that a standalone softphone app can also be used. So what? 🙄 ]

Comments are closed.