WebRTC API

Overview

Voxbone’s WebRTC WebSDK allows you to make and receive calls using Voxbone’s DIDs directly from any WebRTC-enabled web browser. Using this SDK and documentations, you will be able to create applications like Click to Call, Conference bridges and web-based call centers. Read the documentation to get an idea of what can be done!

The Voxbone WebRTC SDK uses a slightly modified JSSIP library. This means that you can also refer to the JSSIP documentation for additional feature implementation.

SIP brings greater depth to the traditional phone call as it’s able to set up set up video and audio multicast meetings, or instant messaging conferences.

Voxbone provides local phone numbers (DID) from 50+ countries that can be mapped to any SIP endpoint and have the calls routed through our IP Core backbone.

With our network and this SDK, you will be able to connect the browser to legacy telephone networks like a PBX or even hosted PBXs like Asterisk. You will be able to create applications such as browser-based click-to-call buttons or conferencing bridge.

Getting Started

If you want to build your own app from scratch in another language you can. You can decide whether to authenticate via basic auth or use token generators.

Authentication via basic auth

Basic authentication permits anyone with the code to call your DID within the security parameters defined by voxbone – this is the fastest way to get started and how most Voxbone SDK customers start.

Provide your username and webrtc key in the basicAuthInit() function.

voxbone.WebRTC.basicAuthInit(username, secret_key)

Authentication with token generator

In the advanced authentication mode, you run your own authentication server with our samples and can control who can and cannot make a call against your DID.

An authentication token needs to be provided for initialising the voxbone.WebRTC object.

var voxrtc_config{
     "key":"ABwxcFX6ayVxu/uNuZu3eBsjrFeg=",
     "expires":1426067127,
     "username":"a_username"
 }

Then use it with the voxbone.WebRTC object.

voxbone.WebRTC.init(voxrtc_config)
  • username: This is your credentials username
  • expires: expiration date of the generated key (in seconds, epoch time)
  • key: this is a base64 representation of an HMAC SHA1 of expires:username, salted with your password.

 

Advanced Auth Token Generator Examples

Various example on how to generate the authentication token can be found on Github such like

 

Make a call

Making a call to any Voxbone DID or SIP endpoint.

var dest = "+32000000000";
 voxbone.WebRTC.call(dest);

Send DTMF

The code below shows you how to send a DTMF tone when in a phone call.

var digit = "1";
 voxbone.WebRTC.sendDTMF(digit);