> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-v6-beta2-flutter-uikit.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Call Logs

> Fetch, filter, and display call history in your React Native app using CometChat Calls SDK — including call duration, participants, direction, and recording status.

<Info>
  **Quick Reference** - Fetch call logs:

  ```javascript theme={null}
  const loggedInUser = await CometChat.getLoggedinUser();

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

  const callLogs = await callLogRequest.fetchNext();
  ```
</Info>

<Note>
  **Available via:** [SDK](/sdk/react-native/call-logs) | [REST API](/rest-api/list-calls) | [UI Kits](/ui-kit/react/call-features#call-logs)
</Note>

## 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.

```javascript theme={null}
let callLogRequestBuilder = new CometChatCalls.CallLogRequestBuilder()
        .setLimit(30)
        .setAuthToken(loggedInUser.getAuthToken())
        .setCallCategory("call")
        .build()
```

`CallLogRequestBuilder` has the following settings available.

| Setting                                                                                              | Description                                                  |
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| `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.

```javascript theme={null}
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);
  });
```

<Accordion title="Response">
  **On Success** — `fetchNext()` returns an array of `CallLog` objects:

  <span id="call-log-array" style={{scrollMarginTop: '100px'}} />

  **CallLog Array:**

  | Parameter | Type  | Description               | Sample Value                    |
  | --------- | ----- | ------------------------- | ------------------------------- |
  | (array)   | array | Array of call log objects | [See below ↓](#call-log-object) |

  <span id="call-log-object" style={{scrollMarginTop: '100px'}} />

  **CallLog Object (each item in array):**

  | Parameter                | Type    | Description                            | Sample Value                                |
  | ------------------------ | ------- | -------------------------------------- | ------------------------------------------- |
  | `sessionId`              | string  | Unique session identifier              | `"v1.in.2748663902141719.1772100619..."`    |
  | `totalAudioMinutes`      | number  | Total audio duration in minutes        | `7.65`                                      |
  | `totalVideoMinutes`      | number  | Total video duration in minutes        | `0`                                         |
  | `totalDuration`          | string  | Formatted total duration               | `"00:07:39"`                                |
  | `totalDurationInMinutes` | number  | Total duration in minutes              | `7.65`                                      |
  | `hasRecording`           | boolean | Whether call has recordings            | `true`                                      |
  | `initiatedAt`            | number  | Unix timestamp when call was initiated | `1772100619`                                |
  | `startedAt`              | number  | Unix timestamp when call started       | `1772100622`                                |
  | `endedAt`                | number  | Unix timestamp when call ended         | `1772101081`                                |
  | `initiator`              | object  | User who initiated the call            | [See below ↓](#call-log-initiator-object)   |
  | `receiver`               | object  | User who received the call             | [See below ↓](#call-log-receiver-object)    |
  | `mode`                   | string  | Call mode                              | `"call"`                                    |
  | `receiverType`           | string  | Type of receiver                       | `"user"`                                    |
  | `status`                 | string  | Call status                            | `"ended"`                                   |
  | `totalParticipants`      | number  | Total number of participants           | `2`                                         |
  | `type`                   | string  | Type of call                           | `"audio"`                                   |
  | `mid`                    | string  | Message ID                             | `"21d6e797-1b44-4a70-be73-d915dba206c7"`    |
  | `participants`           | array   | List of call participants              | [See below ↓](#call-log-participants-array) |
  | `recordings`             | array   | List of recordings                     | [See below ↓](#call-log-recordings-array)   |
  | `data`                   | object  | Additional call data                   | [See below ↓](#call-log-data-object)        |

  ***

  <span id="call-log-initiator-object" style={{scrollMarginTop: '100px'}} />

  **`initiator` Object:**

  | Parameter | Type   | Description                | Sample Value                                                            |
  | --------- | ------ | -------------------------- | ----------------------------------------------------------------------- |
  | `uid`     | string | Unique user identifier     | `"cometchat-uid-7"`                                                     |
  | `name`    | string | Display name of the user   | `"Henry Marino"`                                                        |
  | `avatar`  | string | URL to user's avatar image | `"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-7.webp"` |

  ***

  <span id="call-log-receiver-object" style={{scrollMarginTop: '100px'}} />

  **`receiver` Object:**

  | Parameter | Type   | Description                | Sample Value                                                            |
  | --------- | ------ | -------------------------- | ----------------------------------------------------------------------- |
  | `uid`     | string | Unique user identifier     | `"cometchat-uid-6"`                                                     |
  | `name`    | string | Display name of the user   | `"Ronald Jerry"`                                                        |
  | `avatar`  | string | URL to user's avatar image | `"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"` |

  ***

  <span id="call-log-participants-array" style={{scrollMarginTop: '100px'}} />

  **`participants` Array:**

  | Parameter | Type  | Description                  | Sample Value                                |
  | --------- | ----- | ---------------------------- | ------------------------------------------- |
  | (array)   | array | Array of participant objects | [See below ↓](#call-log-participant-object) |

  <span id="call-log-participant-object" style={{scrollMarginTop: '100px'}} />

  **Participant Object (each item in array):**

  | Parameter                | Type    | Description                      | Sample Value                                                            |
  | ------------------------ | ------- | -------------------------------- | ----------------------------------------------------------------------- |
  | `uid`                    | string  | Unique user identifier           | `"cometchat-uid-6"`                                                     |
  | `name`                   | string  | Display name of the user         | `"Ronald Jerry"`                                                        |
  | `avatar`                 | string  | URL to user's avatar image       | `"https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-6.webp"` |
  | `totalAudioMinutes`      | number  | User's audio duration in minutes | `7.65`                                                                  |
  | `totalVideoMinutes`      | number  | User's video duration in minutes | `0`                                                                     |
  | `totalDurationInMinutes` | number  | User's total duration in minutes | `7.65`                                                                  |
  | `isJoined`               | boolean | Whether user joined the call     | `true`                                                                  |
  | `state`                  | string  | Participant state                | `"ended"`                                                               |
  | `deviceId`               | string  | Device identifier                | `"2b1d0b90-b6b9-4c1c-9899-9bf4effe549f@..."`                            |
  | `joinedAt`               | number  | Unix timestamp when user joined  | `1772100622`                                                            |
  | `leftAt`                 | number  | Unix timestamp when user left    | `1772101081`                                                            |
  | `mid`                    | string  | Message ID                       | `"21d6e797-1b44-4a70-be73-d915dba206c7"`                                |

  ***

  <span id="call-log-recordings-array" style={{scrollMarginTop: '100px'}} />

  **`recordings` Array:**

  | Parameter | Type  | Description                | Sample Value                              |
  | --------- | ----- | -------------------------- | ----------------------------------------- |
  | (array)   | array | Array of recording objects | [See below ↓](#call-log-recording-object) |

  <span id="call-log-recording-object" style={{scrollMarginTop: '100px'}} />

  **Recording Object (each item in array):**

  | Parameter       | Type   | Description                           | Sample Value                               |
  | --------------- | ------ | ------------------------------------- | ------------------------------------------ |
  | `rid`           | string | Recording ID                          | `"noujausedimwfhwl"`                       |
  | `recording_url` | string | URL to download the recording         | `"https://recordings-in.cometchat.io/..."` |
  | `duration`      | number | Recording duration in minutes         | `1.045`                                    |
  | `startTime`     | number | Unix timestamp when recording started | `1772100632`                               |
  | `endTime`       | number | Unix timestamp when recording ended   | `1772100634`                               |

  ***

  <span id="call-log-data-object" style={{scrollMarginTop: '100px'}} />

  **`data` Object:**

  | Parameter  | Type   | Description                 | Sample Value                                  |
  | ---------- | ------ | --------------------------- | --------------------------------------------- |
  | `entities` | object | Entity details for the call | [See below ↓](#call-log-data-entities-object) |

  <span id="call-log-data-entities-object" style={{scrollMarginTop: '100px'}} />

  **`data.entities` Object:**

  | Parameter   | Type   | Description              | Sample Value                                     |
  | ----------- | ------ | ------------------------ | ------------------------------------------------ |
  | `initiator` | object | Initiator entity wrapper | [See below ↓](#call-log-data-entities-initiator) |
  | `receiver`  | object | Receiver entity wrapper  | [See below ↓](#call-log-data-entities-receiver)  |

  <span id="call-log-data-entities-initiator" style={{scrollMarginTop: '100px'}} />

  **`data.entities.initiator` Object:**

  | Parameter | Type   | Description         | Sample Value                                                          |
  | --------- | ------ | ------------------- | --------------------------------------------------------------------- |
  | `entity`  | object | User entity details | `{"uid": "cometchat-uid-7", "name": "Henry Marino", "avatar": "..."}` |

  <span id="call-log-data-entities-receiver" style={{scrollMarginTop: '100px'}} />

  **`data.entities.receiver` Object:**

  | Parameter | Type   | Description         | Sample Value                                                          |
  | --------- | ------ | ------------------- | --------------------------------------------------------------------- |
  | `entity`  | object | User entity details | `{"uid": "cometchat-uid-6", "name": "Ronald Jerry", "avatar": "..."}` |
</Accordion>

### Fetch Previous

The `fetchPrevious()` method retrieves the previous set of call logs.

```javascript theme={null}
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);
  });
```

<Accordion title="Response">
  **On Success** — `fetchPrevious()` returns an array of `CallLog` objects with the same structure as `fetchNext()`. See [fetchNext Response](#call-log-array) for the complete object structure.
</Accordion>

## 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.

```javascript theme={null}
var sessionID = "SESSION_ID";
CometChatCalls.getCallDetails(sessionID, authToken)
.then((callLogs: Array<CallLog>) => {
    console.log(callLogs);
  })
  .catch(err => {
    console.log(err);
  });
```

<Accordion title="Response">
  **On Success** — `getCallDetails()` returns an array of `CallLog` objects with the same structure as `fetchNext()`. See [fetchNext Response](#call-log-array) for the complete object structure.
</Accordion>

<Note>
  Replace `"SESSION_ID"` with the ID of the session you are interested in.
</Note>

## Best Practices

<AccordionGroup>
  <Accordion title="Use pagination for large call histories">
    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.
  </Accordion>

  <Accordion title="Filter logs for specific views">
    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.
  </Accordion>

  <Accordion title="Cache call logs locally">
    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.
  </Accordion>
</AccordionGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Call logs return empty">
    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.
  </Accordion>

  <Accordion title="fetchNext returns the same results">
    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.
  </Accordion>

  <Accordion title="getCallDetails returns no data">
    Confirm the `sessionID` is correct and corresponds to a completed call. Active or in-progress calls may not have full details available yet.
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Ringing" icon="phone-volume" href="/sdk/react-native/default-call">
    Implement a complete calling experience with incoming and outgoing call UI
  </Card>

  <Card title="Call Session" icon="video" href="/sdk/react-native/direct-call">
    Start and manage call sessions with full configuration options
  </Card>

  <Card title="Recording" icon="circle-dot" href="/sdk/react-native/recording">
    Record call sessions for playback and compliance
  </Card>

  <Card title="Standalone Calling" icon="phone" href="/sdk/react-native/standalone-calling">
    Implement calling without the Chat SDK
  </Card>
</CardGroup>
