This article discusses how to initialize the Customer service within your website.
The central class of the SharingServices Package is AvayaCoBrowseClientServices. Customer website using the SharingServices Package has its own instance of AvayaCoBrowseClientServices and maintains a reference to this object in order to start an CustomerCobrowse and access features within the Avaya Co-Browsing SDK.
As part of the process to create your client instance, you must create a CoBrowseConfiguration object that defines your website. The attributes you define within CoBrowseConfiguration will be 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;
//To allow customer's information persist in the CoBrowse Database. Default value is 'true'
//Setting it to 'false' restricts CoBrowse to persist customer's information in Database
_cbconfig.consent = true;
Note: For more information on service configuration, see Configuring the SDK.
Create a AvayaCoBrowseClientServices instance
var _coBrowseCustomerClientService = new AvayaCoBrowseClientServices(_cbconfig);
// To register logger
_coBrowseCustomerClientService.registerLogger(window.console);
Service context name for customer
_cbinstance = _coBrowseCustomerClientService.initCustServiceContext(_serviceContext);
Start the customer service
_cbinstance = _coBrowseCustomerClientService.createCustomerCobrowse(_cbconfig);
_cbinstance.start();
Callbacks are used to handle events that occur during the active Avaya Co-Browsing session.
addOnConnectionResetCallback is called to report that the network connection has been re-established.
_cbinstance.addOnConnectionResetCallback(function (evt) {
// Called to report the network connection has been
// re-established
// Add code here to notify customer
});
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 customer
});
addOnConnectionCallback is called to report that the network connection has been established.
_cbinstance.addOnConnectionCallback(function (evt) {
// Called to report the network connection has been
// established
// Add code here to notify customer
});
addOnSessionCloseCallback is called to report that the Agent has closed Avaya Co-Browsing session.
_cbinstance.addOnSessionCloseCallback(function (evt) {
// Called to report the agent has
// closed co-browsing session
// Add code here to notify customer
});
addOnControlRequestCallback is called to report that the Agent has requested Avaya Co-Browsing session control.
_cbinstance.addOnControlRequestCallback(function (evt) {
// Called to report the agent has
// requested co-browsing session control
// Add code here to notify customer
});
addOnControlReleaseCallback is called to report that the Agent has released Avaya Co-Browsing session control.
_cbinstance.addOnControlReleaseCallback(function (evt) {
// Called to report the agent has
// released co-browsing session control
// Add code here to notify customer
});
addOnCancelRequestControlCallback is called to report that the Agent has canceled request for Avaya Co-Browsing session control.
_cbinstance.addOnCancelRequestControlCallback(function (evt) {
// Called to report the agent has
// canceled request for co-browsing session control
// Add code here to notify customer
});
addOnfireInactivityCallback is called to report that the Customer is inactive during active Avaya Co-Browsing session.
_cbinstance.addOnfireInactivityCallback(function (msg) {
// Called to report the customer is inactive during
// active co-browsing session
// Add code here to notify customer
});
addOnStopInactivityTimerCallback is called to report that the Customer is active during active Avaya Co-Browsing session.
_cbinstance.addOnStopInactivityTimerCallback(function (msg) {
// Called to report the customer is active during
// active co-browsing session
// Add code here to notify customer
});
addOnAgentJoinCallback is called to report that the Agent has joined Avaya Co-Browsing session control.
_cbinstance.addOnAgentJoinCallback(function (evt) {
// Called to report the agent has
// joined co-browsing session control
// Add code here to notify customer
});
addOnUpdateHtmlBodyLinkCallback is called to execute the custom logic to process the href for link tag within the body.
var replaceContextNameFromPath = "/web/";
_cbinstance.addOnUpdateHtmlBodyLinkCallback(function (evt) {
// Called to execute the custom logic to process the link tag
//example: replaceContextNameFromPath the required absolute path for the resources
if (href.indexOf("/") === 0 || href.indexOf("http") !== 0) {
data.href = href.replace(replaceContextNameFromPath, "/");
}
});
addOnUpdateHtmlBodyImageCallback is called to execute the custom logic to process the src for image tag within the body.
var replaceContextNameFromPath = "/web/";
_cbinstance.addOnUpdateHtmlBodyImageCallback(function (data) {
// Called to execute the custom logic to process the image tag present within the page body
//example: replaceContextNameFromPath the required absolute path for the resources
if (src.indexOf("/") === 0 || src.indexOf("http") !== 0) {
data.src = src.replace(replaceContextNameFromPath,"/");
}
});
addOnUpdateHtmlHeadCallback is called to execute the custom logic to process the href for link tag present in the html head.
var replaceContextNameFromPath = "/web/";
_cbinstance.addOnUpdateHtmlHeadCallback(function (data) {
// Called to execute the custom logic to process the href for link tag present in the html head
//example: replaceContextNameFromPath the required absolute path for the resources
if (href.indexOf("/") === 0 || href.indexOf("http") !== 0) {
data.href = href.replace(replaceContextNameFromPath, "/");
}
});
Support to reinitialize Customer service feature is planned for the future release.