Fetch configuration for the Agent from UAC, passing agent's authHandle (from the JWT SSO Token) as a parameter. Initiate the Communication Services package with call and service gateway configuration properties if 'configuration.isWebRTC' is true.
clientSession.getConfiguration(tokenData.authHandle).then(function(data) {
var loadedConfig = data.configuration;
if (loadedConfig.isWebRTC) {
// To configure the Communication Services package to handle a WebRTC enabled agent with Avaya Aura Web Gateway, use the following configuration
var cpConfig = new AvayaCustomerServices.Config.CPConfiguration({
callUserConfiguration: {
incomingCall: true,
videoEnabled: true,
videoMaxBandwidthAnyNetwork: 1024
},
sgConfiguration: {
enabled: true,
authToken: tokenData.jwt,
networkConfiguration: {
hostName: loadedConfig.aawgFQDN,
isSecure: true
}
},
logger: console
});
clientSession.setConfig({ cpConfiguration: cpConfig });
}
});
If the agent will be WebRTC enabled, a user must first be registered with the Communication Services package before activating with UAC:
// Event listener called on successful user registration (Communication Services package)
clientSession.addOnUserRegistrationSuccessfulCallback(function() {
agent.activate(user.userHandle);
});
// Event listener called on failed user registration (Communication Services package)
clientSession.addOnUserRegistrationFailedCallback(function (error) {
console.log(error);
});
// And then start the client session (creates Communication Services package user and initiates atmosphere session)
clientSession.start();