|This document describes version 6 of Unblu. If you’re using the latest major version of Unblu, go to the documentation of the latest version.|
|Although we speak of "video calls" in this article, the information applies equally to voice calls.|
This article provides information on how Unblu uses the Vonage Video API to establish video & voice calls. Please refer to the article on call archiving for information on enabling and configuring video & voice calls in Unblu.
How the Vonage Video API works in general is outlined in the Vonage Video API documentation.
Like any other communication, video calls take place within the context of a conversation. Thus, a conversation must exist before the Unblu Collaboration Server can initiate a video call.
The Collaboration Server calls the Vonage Video API to create a session with the Vonage cloud. It specifies whether to archive the call or not according to your configuration. This choice in turn determines whether the connection between the clients is routed via the Vonage cloud or relayed directly between clients.
Sessions are initiated using the Vonage Video API server SDK. This requires the Collaboration Server to first create an OpenTok client (if none exists yet) by calling
com.opentok.OpenTok.Builder(int apiKey, String apiSecret). The parameter values are taken from the corresponding Unblu configuration properties com.unblu.chat.videochat.apiKey and com.unblu.chat.videochat.apiSecret, respectively. If Unblu must access the Vonage cloud via a proxy, the details necessary to do so are also retrieved from the relevant configuration properties.
Once a client is available, the session is created by calling
com.opentok.OpenTok.createSession(SessionProperties properties). The
SessionProperties object passed as an argument contains only the following information:
The call returns a
com.opentok.Session object which contains the session ID, which uniquely identifies the session.
The session ID is stored in the
tokboxSessionId property of the conversation. It can be used to retrieve archived calls relating to a conversation; see the article on call archiving for further details.
Once the Collaboration Server receives the session ID from the Vonage server, it generates a token for each participant in the call and sends it to the participants' respective clients, i.e. their browsers or mobile apps. It does so by calling
com.opentok.Session.generateToken(TokenOptions options) for each participant in turn. The
options argument in the method call always specifies that the token should be valid for 30 seconds and that the participant should be added to the session with the publisher role.
The call returns a string containing the token. The participant’s client can redeem this token to join the session and thus participate in the call.
The clients use their token to establish a connection to the session in the Vonage cloud. This allows them to publish audio and video streams to the session. Other participants can then subscribe to these streams.
These steps are all handled by the relevant Vonage client SDK.