Avaya Client SDK

< Back to Package Overview

Adding support for Web Collaboration

The collaboration service API provides collaboration functionality to the client application. Further, it takes care of retrieving data from the server, managing and performing business logic on this data and finally presenting it to the UI layer.

It provides core collaboration functions for clients served by Collaboration server:

  • Receive new collaborations
  • Display the shared information from other participants
  • Allows getting the Capabilities
  • Allows to share (screen, whiteboard ...)

Most of the API calls return a promise, that can handle success or fail.

Initialization and Configuration

The Collaboration object is obtained from the Client SDK's User object. The UserConfiguration object will be used to define the services that will be available to end users of your application. Each service is configured individually; its configuration is stored in a dedicated object, referenced from the UserConfiguration object.

Note: More information on service configuration can be found in the article configuring the SDK.

Start by obtaining any existing service configuration:

var userConfiguration = new AvayaClientServices.Config.UserConfiguration();

var wcsConfiguration = userConfiguration.wcsConfiguration;

Enable the service and configure the collaboration parameters supplied by your administrator:

wcsConfiguration.enabled = true;

Set web collaboration for call object. How to create call object is described in Making an Audio Call and Making a Video Call

call.setWebCollaboration(true);

After you instantiate and set up any required configuration objects, you are now ready to create the User and then call the start() method of your User to start all services. Then you can get the Collaborations for its further usage:

var collaborationsService = user.getCollaborations();

Receive new collaborations

To receive new collaborations for call use the getCollaborationForCall() method of the Collaborations object.

var collaboration = collaborationsService.getCollaborationForCall(call.getCallId());

In this point you will have instance of new collaboration. To be able to receive and display the sharing stream from the collaboration server you should start Collaboration service.

collaboration.start().then(function () {
    // Collaboration start successfully;
}, function () {
    // Collaboration start fail;
});

Display the shared information from other participants.

To be able to handle whiteboard or content sharing streams from other participants, your application should do the following:

1) Get Whiteboard and ContentSharing objects.

var whiteboard = collaboration.getWhiteboard();
var contentSharing = collaboration.getContentSharing();

2) Initiate KonvaWhiteboardRenderer and KonvaContentSharingRenderer renderer.

var whiteboardRenderer = new AvayaClientServices.Renderer.Konva.KonvaWhiteboardRenderer();
whiteboardRenderer.init(whiteboard, "");

var contentSharingRenderer = new AvayaClientServices.Renderer.Konva.KonvaContentSharingRenderer();
contentSharingRenderer.init(contentSharing, "");

When any participants from the collaboration will start sharing whiteboard or screen, your application should get information about it through callback onWhiteboardStartedCallbacks() or onContentSharingStartedCallbacks().

whiteboard.addOnWhiteboardStartedCallback(function ({}, {}, {}) {
   // Whiteboard sharing started;
});
contentSharing.addOnContentSharingStartedCallback(function ({}, {}) {
   // Content Sharing started;
});