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 IP Office Call logs are supported. Local call logs do not record events when a user is logged off, and no call logs will be captured. IP Office call logs will record network calls when the user is logged in or logged out. Each call record is represented by the CSCallLogItem object. This object provides several attributes such as call start time, remote address, call duration, call count, call tag, read status etc.

Initializing and Configuring the CallLogService

The Client SDK provides call log services through the CSCallLogService 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. 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.

NSURL *basePath = basePathsArray[0];
NSURL *callLogFilePath = [basePath URLByAppendingPathComponent:[NSString
    stringWithFormat:@"CallLog-%@.xml", self.sipUsername]];

userConfiguration.localCallLogFilePath = callLogFilePath;

The CSUserConfiguration 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 CSCallLogService object is obtained from the Client SDK CSUser object. Start by obtaining the instance of the Client SDK CSCallLogService.

CSCallLogService *callLogService = nil;
for (CSUser *user in [SDKManager getInstance].users) {
    if (user.callLogService) {
        callLogService = user.callLogService;
        break;
    }
}

NSArray *logItems = callLogService.callLogs;

To monitor call log events, you need to use the <CSCallLogServiceDelegate>.

#import "SDKManager.h"
#import 
#import "ClientCredentialProvider.h"
#import "ConfigData.h"
#import "NotificationHelper.h"

@interface SDKManager()

Adding new call log items

If any new call log items have been added, your application will be notified via didAddCallLogs callback.

- (void)callLogService:(CSCallLogService *)callLogService
    didAddCallLogs:(NSArray *)addedCallLogItemsArray {

        // some logic
}

Removing call log items

The didRemoveCallLogs notification is used to report removal of call log items. This notification indicates that one or more call log items have been successfully removed.

- (void)callLogService:(CSCallLogService *)callLogService 
    didRemoveCallLogs:(NSArray *)removedCallLogItemsArray {

        // some logic
}

Updating call log items

The didUpdateCallLogs notification is used 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.

- (void)callLogService:(CSCallLogService *)callLogService 
    didUpdateCallLogs:(NSArray *)updatedCallLogItemsArray {

        // some logic
}

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. Then you can add new items using the addCallLogsWithArray method.

CSCallLogItem *callLogItem = [[CSCallLogItem alloc]
    initWithRemoteNumber:initWithRemoteNumber localUserName:localUserName 
    sessionSubject:sessionSubject startTime:startTime endTime:endTime 
    durationInSeconds:durationInSeconds sourceType:sourceType 
    actionType:actionType isConference:false isIgnored:false 
    isCallerIdPrivate:false callLogParticipants:remoteParticipants 
    callEvents:callEvents properties:properties];

[itemsToAdd addObject:callLogItem];

[callLogService addCallLogsWithArray:itemsToAddwithCompletionHandler:^
    (NSError *error) {
        if (error) {
            LOG_ERROR(@"Add call logs failed with error: %@", error);
        }
        else {
            LOG_MESSAGE(@"Add call logs suceeeded");
        }
    }];

Call records and call events

A CallRecord instance is associated with the API level CSCallLogService instance. The CallRecord object is a data-only object with no actionable methods on it. CSCallLogService 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, CSCallLogService 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 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 conference left the call. To facilitate complex transitions of a call, the CSCall 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, CSCallLogService takes this call event list and processes it onto the CSCallLogService type objects. The very first call event received from the CSCall object is captured as the top level call log dataset. Subsequent call events are captured in the call events list contained in CSCallLogService.

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