Avaya Client SDK

< Back to Package Overview

Using the Call Log Service

The call log service API provides history entries for calls that have been made or received on the client. Both Local Call logs and PPM Call logs are supported. Local call logs do not record events when a user is logged off, and no call logs will be captured. PPM call logs will record network calls when the user is logged in or logged out. Each call record is represented by the CallLogItem object. This object provides several attributes such as call start time, remote address, call duration, etc.

Initializing and Configuring the CallLogService

The Client SDK provides call log services through the CallLogService interface. This interface is implemented by the CallLogServiceImpl object and is exposed to the binding layer.

First, set full path to the call log file via the setLocalCallLogFilePath() method of your UserConfiguration object. If an invalid path is provided, the call log items will not persist. They will be updated in the cache during runtime only. The path should be unique for each user logging in on the client.

userConfiguration.setLocalCallLogFilePath
    (Environment.getExternalStorageDirectory().getPath() + File.separatorChar 
        + "call_logs_sampleApps.xml");

The UserConfiguration object is used to define the services that are available to the end users of your application. Each service is configured individually.

Note: See more information on service configuration in the article Configuring the SDK.

The CallLogService object is obtained from the Client SDK User object. Start by obtaining the instance of the Client SDK CallLogService. To monitor call log events, you need to use the CallLogServiceListener interface provided by the CallLogService object. Add CallLogServiceListener for monitoring call log events using the addListener() method.

import com.avaya.clientservices.user.User;
import com.avaya.clientservices.calllog.CallLogCompletionHandler;
import com.avaya.clientservices.calllog.CallLogItem;
import com.avaya.clientservices.calllog.CallLogService;
import com.avaya.clientservices.calllog.CallLogServiceListener;

public class CallLogManager implements CallLogServiceListener, 
    CallLogCompletionHandler {
        private CallLogService callLogService;
        private List callLogItems = new ArrayList<>();

        public CallLogManager(User user) {
            if (user != null) {
                callLogService = user.getCallLogService();
            }

            if (callLogService != null) {
                callLogService.addListener(this);
            }
        }

        @Override
        // implementation of the CallLogServiceListener
        public void onCallLogServiceLoaded(CallLogService callLogService, 
            List list) {
                // some logic
        }

        @Override
        // implementation of the CallLogServiceListener
        public void onCallLogServiceLoadFailed(CallLogService callLogService) {
            // some logic
        }

        @Override
        // implementation of the CallLogCompletionHandler
        public void onSuccess() {
            // some logic
        }

        @Override
        // implementation of the CallLogCompletionHandler
        public void onError() {
            // some logic
        }

        // implement other listener methods

Configuring the CallLogService to use PPM Call Logs

The Client SDK provide configuration through the PPMConfiguration object to enable and disable PPM Call Logs. PPM Call Logs require PPM Call Journaling to be enabled on the Aura network, and if not enabled on Aura network then local call logs will be provided by the Client SDK.

Adding new call log items

If any new call log items have been added, your application will be notified via onCallLogServiceCallLogItemsAdded().

@Override
// implementation of the CallLogServiceListener
public void onCallLogServiceCallLogItemsAdded(CallLogService callLogService, 
    List list) {
        callLogItems = callLogService.getCallLogs();

        // Update UI elements
    }

Resynchronizing call log items

The onCallLogServiceCallLogItemsResynchronized() callback is called to indicate resynchronization of call log items from the persistent data source. The data set is resynchronized. Replace existing data with new one.

@Override
// implementation of the CallLogServiceListener
public void onCallLogServiceCallLogItemsResynchronized(CallLogService 
    callLogService, List list) {
        callLogItems = callLogService.getCallLogs();

        // Update UI elements
    }

Removing call log items

CallLogServiceListener provides the onCallLogServiceCallLogItemsRemoved() notification that can be used to report removal of call log items. This notification indicates that one or more call log items have been successfully removed.

@Override
// implementation of the CallLogServiceListener
public void onCallLogServiceCallLogItemsRemoved(CallLogService callLogService, 
    List list) {
        callLogItems = callLogService.getCallLogs();

        // Update UI elements
    }

Updating call log items

The onCallLogServiceCallLogItemsUpdated() callback is called to indicate which call log items have been updated. This callback can be used to indicate the update of one or more call log items.

@Override
// implementation of the CallLogServiceListener
public void onCallLogServiceCallLogItemsUpdated(CallLogService callLogService, 
    List list) {
        callLogItems = callLogService.getCallLogs();

        // Update UI elements
    }

Creating call logs from specified parameters

Instead of creating a new call log due to call ending, you can create call logs immediately at any moment using specified parameters. You can create new CallLogItem as follows:

CallLogItem callLogItem = callLogService.createCallLogItem(remoteNumber, 
    localUserName, sessionSubject, startTime, endTime, sourceType, 
    actionType, isConference, isIgnored, isCallerIdPrivate, 
    callLogParticipants, callEvents, properties);

Call records and call events

A CallRecord instance is associated with the API level CallLogItem instance. The CallRecord object is a data-only object with no actionable methods on it. CallLogItem contains a CallRecord and uses it internally. But it also exposes its own methods to access to the data stored in the corresponding CCallRecord instance. In addition, CallLogItem provides supplementary details such as associated contact info, that are not available to CallRecord.

Call log data is only useful to the client if it is capable of providing a full historical view of the call. To achieve this goal, a call log object must be able to convey all transactions associated with the call from the point it is dialed out to the point it is ended. For example, a call that is created as a point-to-point call, does not necessarily end as a point-to-point call. Such call may be escalated to a CM conference as the 3rd endpoint joined the call. Then it may be de-escalated back to a point-to-point call when one of three people on the CM conference left the call. To facilitate complex transitions of a call, the Call object keeps track of events that mark call transition points.

In the Client SDK, these events are captured in the call event list as independent call event items. When a call is ended, CallLogService takes this call event list and processes it onto the CallLogItem type objects. The very first call event received from the Call object is captured as the top level call log dataset. Subsequent call events are captured in the call events list contained in CallLogItem.

To obtain a full historical view of the call, you can use the GetCallEvents() method of the CallLogItem object.