Skip to main content
// Fetch call logs
let request = new CometChatCalls.CallLogRequestBuilder()
  .setLimit(30)
  .setAuthToken(loggedInUser.getAuthToken())
  .setCallCategory("call")
  .build();

let logs = await request.fetchNext();

// Get details for a specific call session
let details = await CometChatCalls.getCallDetails("SESSION_ID", authToken);
Filters: setCallType(), setCallStatus(), setCallCategory(), setCallDirection(), setHasRecording(), setUid(), setGuid()

Overview

Retrieve and display call history including duration, participants, status, and recording information.

Fetching Call Logs

Use CallLogRequestBuilder to fetch and filter call logs:
let callLogRequestBuilder = new CometChatCalls.CallLogRequestBuilder()
        .setLimit(30)
        .setAuthToken(loggedInUser.getAuthToken())
        .setCallCategory("call")
        .build()

Builder Settings

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

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

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);
  });
The fetchNext() and fetchPrevious() methods return an array of Call log objects. Access the response data using getter methods:
FieldGetterReturn TypeDescription
sessionIdgetSessionId()stringUnique session ID for the call
callInitiatorgetCallInitiator()UserThe user who initiated the call
callReceivergetCallReceiver()User | GroupThe user or group that received the call
actiongetAction()stringCall action/status
initiatedAtgetInitiatedAt()numberTimestamp when the call was initiated
joinedAtgetJoinedAt()numberTimestamp when the user joined the call

Get Call Details

Retrieve details for a specific call session using getCallDetails():
const sessionID = "SESSION_ID";
CometChatCalls.getCallDetails(sessionID, authToken).then(
  (callLogs) => {
    console.log("Call details:", callLogs);
  },
  (error) => {
    console.log("Error fetching call details:", error);
  }
);
Note: Replace "SESSION_ID" with the ID of the session you are interested in.

Next Steps

Default Calling

Implement the complete ringing call flow

Recording

Record audio and video calls

Direct Calling

Start call sessions without the ringing flow

Calling Setup

Install and initialize the Calls SDK