Check out our Amazon Connect solution! Learn More

Updated support to Vonage's Video APIs

By callstats on January 26, 2021
read

Vonage's Voice and Video API

The Vonage Video API (formerly TokBox OpenTok) embeds interactive voice and video applications. The OpenTok.js integration with callstats.io was updated recently, especially additional identifiers and custom events. The opensource javascript shim is hosted on GitHub.

Integration steps

Serve the callstats-opentok-shim from your website or from callstats.io’s CDN, add https://api.callstats.io/callstats-opentok-shim.min.js file on your page after the callstats.js script. Please make sure to add them ahead of tokbox js


<script src="https://api.callstats.io/static/callstats.min.js"></script>
<script src="https://api.callstats.io/static/callstats-opentok-shim.js"></script>
<script src="https://static.opentok.com/v2/js/opentok.min.js"></script>


Then, initialize like shown below:

CallstatsOpenTok.initialize(opts);

Currently, the shim supportsAppID, AppSecret, SessionID, RemoteID,InitCallback,StatsCallback, andconfigParams. So, for example:

CallstatsOpenTok.initialize({
AppId: 834738451,
AppSecret: 'sOTjsJEfwPUGW4SRJI4BhbprGJ3lfO6Kp+:ixCX1P9mzNThlsW+YNLlb=',
SessionId: '1_eiTh54cMjNx4FNk-JkT15IXNTGtNnh8W03m0RwYTMxUMNMDyhU2gzMxezMXjaF0Mj0E-UH4'
});

Documentation forInitCallback,StatsCallback, andconfigParamscan be found in the API documentation - https://docs.callstats.io/javascript/#callbacks-and-error-handling and https://docs.callstats.io/javascript/#callstats-initialize-with-app-secret.

API For sending the media events:

CallstatsOpenTok.sendFabricEvent(
CallstatsOpenTok.fabricEvents.audioMute
);

Supported fabricEvents:

 const fabricEvents = {
    audioMute: 'audioMute',
   audioUnmute: 'audioUnmute',
   videoPause: 'videoPause',
   videoResume: 'videoResume',
   screenShareStart: 'screenShareStart',
   screenShareStop: 'screenShareStop',
   dominantSpeaker: 'dominantSpeaker',
}

API For sending the User Feedback:

let feedback = {
'overall': 2, // scale 1-5
'comment': 'user comments',
}
CallstatsOpenTok.sendUserFeedback(
feedback
);