> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Call Logs

> CometChat Calling SDK v4 - Stable Release - Call Logs for React Native

<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](/calls/v4/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, allowing users to keep track of their communication history. Call logs provide crucial information such as call duration, participants, and more.

## Fetching Call Logs

Use the `CallLogRequestBuilder` to customize the call logs fetching process:

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

`CallLogRequestBuilder` settings:

| 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.                    |
| `setCallStatus(callStatus: 'ongoing' or 'busy' or 'rejected' or 'cancelled' or 'ended' or 'missed')` | Sets the status of calls to fetch.                  |
| `setHasRecording(hasRecording: boolean)`                                                             | Sets whether to fetch calls that have recordings.   |
| `setCallCategory(callCategory: 'call' or 'meet')`                                                    | Sets the category of calls to fetch.                |
| `setCallDirection(callDirection: 'incoming' or 'outgoing')`                                          | Sets the direction of calls to fetch.               |
| `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}
callLogRequestBuilder.fetchNext()
  .then(callLogHistory => {
    console.log(callLogHistory);
  })
  .catch(err => {
     console.log(err);
  });
```

### Fetch Previous

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

```javascript theme={null}
callLogRequestBuilder.fetchPrevious()
  .then(callLogHistory => {
    console.log(callLogHistory);
  })
  .catch(err => {
     console.log(err);
  });
```

## Get Call Details

To retrieve the specific details of a call, use the `getCallDetails()` method:

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

<AccordionGroup>
  <Accordion title="Best Practices">
    * Use pagination with a reasonable `setLimit()` value (e.g., 20-30) rather than fetching all logs at once
    * Use the builder's filter methods to fetch only relevant logs for your current UI view
    * Consider caching fetched call logs locally to reduce API calls
  </Accordion>

  <Accordion title="Troubleshooting">
    * **Call logs return empty:** Verify the `authToken` is valid and calls have actually been made
    * **fetchNext returns the same results:** Reuse the same builder instance for pagination
    * **getCallDetails returns no data:** Confirm the `sessionID` corresponds to a completed call
  </Accordion>
</AccordionGroup>

## Next Steps

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

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

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

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