This article discusses how to initialize the Agent Service within your website.
The central class of the Avaya Co-Browsing Services is AvayaCoBrowseClientServices. Agent website using the Avaya Client SDK has its own instance of AvayaCoBrowseClientServices and maintains a reference to this object in order to start an AgentCobrowse and access features within the SDK.
As part of the process to create your client instance, you must create a CoBrowseConfiguration object that defines your website. The attributes that you define within CoBrowseConfiguration are used to interact with Breeze server over the network:
//Set the service context name, supported names are "services,avservice"
//Default name is "services"
_serviceContext = "avservice";
_cbconfig = new AvayaCoBrowseClientServices.Config.CoBrowseConfiguration();
//Set FQDN/hostname of the breeze server
_cbconfig.serverInfo.hostName = "localhost";
//Set the port number to access breeze server
_cbconfig.serverInfo.port = '8443';
//Set to true for secure communication. Default value is false
_cbconfig.serverInfo.isSecure = true;
//To enable co-browsing.Default value is false
_cbconfig.enabled = true;
Note: For more information on service configuration, see Configuring the SDK.
Create an AvayaCoBrowseClientServices instance.
var _coBrowseAgentClientService = new AvayaCoBrowseClientServices(_cbconfig);
// To register logger
_coBrowseAgentClientService.registerLogger(window.console);
Create an instance
_cbinstance = _coBrowseAgentClientService.createAgentCobrowse(_cbconfig);
Service context name for customer
_cbinstance = _coBrowseCustomerClientService.initAgentServiceContext(_serviceContext);
To render the Customer webpage on IFrame, You must provide IFrameId. After setting the IFrameId, Start the Agent service.
// To set IFrame which renders customer webpage
_cbinstance.setIFrame(_iframeId);
_cbinstance.start();
Callbacks are used to handle events that occur during an active Avaya Co-Browsing session.
addOnPauseCallback is called to report that the Customer has paused the Avaya Co-Browsing session.
_cbinstance.addOnPauseCallback(function () {
// Called to report the customer has
// paused co-browsing session
// Add code here to notify agent
});
addOnResumeCallback is called to report that the Customer has resume the Avaya Co-Browsing session.
_cbinstance.addOnResumeCallback(function () {
// Called to report the customer has
// resume co-browsing session
// Add code here to notify agent
});
addOnControlGrantCallback is called to report that the Customer has granted the Avaya Co-Browsing session control.
_cbinstance.addOnControlGrantCallback(function () {
// Called to report the customer has
// granted co-browsing session control
// Add code here to notify agent
});
addOnControlDenialCallback is called to report that the Customer has denied the Avaya Co-Browsing session control.
_cbinstance.addOnControlDenialCallback(function () {
// Called to report the customer has
// denied co-browsing session control
// Add code here to notify agent
});
addOnControlRevokeCallback is called to report that the Customer has revoked the Avaya Co-Browsing session control.
_cbinstance.addOnControlRevokeCallback(function () {
// Called to report the customer has
// revoked co-browsing session control
// Add code here to notify agent
});
addOnSessionCloseCallback is called to report that the Customer has closed the Avaya Co-Browsing session control.
_cbinstance.addOnSessionCloseCallback(function (evt) {
// Called to report the customer has
// closed co-browsing session control
// Add code here to notify agent
});
addOnCustomerJoinCallback is called to report that the Customer has joined the Avaya Co-Browsing session.
_cbinstance.addOnCustomerJoinCallback(function () {
// Called to report the customer has
// joined co-browsing session control
// Add code here to notify agent
});
addOnConnectionFailureCallback is called to report that the network connection is failed.
_cbinstance.addOnConnectionFailureCallback(function (evt) {
// Called to report the network connection is
// failed
// Add code here to notify agent
});
addOnConnectionCallback is called to report that the network connection is established.
_cbinstance.addOnConnectionCallback(function (evt) {
// Called to report the network connection has been
// established
// Add code here to notify agent
});
addOnInActivityTimeOutOccurredCallback is called to report that the Agent is inactive during an active Avaya Co-Browsing session.
_cbinstance.addOnInActivityTimeOutOccurredCallback(function (message) {
// Called to report the agent is inactive during
// active co-browsing session
// Add code here to notify agent
});
addOnStopInActivityTimeOutCallback is called to report that the Agent has become active during an active Avaya Co-Browsing session.
_cbinstance.addOnStopInActivityTimeOutCallback(function (message) {
// Called to report the agent has become active during
// active co-browsing session
// Add code here to notify agent
});
Support to reinitialize Agent service feature is planned for the future release.