Tuesday, January 19, 2021

Configure Asterisk to support WebRTC

What is WebRTC

Web Real-Time Communication (WebRTC) is a collection of standards, protocols, and JavaScript APIs, the combination of which enables peer-to-peer audio, video, and data sharing between browsers (peers).  It is supported on all modern browsers and native clients in major platforms.

You may be an user of WebRTC already because many famous audio/video communication applications involve this technology.  Examples are Whatspp, Google Meet and Facebook Messenger.

WebRTC also enables browser-based VoIP telephony, which means that you can make and receive calls within a web browser.  There is no need to install a softphone.

Here, we focus on what benefits WebRTC brings to your business and how it works with the Asterisk-based IPPBX.

Benefits of using WebRTC together with your IPPBX

  • When your web site visitor needs assistance on a product or an online service, he can simply click on a call button and get in touch with your agent instantly, no matter he is in front of a PC or using mobile phone.

  • The online call is free for visitors and they can talk with your agent from anywhere worldwide.  it improves customer experience and your relationship with them.

  • It eliminates the need for toll-free numbers, saving your telco expenses

  • Enabled with WebRTC, IPPBX can despatch the online call to your agents like traditional incoming call; it can go through IVR, ACD and various call routing rules.

  • You can even embed the call button in your email communications with customers

  • Webrtc call is encrypted and secured.  It is safe to use it over public internet.

Configuring Asterisk to  support WebRTC

There are a couple of things worth your consideration when configuring Asterisk to support webrtc.

  • Preferably you use updated version of Asterisk (version 15.5 or higher) 

  • Use chan_pjsip which is the newer SIP stack for Asterisk

  • Since WebRTC API includes no provisioning for signalling, we have to enable websocket as a transport where SIP signaling protocol takes place

  • You need a SSL certificate for the websocket to work.

  • In case your existing Asterisk (where your IPPBX extensions and call features are located) is of earlier versions, you can install a newer version to act as a gateway between WebRTC call and your existing asterisk.

Calling the WebRTC API from your web site

Most modern browsers have built-in support for WebRTC API and these API could be called via javascript.  In general, to add a browser call button in your web site html code, you would have to include the required js library and write some javascript codes to take control of the audio stream (ie your MIC & Speaker), establish call with the IPPBX (call signalling) and carry out the audio transmission.

Demonstration

Here is a demonstration showing how you call our Asterisk-based IPPBX by a browser button.  The call is handled by an illustrative agent queue.

https://ippbx01.starlingtech.hk:8089/static/click2call/index.html

Thursday, September 24, 2015

Tips of using Elastix in your business center

Elastix is a feature-rich PBX system built on top of Asterisk.  It simplifies many administrative tasks via providing a GUI, making it a good choice for IT/administrator to adopt the open-source platform.

What is more, Elastix has a useful feature for business center.  The inbound route allows us to specify a DID-based text that would be shown on the front-desk IP phone.  It could be the company name of a business center's tenant and the front-desk staff could greet the caller accordingly.

By default, Elastix disallows input of UTF-8 characters in this text.  We can enable it with a few modifications and the front-desk staff could then see Chinese company name.

First of all, we have to change the charset of  the table asterisk.incoming to utf8.  This table keeps the information of the inbound route.

By enabling support of utf8, we can keep Chinese characters in the inbound route.

Secondly, we can use a quick way to disable the charset restriction in the php page that handles inbound route input.  Below code disables the charset validation in the corresponding php. 

1. /var/www/html/modules/pbxadmin/js/libfreepbx.javascripts.js
… (Line 1 to 129)
function isLetter(c)
{return true;}
//{return(((c>="a")&&(c<="z"))||((c>="A")&&(c<="Z"))||(c==" ")||(c=="&")||(c=="'")||(c=="(")||(c==")")||(c=="-")||(c=="/"))}
function isURLChar(c)
{return(((c>="a")&&(c<="z"))||((c>="A")&&(c<="Z"))||(c==":")||(c==",")||(c==".")||(c=="%")||(c=="#")||(c=="-")||(c=="/")||(c=="?")||(c=="&")||(c=="="))}
function isCallerIDChar(c)
{return true;}
//{return(((c>="a")&&(c<="z"))||((c>="A")&&(c<="Z"))||((c>="0")&&(c<="9"))||(c==":")||(c=="_")||(c=="-")||(c=="<")||(c==">")||(c=="(")||(c==")")||(c==" ")||(c=="\"")||(c=="&")||(c=="@")||(c==".")||(c=="+"))}

2. /var/www/html/admin/components.class.php
find and replace the code from htmlentities($currentvalue) to htmlentities($currentvalue, ENT_COMPAT | ENT_HTML401, "utf-8")



Now, you can create an Inbound Route with a Chinese CID prefix.  If the inbound route is hit by an incoming call, the CID prefix would be sent as part of the caller name to the route destination.  If your destination phone is capable of displaying Chinese characters, you will see the CID prefix string associated with the DID number.



Input Chinese characters in Inbound Route
IP phone shows Chinese CID prefix