Skip to main content
Retrieve call history for your application. Call logs provide detailed information about past calls including duration, participants, recordings, and status.

Fetch Call Logs

Use CallLogRequest to fetch call logs with pagination support. The builder pattern allows you to filter results by various criteria.
CallLogRequest callLogRequest = CallLogRequest.CallLogRequestBuilder()
    .setLimit(30)
    .build();

callLogRequest.fetchNext(
  onSuccess: (List<CallLog> callLogs) {
    for (CallLog callLog in callLogs) {
      debugPrint("Session: ${callLog.sessionID}");
      debugPrint("Duration: ${callLog.totalDuration}");
      debugPrint("Status: ${callLog.status}");
    }
  },
  onError: (CometChatCallsException e) {
    debugPrint("Error: ${e.message}");
  },
);

CallLogRequestBuilder

Configure the request using the builder methods:
MethodTypeDescription
setLimit(int)intNumber of call logs to fetch per request (default: 30, max: 100)
setSessionType(String)StringFilter by call type: video or audio
setCallStatus(String)StringFilter by call status
setHasRecording(bool)boolFilter calls that have recordings
setCallCategory(String)StringFilter by category: call or meet
setCallDirection(String)StringFilter by direction: incoming or outgoing
setUid(String)StringFilter calls with a specific user
setGuid(String)StringFilter calls with a specific group

Filter Examples

// Fetch only video calls
CallLogRequest videoCallsRequest = CallLogRequest.CallLogRequestBuilder()
    .setSessionType("video")
    .setLimit(20)
    .build();

// Fetch calls with recordings
CallLogRequest recordedCallsRequest = CallLogRequest.CallLogRequestBuilder()
    .setHasRecording(true)
    .build();

// Fetch missed incoming calls
CallLogRequest missedCallsRequest = CallLogRequest.CallLogRequestBuilder()
    .setCallStatus("missed")
    .setCallDirection("incoming")
    .build();

// Fetch calls with a specific user
CallLogRequest userCallsRequest = CallLogRequest.CallLogRequestBuilder()
    .setUid("user_id")
    .build();

Pagination

Use fetchNext() and fetchPrevious() for pagination:
// Fetch next page
callLogRequest.fetchNext(
  onSuccess: (List<CallLog> callLogs) {
    // Handle next page
  },
  onError: (CometChatCallsException e) {
    debugPrint("Error: ${e.message}");
  },
);

// Fetch previous page
callLogRequest.fetchPrevious(
  onSuccess: (List<CallLog> callLogs) {
    // Handle previous page
  },
  onError: (CometChatCallsException e) {
    debugPrint("Error: ${e.message}");
  },
);

CallLog Object

Each CallLog object contains detailed information about a call:
PropertyTypeDescription
sessionIDStringUnique identifier for the call session
initiatorCallEntityUser who initiated the call
receiverCallEntityUser or group that received the call
receiverTypeStringuser or group
typeStringCall type: video or audio
statusStringFinal status of the call
callCategoryStringCategory: call or meet
initiatedAtintTimestamp when call was initiated
endedAtintTimestamp when call ended
totalDurationStringHuman-readable duration (e.g., “5:30”)
totalDurationInMinutesdoubleDuration in minutes
totalAudioMinutesdoubleAudio duration in minutes
totalVideoMinutesdoubleVideo duration in minutes
totalParticipantsintNumber of participants
hasRecordingboolWhether the call was recorded
recordingsList<Recording>List of recording objects
participantInfoListList<ParticipantInfo>List of participant details

Access Recordings

If a call has recordings, access them through the recordings property:
callLogRequest.fetchNext(
  onSuccess: (List<CallLog> callLogs) {
    for (CallLog callLog in callLogs) {
      if (callLog.hasRecording == true) {
        callLog.recordings?.forEach((recording) {
          debugPrint("Recording ID: ${recording.rid}");
          debugPrint("Recording URL: ${recording.recordingURL}");
          debugPrint("Duration: ${recording.duration} seconds");
        });
      }
    }
  },
  onError: (CometChatCallsException e) {
    debugPrint("Error: ${e.message}");
  },
);
StatusDescription
ongoingCall is currently in progress
busyReceiver was busy
rejectedCall was rejected
cancelledCall was cancelled by initiator
endedCall ended normally
missedCall was missed
initiatedCall was initiated but not answered
unansweredCall was not answered
CategoryDescription
callDirect call between users
meetMeeting/conference call
DirectionDescription
incomingCall received by the user
outgoingCall initiated by the user