Skip to main content
Quick Reference for AI Agents & Developers
  • Build request: CometChatCallsSDK.CallLogsRequest.CallLogsBuilder().set(limit:).build()
  • Fetch logs: callLogsRequest.fetchNext(onSuccess:onError:)
  • Filters: .set(callType:), .set(callStatus:), .set(hasRecording:), .set(callDirection:)
  • Call details: CometChat.getCallDetails(sessionID:onSuccess:onError:)
  • Related: Ringing · Call Session · Calling Overview

Overview

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

Fetching Call Logs

To fetch all call logs in your iOS application, you should use the CallLogRequestBuilder, This builder allows you to customize the call logs fetching process according to your needs.
var callLogRequest = CometChatCallsSDK.CallLogsRequest.CallLogsBuilder()
    .set(authToken: CometChat.getUserAuthToken())
    .set(limit: 30)
    .set(callCategory: .call)
    .build()
Builder Configuration:
ParameterTypeDescription
authTokenStringLogged-in user’s authentication token. Example: "cometchat-uid-2_177010263828e3f97e747c568b2e22e600141afe"
limitIntNumber of call logs to fetch per request. Example: 30
callCategoryCallCategoryCategory filter for calls. Example: .call
Built CallLogsRequest Object:
ParameterTypeDescription
authTokenStringAuthentication token for API requests
limitIntMaximum results per page. Example: 30
callCategoryCallCategoryFilter category. Example: .call
cursorString?Pagination cursor. Example: nil (initial request)
CallLogRequestBuilder has the following settings available.
SettingDescription
set(limit: Int)Specifies the number of call logs to fetch.
set(callType: CallType)Sets the type of calls to fetch (call or meet).
set(callStatus: CallStatus)Sets the status of calls to fetch (initiated, ongoing, etc.)
setg(hasRecording: HasRecording)Sets whether to fetch calls that have recordings.
set(callCategory: CallCategory)Sets the category of calls to fetch (call or meet).
set(callDirection: CallDirection)Sets the direction of calls to fetch (incoming or outgoing)
set(uid: String)Sets the UID of the user whose call logs to fetch.
set(guid: String)Sets the GUID of the user whose call logs to fetch.
set(authToken: String)Sets the Auth token of the logged-in user.
CallLogsBuilder Methods:
MethodTypeDescription
set(limit: Int)IntNumber of logs to fetch per request. Example: 30
set(callType: CallType)CallTypeFilter by call type. Example: .audio or .video
set(callStatus: CallStatus)CallStatusFilter by call status. Example: .initiated, .ongoing, .ended
set(hasRecording: Bool)BoolFilter by recording availability. Example: true
set(callCategory: CallCategory)CallCategoryFilter by category. Example: .call or .meet
set(callDirection: CallDirection)CallDirectionFilter by direction. Example: .incoming or .outgoing
set(uid: String)StringFilter by user UID. Example: "cometchat-uid-2"
set(guid: String)StringFilter by group GUID. Example: "cometchat-guid-1"
set(authToken: String)StringLogged-in user’s auth token. Example: "cometchat-uid-2_177010263828e3..."
CallType Enum Values:
ValueDescription
.audioAudio-only call
.videoVideo call
CallStatus Enum Values:
ValueDescription
.initiatedCall has been initiated
.ongoingCall is currently in progress
.unansweredCall was not answered
.rejectedCall was rejected by receiver
.busyReceiver was busy
.cancelledCall was cancelled by initiator
.endedCall has ended normally
CallCategory Enum Values:
ValueDescription
.callRegular one-to-one or group call
.meetScheduled meeting
CallDirection Enum Values:
ValueDescription
.incomingIncoming call to the user
.outgoingOutgoing call from the user

Fetch Next

The**fetchNext()**method retrieves the next set of call logs.
var callLogRequest = CometChatCallsSDK.CallLogsRequest.CallLogsBuilder()
    .set(authToken: CometChat.getUserAuthToken())
    .set(limit: 30)
    .set(callCategory: .call)
    .build()

callLogRequest.fetchNext() { [weak self] callLogs in
        print("fetchNext success")
    } onError: { [weak self] error in
        print("fetchNext failed with error; \(error.errorDescription)")
}
HTTP Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls
MethodGET
Query Parameters:
ParameterTypeDescription
modeStringCall category filter. Example: "call"
pageIntPage number for pagination. Example: 1
perPageIntResults per page. Example: 30
Request Headers:
HeaderTypeDescription
authTokenStringUser authentication token. Example: "cometchat-uid-2_177010263828e3f97e747c568b2e22e600141afe"
appIdStringCometChat application ID. Example: "279557705a948ad6"
sdkStringSDK identifier. Example: "ios@v3.0"
Success Callback Parameter:
ParameterTypeDescription
callLogs[CallLog]Array of CallLog objects. See CallLog Object below
CallLog Object:
ParameterTypeDescription
sessionIdStringUnique call session identifier. Example: "v1.us.12345678901234567890"
initiatorInitiatorUser who initiated the call. See Initiator Object below
receiverReceiverUser/Group who received the call. See Receiver Object below
callTypeStringType of call. Example: "video" or "audio"
callStatusStringFinal status of call. Example: "ended"
callDirectionStringDirection relative to logged-in user. Example: "outgoing"
startedAtIntUnix timestamp when call started. Example: 1699900000
endedAtIntUnix timestamp when call ended. Example: 1699900300
durationIntCall duration in seconds. Example: 300
hasRecordingBoolWhether call has recording. Example: true
recordings[Recording]?Array of recordings if available. See Recording Object below
Initiator Object:
ParameterTypeDescription
uidStringInitiator’s unique ID. Example: "user1"
nameStringInitiator’s display name. Example: "John Doe"
avatarString?Initiator’s avatar URL. Example: "https://example.com/avatar.png"
statusStringOnline status. Example: "online"
roleStringUser role. Example: "default"
Receiver Object (User):
ParameterTypeDescription
uidStringReceiver’s unique ID. Example: "user2"
nameStringReceiver’s display name. Example: "Jane Smith"
avatarString?Receiver’s avatar URL. Example: "https://example.com/avatar2.png"
statusStringOnline status. Example: "offline"
roleStringUser role. Example: "default"
Receiver Object (Group):
ParameterTypeDescription
guidStringGroup’s unique ID. Example: "cometchat-guid-1"
nameStringGroup’s display name. Example: "Development Team"
iconString?Group’s icon URL. Example: "https://example.com/group.png"
typeStringGroup type. Example: "public"
membersCountIntNumber of members. Example: 15
Recording Object:
ParameterTypeDescription
ridStringRecording ID. Example: "rec_abc123"
recordingUrlStringURL to download recording. Example: "https://storage.cometchat.io/recordings/..."
startedAtIntRecording start timestamp. Example: 1699900010
endedAtIntRecording end timestamp. Example: 1699900290
durationIntRecording duration in seconds. Example: 280
Error Callback Parameter:
ParameterTypeDescription
errorCometChatExceptionError object with details
error.errorCodeStringError code. Example: "AUTH_ERR"
error.errorDescriptionStringHuman-readable error message

Fetch Previous

The**fetchPrevious()**method retrieves the previous set of call logs.
var callLogRequest = CometChatCallsSDK.CallLogsRequest.CallLogsBuilder()
    .set(authToken: CometChat.getUserAuthToken())
    .set(limit: 30)
    .set(callCategory: .call)
    .build()

callLogRequest.fetchPrevious() { [weak self] callLogs in
    print("fetchPrevious success")
} onError: { [weak self] error in
    print("fetchNext failed with error; \(error.errorDescription)")
}
HTTP Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls
MethodGET
Query Parameters:
ParameterTypeDescription
modeStringCall category filter. Example: "call"
pageIntPrevious page number. Example: 0
perPageIntResults per page. Example: 30
Request Headers:
HeaderTypeDescription
authTokenStringUser authentication token. Example: "cometchat-uid-2_177010263828e3f97e747c568b2e22e600141afe"
appIdStringCometChat application ID. Example: "279557705a948ad6"
sdkStringSDK identifier. Example: "ios@v3.0"
Success Callback Parameter:
ParameterTypeDescription
callLogs[CallLog]Array of CallLog objects. See CallLog Object above
Note: Returns empty array [] if no previous logs exist.Error Callback Parameter:
ParameterTypeDescription
errorCometChatExceptionError object with details
error.errorCodeStringError code. Example: "AUTH_ERR"
error.errorDescriptionStringHuman-readable error message

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 success and error callback. Upon success, this function will return a list of call details, as multiple calls can be initiated for one session ID.
var sessionID = "SESSION_ID";
CometChatCalls.getCallDetail(authToken: CometChat.getUserAuthToken(), sessionID: sessionID) { callLogs in
  // Handle the fetched call details
} onError: { error in
    // Handle the error
}
Method Parameters:
ParameterTypeDescription
authTokenStringLogged-in user’s authentication token. Example: "cometchat-uid-2_177010263828e3f97e747c568b2e22e600141afe"
sessionIDStringCall session ID to fetch details for. Example: "v1.us.12345678901234567890"
HTTP Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls/{sessionID}
MethodGET
Request Headers:
HeaderTypeDescription
authTokenStringUser authentication token
appIdStringCometChat application ID
sdkStringSDK identifier. Example: "ios@v3.0"
Success Callback Parameter:
ParameterTypeDescription
callLogs[CallLog]Array of CallLog objects (multiple calls can share same session ID). See CallLog Object below
CallLog Object (Detailed):
ParameterTypeDescription
sessionIdStringUnique call session identifier. Example: "v1.us.12345678901234567890"
initiatorInitiatorUser who initiated the call. See Initiator Object below
receiverReceiverUser/Group who received the call. See Receiver Object below
callTypeStringType of call. Example: "video"
callStatusStringFinal status of call. Example: "ended"
callDirectionStringDirection relative to logged-in user. Example: "outgoing"
startedAtIntUnix timestamp when call started. Example: 1699900000
endedAtIntUnix timestamp when call ended. Example: 1699900300
durationIntCall duration in seconds. Example: 300
hasRecordingBoolWhether call has recording. Example: true
recordings[Recording]?Array of recordings. See Recording Object below
participants[Participant]?Array of call participants. See Participant Object below
Initiator Object:
ParameterTypeDescription
uidStringInitiator’s unique ID. Example: "user1"
nameStringInitiator’s display name. Example: "John Doe"
avatarString?Initiator’s avatar URL. Example: "https://example.com/avatar.png"
statusStringOnline status. Example: "online"
roleStringUser role. Example: "default"
lastActiveAtIntLast active timestamp. Example: 1699899000
Receiver Object:
ParameterTypeDescription
uidStringReceiver’s unique ID. Example: "user2"
nameStringReceiver’s display name. Example: "Jane Smith"
avatarString?Receiver’s avatar URL. Example: "https://example.com/avatar2.png"
statusStringOnline status. Example: "offline"
roleStringUser role. Example: "default"
Recording Object:
ParameterTypeDescription
ridStringRecording ID. Example: "rec_abc123"
recordingUrlStringURL to download recording. Example: "https://storage.cometchat.io/recordings/..."
startedAtIntRecording start timestamp. Example: 1699900010
endedAtIntRecording end timestamp. Example: 1699900290
durationIntRecording duration in seconds. Example: 280
Participant Object:
ParameterTypeDescription
uidStringParticipant’s unique ID. Example: "user1"
nameStringParticipant’s display name. Example: "John Doe"
avatarString?Participant’s avatar URL
joinedAtIntTimestamp when participant joined. Example: 1699900005
leftAtIntTimestamp when participant left. Example: 1699900295
totalDurationIntTotal time in call (seconds). Example: 290
Error Callback Parameter:
ParameterTypeDescription
errorCometChatExceptionError object with details
error.errorCodeStringError code. Example: "SESSION_NOT_FOUND"
error.errorDescriptionStringHuman-readable error message
Note: Replace**"SESSION_ID"**with the ID of the session you are interested in.

Filter Examples

The following examples demonstrate how to use various filters with the CallLogsBuilder.

Filter by Call Type

var callLogRequest = CometChatCallsSDK.CallLogsRequest.CallLogsBuilder()
    .set(authToken: CometChat.getUserAuthToken())
    .set(limit: 30)
    .set(callType: .audio)
    .build()
Audio Calls Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls?page=1&type=audio&perPage=30
MethodGET
Query Parameters (Audio):
ParameterTypeDescription
pageIntPage number. Example: 1
typeStringCall type filter. Example: "audio"
perPageIntResults per page. Example: 30
Video Calls Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls?page=1&type=video&perPage=30
MethodGET
Query Parameters (Video):
ParameterTypeDescription
pageIntPage number. Example: 1
typeStringCall type filter. Example: "video"
perPageIntResults per page. Example: 30
Request Headers:
HeaderTypeDescription
authTokenStringUser authentication token
appIdStringCometChat application ID. Example: "279557705a948ad6"
sdkStringSDK identifier. Example: "ios@v3.0"

Filter by Call Direction

var callLogRequest = CometChatCallsSDK.CallLogsRequest.CallLogsBuilder()
    .set(authToken: CometChat.getUserAuthToken())
    .set(limit: 30)
    .set(callDirection: .incoming)
    .build()
Incoming Calls Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls?direction=incoming&page=1&perPage=30
MethodGET
Query Parameters (Incoming):
ParameterTypeDescription
directionStringDirection filter. Example: "incoming"
pageIntPage number. Example: 1
perPageIntResults per page. Example: 30
Outgoing Calls Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls?page=1&perPage=30&direction=outgoing
MethodGET
Query Parameters (Outgoing):
ParameterTypeDescription
directionStringDirection filter. Example: "outgoing"
pageIntPage number. Example: 1
perPageIntResults per page. Example: 30
Request Headers:
HeaderTypeDescription
authTokenStringUser authentication token
appIdStringCometChat application ID. Example: "279557705a948ad6"
sdkStringSDK identifier. Example: "ios@v3.0"

Filter by Recording Status

var callLogRequest = CometChatCallsSDK.CallLogsRequest.CallLogsBuilder()
    .set(authToken: CometChat.getUserAuthToken())
    .set(limit: 30)
    .set(hasRecording: true)
    .build()
With Recording Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls?hasRecording=1&page=1&perPage=30
MethodGET
Query Parameters (With Recording):
ParameterTypeDescription
hasRecordingIntRecording filter (1 = true). Example: 1
pageIntPage number. Example: 1
perPageIntResults per page. Example: 30
Without Recording Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls?page=1&perPage=30
MethodGET
Query Parameters (Without Recording):
ParameterTypeDescription
pageIntPage number. Example: 1
perPageIntResults per page. Example: 30
Note: When hasRecording is false, the parameter is omitted from the request.Request Headers:
HeaderTypeDescription
authTokenStringUser authentication token
appIdStringCometChat application ID. Example: "279557705a948ad6"
sdkStringSDK identifier. Example: "ios@v3.0"

Filter by User

var callLogRequest = CometChatCallsSDK.CallLogsRequest.CallLogsBuilder()
    .set(authToken: CometChat.getUserAuthToken())
    .set(limit: 30)
    .set(uid: "cometchat-uid-2")
    .build()
HTTP Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls?page=1&uid=cometchat-uid-2&perPage=30
MethodGET
Query Parameters:
ParameterTypeDescription
pageIntPage number. Example: 1
uidStringUser UID filter. Example: "cometchat-uid-2"
perPageIntResults per page. Example: 30
Request Headers:
HeaderTypeDescription
authTokenStringUser authentication token
appIdStringCometChat application ID. Example: "279557705a948ad6"
sdkStringSDK identifier. Example: "ios@v3.0"
Response:
ParameterTypeDescription
callLogs[CallLog]Array of call logs involving the specified user. See CallLog Object

Filter by Group

var callLogRequest = CometChatCallsSDK.CallLogsRequest.CallLogsBuilder()
    .set(authToken: CometChat.getUserAuthToken())
    .set(limit: 30)
    .set(guid: "cometchat-guid-1")
    .build()
HTTP Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls?page=1&guid=cometchat-guid-1&perPage=30
MethodGET
Query Parameters:
ParameterTypeDescription
pageIntPage number. Example: 1
guidStringGroup GUID filter. Example: "cometchat-guid-1"
perPageIntResults per page. Example: 30
Request Headers:
HeaderTypeDescription
authTokenStringUser authentication token
appIdStringCometChat application ID. Example: "279557705a948ad6"
sdkStringSDK identifier. Example: "ios@v3.0"
Response:
ParameterTypeDescription
callLogs[CallLog]Array of call logs for the specified group. See CallLog Object

Filter by Call Category (Meetings)

var callLogRequest = CometChatCallsSDK.CallLogsRequest.CallLogsBuilder()
    .set(authToken: CometChat.getUserAuthToken())
    .set(limit: 30)
    .set(callCategory: .meet)
    .build()
HTTP Request:
ParameterValue
URLhttps://{appId}.call-in.cometchat.io/v3.0/calls?perPage=30&page=1&mode=meet
MethodGET
Query Parameters:
ParameterTypeDescription
perPageIntResults per page. Example: 30
pageIntPage number. Example: 1
modeStringCall category filter. Example: "meet"
Request Headers:
HeaderTypeDescription
authTokenStringUser authentication token
appIdStringCometChat application ID. Example: "279557705a948ad6"
sdkStringSDK identifier. Example: "ios@v3.0"
Response:
ParameterTypeDescription
callLogs[CallLog]Array of meeting logs. See CallLog Object
Meeting-Specific CallLog Properties:
ParameterTypeDescription
sessionIdStringMeeting session ID. Example: "v1.us.meet_12345678901234567890"
callCategoryStringCategory. Example: "meet"
participants[Participant]Array of meeting participants
scheduledAtInt?Scheduled meeting time (if applicable)