WebRTC (Web Real-Time Communication) is an API definition drafted by the World Wide Web Consortium (W3C) that supports browser-to-browser applications for voice calling, video chat, and P2P file sharing without the need for either internal or external plugins.

Your Euphoria PBX that you currently using to make and receive calls is capable of making and receiving calls via Secure WebSockets, a module of WebRTC. You will need to familiarize yourself with WebRTC and Secure WebSockets to continue.

Technical Specs and Requirements

Euphoria Allows for Secure WebSocket connections on port 443. If you normally communicate with your PBX at pbx4.euphoria.co.za on the regular SIP port of 5060, you can also establish a Secure WebSocket connection on port 443. e.g.  wss://pbx4.euphoria.co.za:443. Connections using Secure WebSockets are protected via TLS.

Euphoria does not support non-secure WebSocket connections.

RTP media is transmitted over UDP ports 30000-40000. (With a non-WebSocket connection, like 5060, RTP would normally use port 10000-20000). Additionally, RTP media offered by your Web Browser is normally secured with SAVPF/TLS.

The Audio codec used by most modern browsers will be OPUS. Euphoria supports opus audio codec, however, you will need to contact your support or sales consultant to have this option enabled. (Browsers will also offer Ulaw and Alaw - these two codecs are not recommended, and also have to be enabled by contacting Euphoria.)

The Video codec used by Chrome will be VP8/9 and Mozilla will be H264. Trans-coding video is not possible and as a result, the video will not be possible via this method. An alternate video conferencing solution is available if required.

A STUN server is also available at the same PBX URL. e.g., if you register with pbx3.euphoria.co.za, then the stun server will be stun:pbx3.euphoria.co.za

Building a browser-based phone

There are two popular JavaScript libraries that enable full telephone functionality like call set-up, DTMF, call answer etc.

Option 1) SIPjs:  https://sipjs.com

SIPjs is easy to use fast to get going script-library, it can handle most calling features. It is recommended to use the SIPjs JavaScript library to build a browser-based phone, for simple use case scenarios. (At the time of writing, hold and un-hold were not possible).

Option 2) JsSIP:  http://jssip.net/

JsSIP is a more powerful script library but can be more complicated to set up. It is recommended to use the JsSIP JavaScript library to build more feature-rich scenarios.