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.
val callLogRequest = CallLogRequest.CallLogRequestBuilder()
    .setLimit(30)
    .build()

callLogRequest.fetchNext(object : CometChatCalls.CallbackListener<List<CallLog>>() {
    override fun onSuccess(callLogs: List<CallLog>) {
        for (callLog in callLogs) {
            Log.d(TAG, "Session: ${callLog.sessionID}")
            Log.d(TAG, "Duration: ${callLog.totalDuration}")
            Log.d(TAG, "Status: ${callLog.status}")
        }
    }

    override fun onError(e: CometChatException) {
        Log.e(TAG, "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(boolean)booleanFilter 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
val videoCallsRequest = CallLogRequest.CallLogRequestBuilder()
    .setSessionType("video")
    .setLimit(20)
    .build()

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

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

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

Pagination

Use fetchNext() and fetchPrevious() for pagination:
// Fetch next page
callLogRequest.fetchNext(object : CometChatCalls.CallbackListener<List<CallLog>>() {
    override fun onSuccess(callLogs: List<CallLog>) {
        // Handle next page
    }

    override fun onError(e: CometChatException) {
        Log.e(TAG, "Error: ${e.message}")
    }
})

// Fetch previous page
callLogRequest.fetchPrevious(object : CometChatCalls.CallbackListener<List<CallLog>>() {
    override fun onSuccess(callLogs: List<CallLog>) {
        // Handle previous page
    }

    override fun onError(e: CometChatException) {
        Log.e(TAG, "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
initiatedAtlongTimestamp when call was initiated
endedAtlongTimestamp when call ended
totalDurationStringHuman-readable duration (e.g., “5:30”)
totalDurationInMinutesdoubleDuration in minutes
totalAudioMinutesdoubleAudio duration in minutes
totalVideoMinutesdoubleVideo duration in minutes
totalParticipantsintNumber of participants
hasRecordingbooleanWhether 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(object : CometChatCalls.CallbackListener<List<CallLog>>() {
    override fun onSuccess(callLogs: List<CallLog>) {
        for (callLog in callLogs) {
            if (callLog.isHasRecording) {
                callLog.recordings?.forEach { recording ->
                    Log.d(TAG, "Recording ID: ${recording.rid}")
                    Log.d(TAG, "Recording URL: ${recording.recordingURL}")
                    Log.d(TAG, "Duration: ${recording.duration} seconds")
                }
            }
        }
    }

    override fun onError(e: CometChatException) {
        Log.e(TAG, "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