Skip to main content
Quick Reference - Fetch call logs:
const loggedInUser = await CometChat.getLoggedinUser();

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

const callLogs = await callLogRequest.fetchNext();
Available via: SDK | REST API | UI Kits

Overview

CometChat’s React Native 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 React Native application.

Fetching Call Logs

To fetch all call logs in your React Native 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);
  });
On SuccessfetchNext() returns an array of CallLog objects:CallLog Array:
ParameterTypeDescriptionSample Value
(array)arrayArray of call log objectsSee below ↓
CallLog Object (each item in array):
ParameterTypeDescriptionSample Value
sessionIdstringUnique session identifier"v1.in.2748663902141719.1772100619..."
totalAudioMinutesnumberTotal audio duration in minutes7.65
totalVideoMinutesnumberTotal video duration in minutes0
totalDurationstringFormatted total duration"00:07:39"
totalDurationInMinutesnumberTotal duration in minutes7.65
hasRecordingbooleanWhether call has recordingstrue
initiatedAtnumberUnix timestamp when call was initiated1772100619
startedAtnumberUnix timestamp when call started1772100622
endedAtnumberUnix timestamp when call ended1772101081
initiatorobjectUser who initiated the callSee below ↓
receiverobjectUser who received the callSee below ↓
modestringCall mode"call"
receiverTypestringType of receiver"user"
statusstringCall status"ended"
totalParticipantsnumberTotal number of participants2
typestringType of call"audio"
midstringMessage ID"21d6e797-1b44-4a70-be73-d915dba206c7"
participantsarrayList of call participantsSee below ↓
recordingsarrayList of recordingsSee below ↓
dataobjectAdditional call dataSee below ↓

initiator Object:
ParameterTypeDescriptionSample Value
uidstringUnique user identifier"cometchat-uid-7"
namestringDisplay name of the user"Henry Marino"
avatarstringURL to user’s avatar image"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"

receiver Object:
ParameterTypeDescriptionSample Value
uidstringUnique user identifier"cometchat-uid-6"
namestringDisplay name of the user"Ronald Jerry"
avatarstringURL to user’s avatar image"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"

participants Array:
ParameterTypeDescriptionSample Value
(array)arrayArray of participant objectsSee below ↓
Participant Object (each item in array):
ParameterTypeDescriptionSample Value
uidstringUnique user identifier"cometchat-uid-6"
namestringDisplay name of the user"Ronald Jerry"
avatarstringURL to user’s avatar image"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"
totalAudioMinutesnumberUser’s audio duration in minutes7.65
totalVideoMinutesnumberUser’s video duration in minutes0
totalDurationInMinutesnumberUser’s total duration in minutes7.65
isJoinedbooleanWhether user joined the calltrue
statestringParticipant state"ended"
deviceIdstringDevice identifier"2b1d0b90-b6b9-4c1c-9899-9bf4effe549f@..."
joinedAtnumberUnix timestamp when user joined1772100622
leftAtnumberUnix timestamp when user left1772101081
midstringMessage ID"21d6e797-1b44-4a70-be73-d915dba206c7"

recordings Array:
ParameterTypeDescriptionSample Value
(array)arrayArray of recording objectsSee below ↓
Recording Object (each item in array):
ParameterTypeDescriptionSample Value
ridstringRecording ID"noujausedimwfhwl"
recording_urlstringURL to download the recording"https://recordings-in.cometchat.io/..."
durationnumberRecording duration in minutes1.045
startTimenumberUnix timestamp when recording started1772100632
endTimenumberUnix timestamp when recording ended1772100634

data Object:
ParameterTypeDescriptionSample Value
entitiesobjectEntity details for the callSee below ↓
data.entities Object:
ParameterTypeDescriptionSample Value
initiatorobjectInitiator entity wrapperSee below ↓
receiverobjectReceiver entity wrapperSee below ↓
data.entities.initiator Object:
ParameterTypeDescriptionSample Value
entityobjectUser entity details{"uid": "cometchat-uid-7", "name": "Henry Marino", "avatar": "..."}
data.entities.receiver Object:
ParameterTypeDescriptionSample Value
entityobjectUser entity details{"uid": "cometchat-uid-6", "name": "Ronald Jerry", "avatar": "..."}

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);
  });
On SuccessfetchPrevious() returns an array of CallLog objects with the same structure as fetchNext(). See fetchNext Response for the complete object structure.

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);
  });
On SuccessgetCallDetails() returns an array of CallLog objects with the same structure as fetchNext(). See fetchNext Response for the complete object structure.
Replace "SESSION_ID" with the ID of the session you are interested in.

Best Practices

Always use fetchNext() with a reasonable setLimit() value (e.g., 20-30) rather than fetching all logs at once. This improves performance and reduces memory usage, especially for users with extensive call histories.
Use the builder’s filter methods (setCallType, setCallStatus, setCallDirection) to fetch only the logs relevant to your current UI view. For example, show only missed calls in a “Missed” tab rather than filtering client-side.
Consider caching fetched call logs locally to reduce API calls and improve load times. Use fetchNext() to load newer logs and fetchPrevious() for older ones as the user scrolls.

Troubleshooting

Verify that the authToken passed to setAuthToken() is valid and belongs to the logged-in user. Also check that calls have actually been made — call logs are only generated after a call session completes.
Ensure you’re reusing the same callLogRequestBuilder instance for pagination. Creating a new builder resets the cursor, causing the same page to be fetched repeatedly.
Confirm the sessionID is correct and corresponds to a completed call. Active or in-progress calls may not have full details available yet.

Next Steps