^
^
JavaScript Customer Interaction Services Package

< Back to Package Overview

Enterprise Directory Search

Enterprise directory search can be used to find contacts in the enterprise directory (LDAP).

Configuration

Fetch the configuration for the Agent from UAC, passing agent's authHandle (from the JWT SSO Token) as a parameter. Initiate the Communication Services package with a ACS configuration property if enterprise directory search features are required.

clientSession.getConfiguration(tokenData.authHandle).then(function(data) {
    var loadedConfig = data.configuration;

    if (loadedConfig.aadsFQDN) {
        var cpConfig = new AvayaCustomerServices.Config.CPConfiguration({
            acsConfiguration: {
              enabled: true,
              authToken: tokenData.jwt,
              networkConfiguration: {
                hostName: loadedConfig.aadsFQDN,
                isSecure: true
              }
            },
            logger: console
        });

        clientSession.setConfig({ cpConfiguration: cpConfig });
    }
});

Activation

If the agent will have enterprise directory search features, 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();

Search Tutorial

Here is a simple example demonstrating the use of the Contacts API to search the enterprise directory when the contacts service becomes available, and display some properties of each Contact returned.


var contacts = clientSession.createContacts();

// 'Listen' for a completed search event
contacts.addOnContactsSearchCompletedCallback(function (searchId, searchResults) {
    // Clear list of existing contacts
    $('#contacts-view > tbody').html('');

    for (var contactId in searchResults) {
        var contact = searchResults[contactId];
        $('#contacts-view > tbody').append('<tr>')
        .append('<td>' + contact.displayName + '</td>')
        .append('<td>' + contact.department + '</td>')
        .append('</tr>');
    }
});

// 'Listen' for a search failed event
contacts.addOnContactsSearchFailedCallback(function (error) {
    console.log(error);
});

// Search for alex and limit the result set to 15, success or failure will be reported via the event listeners registered above
contacts.search('alex', 15);
Feedback

Your feedback has been successfully submitted.

There was a problem submitting your feedback. Please contact your product support representative.

Page Feedback