Skip to main content
Version: v4

Call Logs

Overview

CometChat's Web Call SDK provides a comprehensive way to integrate call logs into your application, enhancing your user experience by allowing users to effortlessly keep track of their communication history. Call logs provide crucial information such as call duration, participants, and more.

This feature not only allows users to review their past interactions but it also serves as an effective tool to revisit important conversation details. With the flexibility of fetching call logs, filtering them according to specific parameters, and obtaining detailed information of individual calls, application developers can use this feature to build a more robust and interactive communication framework.

In the following sections, we will guide you through the process of working with call logs, offering a deeper insight into how to optimally use this feature in your Web application.

Fetching Call Logs

To fetch all call logs in your 23b application, you should use the CallLogRequestBuilder, This builder allows you to customize the call logs fetching process according to your needs.

let callLogRequestBuilder = new CometChatCalls.CallLogRequestBuilder()
.setLimit(30)
.setAuthToken(loggedInUser.getAuthToken())
.setCallCategory("call")
.build()

CallLogRequestBuilder has the following settings available.

SettingDescription
setLimit(limit: number)Specifies the number of call logs to fetch.
setCallType(callType: 'video' or 'audio')Sets the type of calls to fetch (call or meet).
setCallStatus(callStatus: 'ongoing' or 'busy' or 'rejected' or 'cancelled' or 'ended' or 'missed')Sets the status of calls to fetch (initiated, ongoing, etc.)
setHasRecording(hasRecording: boolean) Sets whether to fetch calls that have recordings.
setCallCategory(callCategory: 'call' or 'meet')Sets the category of calls to fetch (call or meet).
setCallDirection(callDirection: 'incoming' or 'outgoing')Sets the direction of calls to fetch (incoming or outgoing)
setUid(uid: string) Sets the UID of the user whose call logs to fetch.
setGuid(guid: string)Sets the GUID of the user whose call logs to fetch.
setAuthToken(authToken: string)Sets the Auth token of the logged-in user.

Fetch Next

The fetchNext() method retrieves the next set of call logs.

let callLogRequestBuilder = new CometChatCalls.CallLogRequestBuilder()
.setLimit(30)
.setAuthToken(loggedInUser.getAuthToken())
.setCallCategory("call")
.build()

callLogRequestBuilder.fetchNext()
.then(callLogHistory => {
console.log(callLogHistory);
})
.catch(err => {
console.log(err);
});

Fetch Previous

The fetchPrevious() method retrieves the previous set of call logs.

let callLogRequestBuilder = new CometChatCalls.CallLogRequestBuilder()
.setLimit(30)
.setAuthToken(loggedInUser.getAuthToken())
.setCallCategory("call")
.build()

callLogRequestBuilder.fetchPrevious()
.then(callLogHistory => {
console.log(callLogHistory);
})
.catch(err => {
console.log(err);
});

Get Call Details

To retrieve the specific details of a call, use the getCallDetails() method. This method requires the Auth token of the logged-in user and the session ID along with a callback listener.

var sessionID = "SESSION_ID";
CometChatCalls.getCallDetails(sessionID, authToken)
.then((callLogs: Array<CallLog>) => {
console.log(callLogs);
})
.catch(err => {
console.log(err);
});

Note: Replace "SESSION_ID" with the ID of the session you are interested in.