0% found this document useful (0 votes)
12 views

LA Agent Console Developer Guide

Uploaded by

ShareFile Pro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

LA Agent Console Developer Guide

Uploaded by

ShareFile Pro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

LA Agent Console Developer

Guide

YRP1-508, 3-4 Hikari-no-Oka Yokosuka-Shi, Kanagawa, 239-0847, Japan


tel.: + 81-(0) 46-821-3362 | cba-japan.com
This document contains confidential information that is proprietary to CBA. No part of its contents
may be used, disclosed or conveyed to any party, in any manner whatsoever, without prior
written permission from CBA.
© Copyright 2023 CBA.

All rights reserved.

Updated: 2022-06-22

Document version: 1.64/1

Contact Information

For technical support or other queries, contact CBA Support at:

[email protected]

For our worldwide corporate office address, see:

https://www.cba-japan.com (Japanese) https://www.cba-gbl.com (English)

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 2


Contents
Introduction
Writing an Agent Console
Loading Resources
Setting UI Elements
Starting a Voice and Video Session
Configuration
CallManager
Requesting Screen Sharing
The Size of the Remote View
Shadow Cursor
Modes of Operation
Annotation
Spotlight
Document Push
Link Push
Zoom
Opening the Zoom Window
Receiving Zoom Callbacks
Form Filling
Snapshot
Ending a Support Session
Internationalization
Starting a Co-browse only Session
Ending a Co-browse only Session
Escalating an Existing Call to Co-browse
Authenticated Agent Access
Enabling Agent Features
Specifying an Audit Name
Using HTTP
Using JSON
Permissions

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 3


Setting Agent Permissions
Agent and Element Permissions
Parent and Child Permissions
Error Handling
Application Errors
WebSocket Initiation
Integrating the Fusion Client SDK
Connectivity Callbacks
WebSocket Reconnection Control
Connection Configuration
Connection Callbacks

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 4


Introduction
Fusion Live Assist provides voice and video calling from a consumer to an agent, along with
co-browsing, and document push by the agent, and remote control and annotation of the
consumer’s screen by the agent. See the CBA Live Assist Overview and Installation Guide
for details of what that means in practice.

The Fusion Live Assist Agent Console SDK is a set of tools for developing a custom agent
application for Fusion Live Assist, and this guide describes the process from a developer
integration perspective. We assume the user is familiar with HTML5 and JavaScript.

CBA Live Assist uses the Fusion Client SDK for voice and video (where applicable) and
authorization. The CBA Live Assist Agent Console SDK is built on top of the Fusion Client
SDK, and helps with integrating the features of CBA Live Assist into a custom agent console.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 5


Writing an Agent Console
An agent console application written using the CBA Live Assist Agent Console SDK is an
HTML and JavaScript application, packaged in a war file, and deployed to a server. An agent
console operates in one of the following modes:

In voice and video mode, the agent console is registered as a voice and video endpoint
using Fusion Client SDK.

Support sessions are directed to the agent console by directing inbound calls generated by a
CBA Live Assist enabled application or web page to that endpoint.

In co-browse only mode, the agent console and CBA Live Assist-enabled application must
be provided with a correlation ID - an identifier used to correlate the agent and consumer
sessions.

The mechanism by which this string is generated, and distributed to both agent and client
applications, is entirely up to the developer. See the Starting a Co-browse only Session section.

Creating, packaging, and deploying a web application is outside the scope of this document. In
what follows, we assume that you already have a basic application with an HTML page which will
be shown to the agent when they connect to it.

Note: We recommend that you deploy your Agent Console application to the FAS which also
hosts CBA Live Assist. This gives the simplest and most flexible arrangement. If the Agent
Console application is hosted on a separate web server, the application will not be able to use
the CBA Live Assist CallManager.

Loading Resources

A CBA Live Assist Agent Console application needs to include a number of JavaScript files and
Cascading Style Sheets (CSS). Add the following lines to each HTML page, where <fas
address> is the host name or IP address of the CBA Live Assist server. The scripts and style
sheets are available on the CBA Live Assist server (co-hosted with the Fusion Client SDK
Web Gateway):

Style sheets (in the document HEAD)

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 6


<link rel='stylesheet' href='<fas
address>/assistserver/sdk/web/agent/css/assist-console.css'/>
<link rel='stylesheet' href='<fas
address>/assistserver/sdk/web/shared/css/shared-window.css '/>

Scripts (at the end of the document BODY)

<script src='<fas
address>/assistserver/sdk/web/shared/js/thirdparty/i18next-1.7.4.min.js'/>
<script src='<fas address>/gateway/adapter.js/>
<script src='<fas address>/gateway/csdk-phone.js/>
<script src='<fas address>/gateway/csdk-common.js/>
<script src='<fas address>/assistserver/sdk/web/shared/js/assist-aed.js/>
<script src='<fas address>/assistserver/sdk/web/shared/js/shared-
windows.js/>
<script src='<fas address>/assistserver/sdk/web/agent/js/assist-console.js/>
<script src='<fas address>/assistserver/sdk/web/agent/js/assist-console-
callmanager.js/>

The adapter.js, csdk-phone.js, csdk-common.js, and assist-console-callmanager.js files are


only needed for voice and video, not for co-browsing only mode.

Setting UI Elements

The console page must contain a DIV element to display the consumer’s screen when co-
browsing; it may also contain elements to display the video received from the consumer, a
preview of the video being sent to the consumer, and an indicator of the call quality. These
should be set after loading the scripts and before starting a support call. It will also need to
implement and set at least some of the callbacks available on the AssistAgentSDK object, and
should do so before starting a support call.

Setting the UI elements is done with the following functions:

AssistAgentSDK.setRemoteView

Use this to set the DIV element which will show the consumer’s screen during co-browse.

CallManager.setRemoteVideoElement

Use this to set the DIV element to show the video received from the consumer. You do not need
to set this in co-browse only mode, but you should do so in voice and video mode.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 7


CallManager.setLocalVideoElement

Use this to set the DIV element to show the video from the agent’s own camera, which which is
also sent to the consumer. You do not need to set this in co-browse only mode, but it may be
useful in voice and video mode to let the agent know that their camera is working.

CallManager.setCallQualityIndicator

This is less often useful. If set, the DIV element shows an indicator of the current voice and video
quality of the call, which can sometimes provide useful feedback.

The AssistAgentSDK object has too many callbacks to detail here, but the ones you will probably
want to use most often are setRemoteViewCallback, setConsumerJoinedCallback,
setCallEndedCallback, and setOnErrorCallback. see The Size of the Remote View section , the
Requesting Screen Sharing section, the Ending a Support Session , and the Error Handling
section for details.

You will probably have your JavaScript code in a script file which is included by the HTML page;
a suitable time to set these elements is in an initialization function which is called when the file
loads to set up the UI elements:

(function() {
...
var remoteView = document.getElementById("sharingview");
var remoteVideo = document.getElementById("remotevideo");
var previewVideo = document.getElementById("previewvideo");
var qualityIndicator = document.getElementById("call-quality-indicator");
...
AssistAgentSDK.setRemoteView(remoteView);
...
CallManager.setRemoteVideoElement(remoteVideo);
CallManager.setLocalVideoElement(previewVideo);
CallManager.setCallQualityIndicator(qualityIndicator);

AssistAgentSdk.setScreenShareActiveCallback(function() {
...
});

}());

Note: Agents may find the local preview to be more intuitive if it is flipped so that it behaves more
like a mirror. Do this by applying a CSS transform to the provided DIV:

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 8


#previewvideo {
transform: rotateY(180deg);
}

Starting a Voice and Video Session

In order to start a voice and video session, the application calls CallManager.init, passing in a
configuration object. CallManager.init obtains a session token and correlation ID from the CBA
Live Assist server and starts a session, waiting for an incoming support call. When the agent
accepts the call, CallManager calls AssistAgentSDK.startSupport automatically. All the
application needs to do is to set up the configuration object (see the Configuration section) and
call CallManager.init at a suitable place in the program:

$(document).ready(function() {
...
var config = {autoanswer : 'true', agentName: 'Bob' };
config.username = 'agent';
config.password = 'password';
CallManager.init(config);
...
}

Note: CallManager (included in assist-console-callmanager.js) is not part of the official Agent


Console SDK, although it is included with it. In many cases, developers can use CallManager as
delivered, but they should be aware that it may behave in ways they do not want. See the
CallManager section.

Configuration
When the agent console starts a support session, or initializes the CallMananger to do so, it
must provide a configuration object. The configuration object may have the following members:

Name Description

sessionToken The session token issued to this agent. If it is omitted when


the application calls CallManager.init, a session token is
issued automatically. If the application requests a session
token explicitly:

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 9


●from the FCSDK session token REST API (see FCSDK
Developer Guide)

●from CBA Live Assist for a co-browse only session (see


the Starting a Co-browse only Session section), or if the
agent’s console requires specific properties (such as
permissions - see the Permissions section)

to be set for the sessionthen use this member to supply the


session token in the configuration.

Provide this in co-browse-only sessions to allow the server to


correlationId associate the CBA Live Assist session with an existing call
(see the Starting a Co-browse only Session section).

The URL of the CBA Live Assist server. This is optional;


CBA Live Assist will attempt to determine this value
url
automatically if it is omitted, but may not be able to do so with
some configurations, such as with some reverse proxies.

Set to true to automatically answer an incoming call. Defaults


autoanswer
to false. Only relevant to voice and video sessions.

username Login details of the agent with the server

password Login details of the agent with the server

A display name for the agent which is presented to the


agentName
consumer

The i18n locale to use for any UI elements (see the


locale
Internationalization section).

Used for WebSocket connection control. See the Connection


connectionStatusCallbacks
Callbacks section

Used for WebSocket connection control. See the Connection


retryIntervals
Callbacks section

If not set, or set to true, the consumer’s mouse pointer will be


shadowed to the agent’s screen. Set to false to turn off the
shadowCursor
shadow cursor for the session. See the Shadow Cursor
section.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 10


CBA Live Assist updates the shadow cursor on the agent’s
shadowCursorDelay screen every second by default. Set this to a new value in
milliseconds to change the update frequency.

CallManager
Using CallManager.init to start the session and wait for an incoming support call is simple.
However:

It always starts a session for voice and video calling, even if a voice call is not wanted.

It does not authenticate the agent.

It always starts a co-browse session as soon as a support call is answered.

It allows only one inbound call at a time.

It does not make outbound calls (for support call back, for instance).

It overrides certain callbacks on the UC object (notably onInitialised; see the FCSDK
Developer Guide), which therefore are not available to the developer.

You can change some of this behavior in the configuration object, or by overriding functions in
CallManager, or by using the global UC object (see FCSDK Developer Guide). If developers still
need different behavior, they should either take the existing code in assist-console-
callmanager.js and modify it to their own needs, or write a similar module using only the
functions in AssistAgentSDK and the FCSDK.

CallManager.init behaves as follows (error checking and non-essential code omitted):

var sessionToken;
var correlationId;

// When the voice and video session is ready


UC.onInitialised = function(call) {
...
UC.phone.onIncomingCall = function(call) {
correlationId = call.getRemoteAddress();
...
AssistAgentSDK.startSupport({
correlationId: correlationId,
...
sessionToken: sessionToken

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 11


});
...
}
}

// Create a voice and video session

var req = new XHTMLHttpRequest();


req.open("POST", "/assistserver/agent", true);
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
sesstionToken = JSON.parse(req.responseText).token;
UC.start(sessionToken, stunServers);
}
}
}

request.send("username=" + username + "&password=" + password +


"&type=create&targetServer=" + server + "&name=" + agent);

Requesting Screen Sharing

The agent starts a screenshare with the consumer by calling the


AssistAgentSDK.requestScreenShare function. It can do this in response to a button click, once
the agent has accepted the voice call:

screenShareRequestButton.addEventListener("click", function(){
AssistAgentSDK.requestScreenShare();
...
});

or automatically in response to the consumer joining:

AssistAgentSDK.setConsumerJoinedCallback(function(){
if (autoRequestCobrowse) {
AssistAgentSDK.requestScreenShare();
...
}
});

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 12


When the consumer accepts the screenshare (allows the agent to see their screen), the agent
receives a callback, in which the application can adjust its user interface:

AssistAgentSDK.setScreenShareActiveCallback(function(active) {
if (active)
// consumer joined screenshare session
else
// consumer left screenshare session
}

The active parameter indicates whether the consumer is, or is not, actually sharing their screen.
If the consumer is using a mobile device, it is true when the co-browsing starts, and whenever
the application returns to the foreground after being put into the background; it is false when the
application goes into the background. When the consumer is using a web browser, active will
never be false, as a web browser cannot be put into the background in the same way that a
mobile application can. Whatever the consumer device, the agent application should receive a
call to this callback with a value of true when the consumer accepts the screen sharing request
and joins the co-browsing session for the first time.

The agent application can also receive a callback if the request for screenshare fails, either
because the agent does not have the necessary permissions, or because the consumer
application rejects it. In this case, the agent application may take whatever action is appropriate,
such as ending the support call or continuing without co-browsing support. At the very least, it
should inform the agent in its UI, and allow them to request screenshare again:

AssistAgentSDK.setScreenShareRejectedCallback(function() {
alert("Screenshare request rejected");
screenshareRequestButton.disabled = false;
}

The Size of the Remote View

In addition to providing a DIV on the screen (see the Setting UI Elements section) where CBA
Live Assist displays the consumer’s screen during a co-browsing session, the agent console
should implement a remote view callback, which is called when the co-browse becomes active
(see the Requesting Screen Sharing section), or the remote view changes size or shape. The
callback has parameters containing the remote view’s width and height, and the device’s pixel
ratio:

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 13


AssistAgentSDK.setRemoteViewCallback(function(width, height, devicePixelRatio)
{
var remoteaspect = height / width;
var localaspect = remoteView.offsetHeight / remoteView.offsetWidth;
var height;
var width;
if (localaspect < remoteaspect){
height = Math.min(y, remoteView.offsetHeight);
width = height / remoteaspect;
} else {
width = Math.min(x, remoteView.offsetWidth);
height = width * remoteaspect;
}
remoteView.style.height = (height * devicePixelRatio) + 'px';
remoteView.style.width = (width * devicePixelRatio) + 'px';
});

The agent console can use this call back to ensure that the DIV it provided to contain the co-
browse is a reasonable size. CBA Live Assist scales the remote view appropriately, so the
console application does not need to use the dimensions exactly; however, we recommend that
the agent application should take account of the aspect in order to make the best use of the
available space.

The devicePixelRatio parameter represents the ‘zoom factor’ on the consumer’s device. If the
consumer uses their browser’s zoom function to zoom to 200%, then the callback reports the
width and height of the remote view as half their real value, because the zoom causes each pixel
to occupy two pixels in height and width. The developer can use the devicePixelRatio to correct
for this, so that the size of the remote view DIV does not change.

Note: In normal circumstances, the devicePixelRatio is 1 if the browser’s zoom is at 100%,


greater than 1 if the browser has zoomed in, and less than 1 if the browser has zoomed out.
However, high resolution monitors have a devicePixelRatio greater than 1 when the browser
zoom is at 100%, with an equivalent difference at other browser zoom values; the change in the
devicePixelRatio is the same for the same zoom factor, though, so it can still be used to correct
the size of the DIV which displays the remote video.

Shadow Cursor

By default, CBA Live Assist displays the consumer’s mouse pointer on the agent’s screen
during screensharing, updating it every second. Set the shadowCursor and shadowCursorDelay
configuration properties (see the Configuration section) to change this behavior.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 14


CBA Live Assist displays the shadow cursor as a white arrow outlined in red. If you wish to
change the image on the agent’s screen which displays as the shadow mouse pointer, add an
<img> element to the agent console page, with an id of consumer-cursor-shadow:

<img id='consumer-cursor-shadow' src='/img/ghost.png'/>

using your own image. The element will move about the agent’s screen as the consumer’s
mouse pointer moves.

You can also use the setConsumerCursorCallback function to register for a callback when the
consumer moves their mouse pointer. The callback function itself receives the x and y
coordinates of the shadow cursor on the agent’s screen in pixels.

You might do this to change the pointer image every second:

AssistAgentSDK.setConsumerCursorCallback(function(x, y) {
cursor.style.left = x + 'px';
cursor.style.right = y + 'px';
if (count++ % 2)
cursor.setAttribute('src', '/img/image1');
else
cursor.setAttribute('src', '/img/image2');
});

Modes of Operation

During co-browsing, the agent’s default mode of interaction with the remote view is remote
control. Clicks and drags by the agent are converted into click and drag operations on the
consumer’s application. Change the interaction mode to annotation (see the Annotation section
) by calling AssstAgentSDK.drawSelected, or spotlight (see the Spotlight section) by calling
AssistAgentSDK.spotlightSelected.

In most cases, agent applications provide UI elements which the agent uses to select these
modes. Both drawSelected and spotlightSelected may throw an
AssistAgentSDK.OffAssistPagesException, which the application must handle:

<div class="button" id="annotationbutton">


<a onclick="drawSelected();"><img src="img/annotation.svg"></a>
</div>

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 15


...
drawSelected: function() {
try {
AssistAgentSDK.drawSelected();
...
} catch (e) {
if (e instanceof AssistAgentSDK.OffAssistPagesException) {
alert('Page not CBA Live Assist enabled');
}
...
}
}

After changing the interaction mode, the agent console can return to remotely controlling the
consumer’s application by calling AssistAgentSDK.controlSelected.

AssistAgentSDK.selected returns the currently selected mode (control, spotlight, or draw).

Annotation

In annotation mode, the agent can draw lines on the screen that both parties in the co-browse
can see. Calling the AssistAgentSDK.drawSelected function activates this mode:

try {
AssistAgentSDK.drawSelected();
} catch (e) {
...
}

While in annotation mode, CBA Live Assist interprets drags by the agent as strokes, which
draw a corresponding line on the consumer’s screen. The
AssistAgentSDK.setAgentDrawStyle(strokeRGB, strokeOpacity, strokeWidth) function changes
the appearance of the strokes :

try {
AssistAgentSDK.setAgentDrawStyle('#FFFF00', 0.5, 10);
} catch (e) {
...
}

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 16


which sets the annotation color to yellow, the opacity to 0.5, and the stroke width to 10. This
method can be called at any time to change the annotation properties.

strokeOpacity must be within the range 0.0 to 1.0; strokeWidth must be between 1 and 25. The
setAgentDrawStyle function may throw an AssistAgentSDK.DrawStyleArgumentException if the
parameters are not valid.

Calling the AssistAgentSDK.clearSelected function clears the shared screen of all annotations.
This does not affect the agent’s current mode of interaction.

Spotlight

In spotlight mode, when an agent clicks on an area of the shared screen, it highlights the
corresponding area of the consumer’s screen. Activate this mode by calling
AssistAgentSDK.spotlightSelected:

try {
AssistAgentSDK.spotlightSelected();
} catch (e) {
...
}

Document Push

When co-browsing is active, the agent can push images or PDF documents to be displayed on
the consumer’s device. There are two functions to do this, and both take the URL of the
document to push:

AssistAgentSDK.pushDocument sends the document’s URL to the consumer application or


page, which downloads and renders the document.

AssistAgentSDK.pushContent causes the Agent Console SDK to download the document,


and send the resulting content over the CBA Live Assist session to the consumer
application or page, which renders it.

Acceptable document types are: PDF, and the image formats GIF, PNG, and JPG/JPEG.

Both of these functions take a callback function as a second, optional, parameter with the
signature function(completionEvent), where completionEvent is an object with the following
attributes:

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 17


type

One of:

succeeded

rejected

failed

timeout

closed

url

The URL of the shared document.

metadata

This attribute contains the additional information passed in the docMetadata parameter (see
below).

sharedDocId

An ID for the shared document.

errorCode

When the type is failed, this attribute contains an error code for failure:

1: Connection Error

2: HTTP Error

3: Unsupported Mime Type

4: File Parsing Error

httpErrorCode

If the type is failed, and if the failure is due to an HTTP error, the response code is included here.

errorText

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 18


If the type is failed, and if the failure is due to an HTTP error, the response status text is included
here.

initiator

This attribute is populated when the type is closed. Has the values agent or consumer.

A third parameter (also optional) to each of the above functions is the docMetadata, which allows
the agent application to associate additional information with the document, and to send it to the
consumer. The information must be in the form of a string.

The application can close a pushed document by calling


AssistAgentSDK.closeDocument(sharedDocId) , where the sharedDocId is obtained from the
callback as mentioned above.

AssistAgentSDK.pushDocument('http://server/document.pdf', function(completion)
{
AssistAgentSDK.closeDocument(completion.sharedDocId);
...
}, 'Document description');

Link Push

The agent application can push links to the consumer at any time during a support session by
calling AssistAgentSDK.pushLink, with the link URL as an argument. CBA Live Assist sends the
consumer to the pushed URL.

Note: If the page it sends the consumer to is not itself CBA Live Assist enabled, the consumer’s
co-browsing session becomes unavailable until the consumer returns to a CBA Live Assist
enabled page.

Zoom

Either agent or consumer can open a zoom window on the consumer’s device. While the zoom
window is open, it displays a magnified version of the content of the consumer’s screen where it
is positioned.

The zoom window contains controls to change the magnification and to close the window. Either
party can use these controls, or move the window about the consumer’s screen by dragging it

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 19


(so the agent can move the zoom window to a part of the consumer’s screen they want to look
at, or the consumer can move it to a part of the screen they want the agent to look at).

You can change the appearance of the zoom window in CSS by adding styles for the element
with ID assist-zoom-window; for example:

#assist-zoom-window {
border: 3px solid red;
}

to give the zoom window a red border for greater visibility.

Opening the Zoom Window

The application can open the zoom window by calling the AssistAgentSDK.startZoom function:

zoom: function() {
AssistAgentSDK.startZoom();
}

You would normally assign the zoom function to the onclick handler of a button.

There is an equivalent AssistAgentSDK.endZoom function, but you do not normally need to call
this explicitly - one of the users normally closes the window with the window’s close button, and if
it is open when the CBA Live Assist session ends, CBA Live Assist closes it automatically.

Note: Screensharing and zooming are mutually exclusive. If the zoom window is open when you
call AssistAgentSDK.pushDocument or AssistAgentSDK.pushContent, the functions do nothing
(apart from logging a message to the console). Similarly, if a document is open when you call
AssistAgentSDK.startZoom, it has no effect. AssistAgentSDK.pushLink will still work, however,
because it sends the consumer to a different page, which automatically removes the zoom
window.

Receiving Zoom Callbacks

The application can receive notifications when the zoom window opens or closes:

AssistAgentSDK.setZoomStartedCallback(function() {
...

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 20


pushDocumentButton.disabled = true;
});

AssistAgentSDK.setZoomEndedCallback(function() {
...
pushDocumentButton.disabled = false;
});

You might want to use these callbacks to update the user interface to prevent user interaction
which will not work.

The agent application receives these callbacks whichever application, consumer or agent, has
opened or closed the zoom window.

Form Filling

When a consumer navigates to a page or screen that CBA Live Assist identifies as containing a
form, it provides the agent with a form editor, to enable the agent to assist the consumer in
completing the form. In order to receive notification that the consumer has navigated to a form,
and to display the form editor, the agent console calls the AssistAgentSDK.setFormCallBack
function. It must provide a function that takes a single argument, the HTML FORM element which
contains the form editor. How and where to display the form editor is entirely within the control of
the agent console. The form editor given to the agent console is only usable while the consumer
is still viewing the page or screen which contains the form. If the consumer navigates away from
the form, the agent receives the form callback again with either a new form, or undefined if there
is no longer a form to edit:

AssistAgentSDK.setFormCallBack(function(formElement) {
if (formElement) {
formContainer.style.display = "block";
formContainer.appendChild(formElement);
} else {
formContainer.style.display = "none";
}
arrangeTools();
});

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 21


Snapshot

On some platforms, consumers can take a snapshot to send to the agent during a support
session. To receive notification of this happening, the agent can set a callback function by calling
the AssistAgentSDK.setSnapshotCallBack function:

AssistAgentSDK.setSnapshotCallBack(function(snapshot) {
// create a new view object containing the snapshot
var snapshotWindow = document.createElement("DIV");
var snapshotImg = document.createElement("IMG");
snapshotImg.src = snapshot;
snapshotImg.classList.add("snapshot");
snapshotWindow.appendChild(snapshotImg);
snapshotWindow.style.backgroundRepeat = "norepeat";
snapshotWindow.style.backgroundSize = "contain";
var snapshotDiv = $(snapshotWindow);
consoleContainer.appendChild(snapshotWindow);
});

The agent console is entirely responsible for displaying, storing, or otherwise managing these
images.

Ending a Support Session

When using CBA Live Assist with voice and video, the support session closes automatically
when the call ends, which can be done by calling the CallManager.endCall function at a suitable
place in the code. This causes both the agent and the consumer to leave the support session:

<div class="button" id="endbutton">


<a onclick="CallManager.endCall();"><img src="img/endcall.svg"></a>
</div>

An application will probably also need notification when a consumer hangs up, in order to
change its user interface and internal state to indicate that it is now able to accept another
support call. It can receive this by calling the AgentAssistSDK.setCallEndedCallback function
with a callback which will take action when a call ends:

AssistAgentSDK.setCallEndedCallback(function(){
...

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 22


});

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 23


Internationalization
The CBA Live Assist Agent SDK keeps its assets in assist_assets.war. You can directly edit
this file to add another language:

1. Get a copy of assist_assets.war from /opt/cba/<FAS>/domain/deployment_backups (that is,


from the /domain/deployment_backups directory of your FAS installation). It will be named
assist_assets.war-<datetime>, where <datetime> is a date and time in ISO 8601 format.

2. Unzip it and open the file sdk/web/shared/locales/assistIi18n.en.json (this is the English


language file).

3. Edit the entries so that the values are in the target language.

4. Save the file in the same directory, under the name assistIi18n.<lang>.json, where <lang> is
the 2 letter language code of the target language: es for Spanish, fr for French, and so on.

5. Re-zip the file, maintaining the original file structure, and redeploy it to the server (update
assist_assets.war with the new file – see the FAS Administration Guide).

When calling AssistSDK.startSupport or CallManager.init, provide a locale parameter in the


configuration object (see the Configuration section). The value should be the 2 letter language
code for the target language, as used in step 4 above.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 24


Starting a Co-browse only Session
When operating in co-browse only mode, the agent application starts a support session by
calling the AssistAgentSDK.startSupport function, passing in a configuration object containing
both a correlationId and a sessionToken value. The correlation ID is a string which enables the
CBA Live Assist server to identify which agent and consumer sessions belong together. The
agent and consumer must use the same correlation ID, and normally, the consumer application
generates the correlation ID when it creates a session for itself, and the consumer
communicates it to the agent out-of-band. The CBA Live Assist server gives the consumer and
agent applications some help in communicating the correlation ID by means of a short code:

The advantage of communicating a short code, rather than communicating the correlation ID
directly, is that the short code generated by the CBA Live Assist server is guaranteed to be both
unique during the communication process, and short enough for the client to communicate by
voice (or whatever other out-of-band communication channel is in use) without error.

If the agent application already knows the correlation ID, but needs a session token for use by
the co-browse only session, it must call the REST service which the CBA Live Assist server
exposes for that purpose (error handling omitted):

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 25


var request = new XMLHttpRequest();
request.open("POST", "/assistserver/agent", true);
request.setRequestHeader("content-type", "application/x-www-form-
urlencoded");
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200) {
config.sessionToken = JSON.parse(request.responseText).token;
config.correlationId = "12345678";
AssistAgentSDK.startSupport(config);
}
}
}
request.send("username=" + username + "&password=" + password +
"&type=create&targetServer=" + server + "&name=" + agent);

The above method works when using anonymous agent access with the agent session service
provided by CBA Live Assist. To use the more secure authenticated agent access, see the
Authenticated Agent Access section.

Ending a Co-browse only Session

In co-browse only mode, there is no defined start or end of a support session, as the agent and
consumer can join or leave the session at any time independently. It is up to the developers of
the agent console and CBA Live Assist-enabled consumer application to manage the presence
of the agent and consumer in a session. Calling the AssistAgentSDK.endSupport function
removes the agent from the support session:

<div class="button" id="endbutton">


<a onclick="AssistAgentSDK.endSupport();"><img src="img/endsupport.svg"></a>
</div>

The application will also need to clean up its user interface in response to the consumer ending
support. Implement the following callback to get notification when a consumer has explicitly
ended support:

AssistAgentSDK.setConsumerEndedSupportCallback(function() {
...
});

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 26


You can also use the similar AssistAgentSDK.setConsumerJoinedCallback and
AgentAssistSDK.setConsumerLeftCallback in a similar fashion to get notifications of a consumer
joining and leaving a session.

Note: Call AssistAgentSDK.endSupport when the agent wishes to leave the support session.
There is no need to call it in response to the consumer leaving the support session, as CBA Live
Assist will take care of that automatically.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 27


Escalating an Existing Call to Co-browse
Sometimes, the application needs to add co-browsing capabilities to an existing call. In order to
do this, both consumer and agent need to use the same correlation ID in the configuration object
when calling startSupport. In some circumstances, this might be easy (for instance, the two ends
might have an agreed value built in, or easily looked up or calculated), but in cases where this is
not possible, the CBA Live Assist server itself gives some help. For details on the consumer
application’s end of this operation, see the CBA Live Assist Developers Guides for Android,
Web, or iOS.

1. The consumer application calls a REST service on the server to generate a short code.

2. The consumer application uses the short code in a call to another REST service on the
server, which generates a session token and a correlation ID associated with the short code.

3. The consumer application starts its own support session using that session token and
correlation ID.

4. The consumer communicates the short code to the agent. This is an out-of-band
communication, and may be as simple as the consumer speaking the short code to the
agent on the existing call - this is how the sample application works.

5. The agent application uses the short code in a call to another REST service, which will
return the correlation ID (the session token is already known):

var request = new XMLHttpRequest();


request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200) {
var cid = JSON.parse(request.responseText).cid;
var config;

config.correlationId = cid;
config.sessionToken = sessiontoken;
AssistAgentSDK.startSupport(config);
}
}
};
request.open("GET", "/assistserver/shortcode/agent?appkey=" + shortcode,

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 28


true);
request.send();

Authenticated Agent Access


The agent session creation servlet at /assistserver/agent/ creates session tokens for agents, but
does not authenticate them. For secure access by agents, we recommend turning off
anonymous agent access (see the CBA Live Assist Overview and Installation Guide ), and
creating agent session tokens only after you have authenticated the agent. To create a session
token, the application must POST a session description to the session creation servlet:

var request = new XMLHttpRequest();


request.open("POST", "/sessions", true);
request.setRequestHeader("content-type", "application/json");
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200) {
config.sessionToken = JSON.parse(request.responseText).token;
...
}
}
}

request.send(session_description);

The session description is a JSON string; see the FCSDK Developer Guide for details of its
contents. For the purposes of CBA Live Assist session creation, it must contain at least a
webAppId, an additionalAttributes object with the necessary entries, and either an aed or a voice
(if the agent needs voice and video functionality) object:

{
"webAppId":"LIVE_ASSIST_AGENT",
"voice":
{
"username":"agent1",
"domain":"example.com",
...
},
"aed":
{
"accessibleSessionIdRegex":".*",

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 29


...
},
"additionalAttributes":
{
"AED2":
{
"allowedTopic":".*",
"metadata":
{
"features":["zoom","annotate","spotlight","document-share",
"interact"],
"role":"agent",
"name":"agent1",
...
}
}
}
}

AED2.allowedTopic must be a Java style regular expression; the agent can only connect to
support sessions which have a correlation ID which matches it. Because agents must usually be
able to access any support session, an agent will normally use a wildcard entry (.*).

AED2.metadata.features is an array of strings which determines which features of CBA Live


Assist the agent can use. The above list enables all features for the agent, and we expect this to
be the normal case. If you want to disable a feature for a particular agent, leave the
corresponding string out of the features array. By default (if the JSON does not include features
at all), the agent has all features enabled. See the Enabling Agent Features section.

For an agent, the role, must always be agent; name is a free-form string which acts as a label for
the agent.

You can set other attributes, depending on your requirements - see the FCSDK Developer
Guide. You can also add extra entries for setting agent permissions; see the Setting Agent
Permissions section.

Note: At least one of voice or aed must be present to create the session token. However, if the
session description includes a voice section (which it must if voice and video functionality is
required), then only the AED2 entries are necessary for CBA Live Assist functionality. If voice
and video functionality is not needed, and there is no voice section, then there must be an aed
section as well as the AED2 section entries.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 30


Enabling Agent Features

When using authenticated agent access, you can deny an agent permission to use certain
features by leaving them out of the AED2.metadata.features array in the JSON sent to the
session creation servlet. The names of the features, and what they allow if included, are:

Feature name Description

zoom The agent can use the Zoom tool

annotate The agent can enter annotation mode

spotlight The agent can use the spotlight tool

document‑share The agent can share documents and links with the consumer

The agent can interact with the consumer’s screen by clicking on control
buttons or dragging objects. With the interact feature switched off, the
interact
agent can only use the move, resize, and zoom handles on shared
windows.

If the agent does not have a particular feature (zoom, for instance), and the agent console code
tries to use it (by calling the AssistAgentSDK.startZoom function), the SDK functions will not
throw exceptions. However, CBA Live Assist will not send the resulting messages to the
consumer, and so the feature will not work. CBA Live Assist will also write a Feature blocked
message to the browser’s console.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 31


Specifying an Audit Name
If you have set up event logging (see the CBA Live Assist Overview and Installation Guide),
you may want to specify an audit name for the agent, which appears in the participant_id
column when events are logged. You can do this when you create the session by sending an
HTTP or JSON request to the CBA Live Assist server.

Note: You will frequently start the session by calling CallManager.init (see the Starting a Voice
and Video Session section) with a configuration object. You cannot specify an audit name if you
start the session this way.

Using HTTP

You can include an auditName parameter in the URL which you send to the CBA Live Assist
servlets.

To the agent servlet using anonymous agent access (see the Starting a Co-browse only Session
section):

...
request.open("POST", "/assistserver/agent", true);
...
request.send(... + "&auditName=" + auditname + ...);

To the shortcode servlet (see the Escalating an Existing Call to Co-browse section):

...
request.open("PUT", "/assistserver/shortcode/create?CID=12345&auditName=" +
auditName + ..., true);
...

when creating a short code to be associated with the supplied correlation ID. Or:

...
request.open("GET", "/assistserver/shortcode/agent?appkey=1234&auditName=" +

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 32


auditName + ..., true);
...

when retrieving the correlation ID associated with a short code supplied in the appkey parameter.

Using JSON

You can include an auditName element in the AED2.metadata object when supplying JSON to
the sessions servlet (see the Authenticated Agent Access section):

"additionalAttributes":
{
"AED2.metadata":
{
"auditName":"agent1",
}
}

In all cases, the auditName is optional. If omitted, the participant_id is a blank string for entries
involving the agent.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 33


Permissions
You can use permissions to prevent an agent from interacting with, or even seeing, a UI control.
Whether an agent can see a particular control or not depends upon both the agent’s and the
control element’s permissions.

Control element permissions

Client applications assign permission markers to UI control elements; each UI element has at
most one permission marker. Elements which do not have a permission marker inherit their
parent element’s permission marker; elements which do not have a permission marker and do
not have a parent (or have a parent which does not have or inherit a permission marker) are
assigned the default permission marker.

Agent permissions

Agents have two sets of permissions, viewable permissions and interactive permissions.
Each set may contain an arbitrary number of values. Agents which are not explicitly assigned
any permissions have the default permission, and only the default permission, in both
interactive and viewable sets.

The application sets the agent’s permissions by including them in the session description when
it creates the session token, which it must do explicitly (see the Setting Agent Permissions
section). It then sets the sessionToken property in the configuration object which it uses when
calling AssistAgentSDK.startSupport or CallManager.init.

Note: If the agent specifies permissions in the session description, but leaves both the viewable
set and interactive set empty, the agent will end up with no permissions, not even the default
permission.

The combination of the element’s and the agent’s permissions determines the visibility of a UI
element to an agent. A UI element is visible to a specific agent if, and only if, the agent’s set of
viewable permissions contains the permission marker assigned to or inherited by that element.
Similarly, an agent may interact with a UI element if and only if the agent’s set of interactive
permissions contains the element’s permission marker.

Permissions and permission markers are free-form text, which (apart from the reserved default
permission) are in the control of the application developer. CBA Live Assist will show to the
agent those, and only those, elements which the agent has permission to view; but it is up to the

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 34


application developer to ensure that each agent has the permissions they need, and that the UI
elements have corresponding permission markers assigned.

CBA Live Assist assumption: When an agent wishes to establish a co-browse, the permissions
the agent should have, as defined by the organization’s infrastructure, are known, and can be
translated into an equivalent set of permissions in the Session Description.

Setting Agent Permissions

You can set agent permissions when using authenticated agent access (see the Authenticated
Agent Access section) by adding the role (which should always be agent) and permissions
objects to the additionalAttributes.AED2.metadata in the JSON object which creates the session:

"additionalAttributes":{
...
"AED2.allowedTopic":".*",
"AED2.metadata":{
"role":"agent",
"permissions" : {
"viewable" : ["banking", "claims", "default"],
"interactive" : ["claims", "default"]
},
...
}

Note: If you do not specify the permissions attribute for the agent, then it will implicitly have the
default permission; if any permission is specified, then the agent will have only that permission -
in that case, if you want the agent to have the default permission, you have to specify it explicitly;
if you specify the permissions object, but leave either the viewable or interactive sets empty, the
agent will have no permissions for that set, not even the default permission.

Agent and Element Permissions

Permissions are compound such that:

Agent Agent
Permission
viewable interactive
marker on Result
permission permission
element
set set

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 35


Agent can view and interact with
X [“X”] [“X”]
an element marked with X.

Agent can view the element


X [“X”] [] marked with X but cannot interact
with it.

Agent can neither view nor interact


with the element, because it does
not have X in its viewable set. (In
X [] [“X”]
order to interact with an element,
and agent must first be able to
view it.)

Element marked with X is masked


or redacted, as Agent does not
X [] []
have the X permission in its
viewable or interactive set.

Element marked with X is masked


or redacted, because Agent does
X [“default”] [“default”]
not have the X permission in its
viewable or interactive set.

Agent can neither view nor interact


X [“default”] [“X”] with the element, because it does
not have X in its viewable set.

Agent can view the element,


because it has the X permission in
its viewable set; it cannot interact
X [“X”] [“default”]
with it, because it does not have
the X permission in its interactive
set.

Element marked with B is masked


or redacted, because Agent has X
B [“X”] [“X”]
permission and not B in their
permission set.

[“X”,”default”] [“X”,”default”] Agent can view and interact with


the element because they have the

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 36


default permission in their viewable
and interactive sets, and the
element implicitly has the default
permission.

Element is masked or redacted,


[“X”] [“X”] because Agent’s sets do not
contain the default permission

Agent can view and interact with


the element, because they have
[“default”] [“default”]
the default permission set for their
viewable and interactive set.

Element is masked or redacted,


[] [] because Agent’s sets do not
contains default permission

Agent can see the element


because they have the default
permission in their viewable set.
[“default”] [“X”] They cannot interact with it
because they do not have the
default permission in their
interactive set.

Element is masked or redacted


because the agent’s viewable set
does not contain B. The agent may
B [“X”] [“B”] not interact with an element which
they cannot see, even though they
have the appropriate permission in
their interactive permission set.

Element is viewable, because the


agent’s viewable set contains B;
B [“B”] [“X”] the element is not interactive, as
the agent’s interactive set does not
contain B.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 37


An agent is granted a permission if a permission (such as A, B, or X) configured in their Session
Description matches the permission-marker of the UI element in the application.

Note: In some circumstances an agent can be granted the default permission implicitly, but that
is not the same thing as having an empty set of permissions. In the above table, an empty
set of agent permissions means exactly that; a set of permissions containing only the default
permission may have been granted either implicitly or explicitly.

Parent and Child Permissions

An element can also inherit permissions through the UI hierarchy: UI elements that are a child of
a parent UI element inherit the permission marker of the parent, unless the child specifies a
permission marker of its own.

A child element can override its parent permission marker, but it will only be effective if the
agent’s viewable permission set contains the parent’s permission marker as well as the child’s
(the agent must be able to see the container in order to interact with an element inside it). This
allows the developer to make a child element interactive and the parent element not. An example
use of this could be a child button within a parent container, where only the button needs to be
interactive.

Permission Permission Agent Agent


marker set marker set viewable interactive
Result
on parent on child permission permission
element element set set

Agent can view and


interact with both
A [“A”] [“A”] parent and child
element. Child inherits
permission marker A.

Agent can view and


interact with both
A A [“A”] [“A”]
parent and child
element.

Agent cannot view or


A B [“A”] [“A”] interact with child
element marked with B.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 38


Agent can view child
A B [“A”,”B”] [“A”] element but cannot
interact with it

Agent can view and


interact with the child
A B [“A”,”B”] [“B”]
element but cannot
interact with the parent.

Agent cannot view or


interact with child or
parent element as they
do not have the
parent’s permission
marker in their viewable
permission set. The
A B [“B”] [“B”]
agent may not interact
with an element which
they cannot see, even
though they have the
appropriate permission
in their interactive
permission set.

Agent can view and


interact with both
parent and child
elements as they have
the default permission
[“default”] [“default”] in their viewable and
interactive permission
sets, and both parent
and child elements
implicitly have the
default permission.

B [“B”] [“B”] Agent cannot view or


interact with child
element, because the
parent has an implicit

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 39


default permission
marker, and they do not
have the default
permission in their
viewable permission
set. The agent may not
interact with an element
which they cannot see,
even though they have
the appropriate
permission in their
interactive permission
set.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 40


Error Handling
An agent application can receive callbacks for critical CBA Live Assist errors using the
setOnErrorCallback method. For example:

AssistAgentSDK.setOnErrorCallback(function (error) {
console.log("Agent console Error " + JSON.stringify(error));
});

The error object provided to the function contains two elements:

Item Description

code Numeric error code

message Free-form text message

Possible error codes produced by CBA Live Assist are:

Code Description

0 Produced by the CallManager when it is unable to initialize the FCSDK objects

1-4 Reserved

An attempt has been made to start a support session when one is already in
5
progress

Produced by the CallManager when it is unable to make a call. The message


6
element gives more information

Produced when there is an attempt to fill in a form, and


7
AssistAgentSDK.setFormCallback has not been called.

The default behavior of CBA Live Assist is to print the error to the console.

Application Errors

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 41


You can define your own error codes and messages, and call the AssistAgentSDK.setError
function to send them to whatever error handling mechanism is in operation (your own if you
have called AssistAgentSDK.setOnErrorCallback, otherwise the SDK’s default). The error
parameter is an object as defined above:

var error = {code: 100, message: 'Application error'};


AssistAgentSDK.setError(error);

Note: Do not use error codes which are, or are likely to be, used by CBA Live Assist itself. CBA
Live Assist does not reserve any values for application use, but high values (as above) should
be safe.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 42


WebSocket Initiation
To prevent getting a 302 error reported to you by a WebSocket during handshaking, ensure that
your deployment allows direct access to the WebSocket endpoint:

wss://<fas address>:<port>/assistserver/topic

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 43


Integrating the Fusion Client SDK
CBA Live Assist Agent Console SDK uses facilities from Fusion Client SDK, and uses an
instance of theFCSDK, so all the facilities of FCSDK are available for you to use if you want.
FCSDK objects are available from the global UC object (see the FCSDK Developer Guide for
details on what facilities are available and how to use them). How to access the UC object
depends upon how you initialized the CBA Live Assist SDK:

If you called CallManager.init with a configuration object which does not include a session
token, it automatically requests a session token and initializes the FCSDK with it. In this
case, the UC object is automatically available as a global object for you to use.

If you requested a session token from the FCSDK session token REST API, you can provide
it when you initialize UC (see the FCSDK Developer Guide). You can use this session
token and a correlation ID in the configuration object which you pass to
AssistAgentSDK.startSupport to escalate the session for CBA Live Assist after establishing
a call (see the Escalating an Existing Call to Co-browse section).

If you started a co-browse only session, there is no call under the control of the FCSDK, so
the FCSDK objects are not available.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 44


Connectivity Callbacks
The application can receive notifications about the state of the WebSocket connection to the
CBA Live Assist server by setting callbacks on the AssistAgentSDK:

setConnectionEstablishedCallback

Receives notification when the connection is established. The callback function takes no
arguments.

setConnectionLostCallback

Receives notification when the connection is lost and connection will not be retried. The callback
function takes no arguments.

setConnectionReestablishedCallback

Receives notification when the connection is re-established after being dropped. The callback
function takes no arguments.

setConnectionRetryCallback

Receives notification that the connection has dropped and connection will be retried. The
callback function receives a retry count and a retry time in milliseconds:

AssistAgentSDK.setConnectionRetryCallback(function(retryCount,
retryTimeInMilliseconds) {
console.log("Connection lost - " + retryCount + " retry after " +
retryTimeInMilliseconds + "ms");
});

Note: These callbacks are informational. To control connectivity, see the WebSocket
Reconnection Control section).

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 45


WebSocket Reconnection Control
When a co-browse session disconnects due to technical issues, you can control reconnection by
passing in one or both of the following to the CBA Live Assist SDK when calling
AssistAgentSDK.startSupport or CallManager.init:

Connection configuration.

A set of callbacks which listen for connection events, allowing an application to perform its
own reconnection handling.

Note: These callbacks can also be used simply to monitor the state of the connection, but we
recommend that you use the simpler callbacks for this - see the Connectivity Callbacks section.

Connection Configuration

You can specify reconnection configuration as part of the configuration object (see the
Configuration section):

var config;
...
config.retryIntervals = [5.0, 10.0, 15.0];
...
AssistAgentSDK.startSupport(config);

Item Default Description

Array of numeric values. The number of


values indicates the number of reconnection
retryIntervals [1.0,2.0,4.0,8.0,16.0,32.0] attempts, and the values indicates the time in
seconds between each attempt. If the array is
empty, there are no reconnection attempts.

Connection Callbacks

If the default reconnection behavior of CBA Live Assist is not what you want, even after
changing the configuration, you can specify a set of callbacks in the connectionStatusCallbacks

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 46


element of the configuration object (see the Configuration section):

var connectionStatusCallbacks = {
onDisconnect: function(error, connector) {},
onConnect: function() {},
onTerminated: function(error) {},
willRetry: function(inSeconds, retryAttemptNumber, maxRetryAttempts,
connector) {}
};

var config;
...
config.connectionStatusCallbacks = connectionStatusCallbacks;
...
AssistAgentSDK.startSupport(config);

These callbacks provide the same information as the connectivity callbacks (see the Connectivity
Callbacks section), but also allow you to control the reconnection behavior. When implementing
your own reconnection logic, the most important notifications you receive are onDisconnect
(called whenever the connection is lost) and willRetry (called when automatic reconnection is
occurring, and there are more reconnection attempts to come). Both these methods include a
connector object in their arguments; you can use the connector object to make a reconnection
attempt, or to terminate all reconnection attempts.

Item Description

Called for the initial WebSocket failure, and for every failed reconnection
attempt (including the last one). This method is called regardless of
whether retryIntervals is specified (that is, whether automatic reconnection
is active or not). The connector object allows the implementing class to
onDisconnect control reconnection, even if reconnection is automatic. For example, an
application might decide to give up reconnection attempts even if more
reconnection attempts would normally occur; or to try the next
reconnection attempt immediately without waiting until the next retry
interval has passed.

Called when a reconnection attempt succeeds.This may be useful to clear


onConnect an error indication in the application UI, or for canceling reconnection
attempts if the application is managing its own reconnections.

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 47


Called under the following conditions:

●when all reconnection attempts have been made (and failed); or


onTerminated

●when either the connector.disconnect or AssistSDK.endSupport method


is called.

Called under the following conditions:

●when the WebSocket connection is lost; or

●when a reconnection attempt fails and automatic reconnections are


occurring (retryIntervals is a non-empty array) and there are more
willRetry
automatic reconnection attempts to be made.

This method is called after the onDisconnect method.

Use the connector object to override reconnection behavior. For example,


to make a reconnect attempt immediately.

The error parameter which is passed to the onDisconnect and onTerminated callbacks, and
which can be supplied to the connector.terminate function, is an object with two elements:

Item Description

code Numeric error code

message Free-form text message

Example - make a reconnection attempt immediately on disconnection:

In this example, the default reconnection behavior has been disabled (by specifying an empty
array for retryIntervals in the configuration object), and the application reconnection behavior
depends on the reason for disconnection:

var connectionStatusCallbacks = {
onDisconnect: function(error, connector) {
if (error.code > 0)
connector.reconnect();
else
connector.terminate(error);

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 48


},
onConnect: function() {},
onTerminated: function(error) {},
willRetry: function(inSeconds, retryAttemptNumber, maxRetryAttempts,
connector) {}
};

Example - terminate reconnection attempts in response to user command:

In this example, the default reconnection behavior has not been disabled, but there is a UI
control which the user can press to short-circuit the reconnection attempts. If the user has not
terminated the connection attempts, automatic reconnection attempts continue:

var connectionStatusCallbacks = {
onDisconnect: function(error, connector) {},
onConnect: function() {},
onTerminated: function(error) {},
willRetry: function(inSeconds, retryAttemptNumber, maxRetryAttempts,
connector) {
if (userHasTerminated)
connector.terminate({code:-1, message: 'User has terminated connection'});
}
};
```</span>

© 2023 CBA | All Rights Reserved | Unauthorized use prohibited. Page 49

You might also like