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

# Call

> Call — CometChat documentation.

You can integrate voice and video calling SDK to add calling functionality to your CometChat-enabled application.

To integrate, follow the below steps:

## Integration

First, make sure that you've correctly integrated the UI Kit library into your project. If you haven't done this yet or are facing difficulties, refer to our Getting Started guide. This guide will walk you through a step-by-step process of integrating our UI Kit into your React Native project.

Once you've successfully integrated the UI Kit, the next step is to add the CometChat Calls SDK to your project. This is necessary to enable the calling features in the UI Kit. Here's how you do it:

<Tabs>
  <Tab title="Bash">
    ```sh theme={null}
    npm install @cometchat/calls-sdk-react-native
    ```
  </Tab>
</Tabs>

After adding this dependency, the Android UI Kit will automatically detect it and activate the calling features. Now, your application supports both audio and video calling. You will see [CallButtons](/ui-kit/react-native/v4/call-buttons) component rendered in [MessageHeader](/ui-kit/react-native/v4/message-header) Component.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/Gp90C5sdVtuRR4t7/images/838b4594-call_overview_cometchat_screens-953dea2747f3f642c8e99d5ca81f79db.png?fit=max&auto=format&n=Gp90C5sdVtuRR4t7&q=85&s=b1ae7f8ebba09c0b57aa4074ad758acb" alt="Image" width="4498" height="3120" data-path="images/838b4594-call_overview_cometchat_screens-953dea2747f3f642c8e99d5ca81f79db.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/fxK75AS6FzDL1Oqo/images/bae9d77f-call_overview_cometchat_screens-a20afca1663c9bd893005bd9bb0fffeb.png?fit=max&auto=format&n=fxK75AS6FzDL1Oqo&q=85&s=1d06f748907844194dc3d537f5f6f296" alt="Image" width="4498" height="3120" data-path="images/bae9d77f-call_overview_cometchat_screens-a20afca1663c9bd893005bd9bb0fffeb.png" />
  </Tab>
</Tabs>

## Add necessary permissions

### Android:

Go to AndroidManifest.xml located in the react-native/app/src/main of your React Native project and add the following permissions:

<Tabs>
  <Tab title="AndroidManifest.xml">
    ```xml theme={null}
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.org.name_of_your_app" >

        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
        <uses-permission android:name="android.permission.RECORD_AUDIO" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

        <application>
            <activity>
            </activity>
            <meta-data />
        </application>
    </manifest>
    ```
  </Tab>
</Tabs>

### iOS:

Open Info.plist located in the ios/\{appname} of your React Native project and add the following entries:

<Tabs>
  <Tab title="info.plist">
    ```xml theme={null}
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
        <key>NSCameraUsageDescription</key>
        <string>Access camera</string>
        <key>NSMicrophoneUsageDescription</key>
        <string>Access Microphone</string>
      </dict>
    </plist>
    ```
  </Tab>
</Tabs>

## Setup minimum Android and iOS versions

For Android go to app-level build.gradle and change minSdkVersion to 24 and the targetSdkVersion and compileSdkVersion to 33.

<Tabs>
  <Tab title="Gradle">
    ```gradle theme={null}
    android {
        namespace "com.org.name_of_your_app"

        compileSdkVersion 33

        defaultConfig {

            minSdkVersion 24

            targetSdkVersion 33

        }

    }
    ```
  </Tab>
</Tabs>

For iOS you can open xcworkspace in XCode modify the IPHONEOS\_DEPLOYMENT\_TARGETto 12.0

or you can specify it in the post\_install hook of the Podfile

<Tabs>
  <Tab title="Podfile">
    ```ruby theme={null}
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
        target.build_configurations.each do |build_configuration|

            build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'

            build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
            build_configuration.build_settings['ENABLE_BITCODE'] = 'NO'
         end
      end
    end
    ```
  </Tab>
</Tabs>

<Warning>
  **Apple Silicon (M1/M2/M3) users:** Excluding `arm64` from the simulator build prevents the app from running natively on Apple Silicon Macs. If you are developing on an Apple Silicon Mac, consider excluding only `i386` instead of `arm64 i386` to enable native simulator builds.
</Warning>

## Add the Call Listeners

Apart from Call Buttons, the Calls UI Kit also provides fully functional UI components for Incoming, Outgoing and Ongoing Calls.

Wherever you wish to receive the call events in, you need to register the CallListener listener using the addCallListener() method. onIncomingCallReceived() event will receive when you receive a call.

<Tabs>
  <Tab title="Bash">
    ```sh theme={null}
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import { CometChatIncomingCall } from "@cometchat/chat-uikit-react-native";

    const incomingCall = useRef(null);
    var listnerID: string = "UNIQUE_LISTENER_ID";
    CometChat.addCallListener(
      listnerID,
      new CometChat.CallListener({
        onIncomingCallReceived: (call: CometChat.Call) => {
          console.log("Incoming call:", call);
          incomingCall.current = call;
        },
        onOutgoingCallAccepted: (call: CometChat.Call) => {
          console.log("Outgoing call accepted:", call);
        },
        onOutgoingCallRejected: (call: CometChat.Call) => {
          console.log("Outgoing call rejected:", call);
        },
        onIncomingCallCancelled: (call: CometChat.Call) => {
          console.log("Incoming call calcelled:", call);
        },
        onCallEndedMessageReceived: (call: CometChat.Call) => {
          console.log("CallEnded Message:", call);
        },
      })
    );

    return (
      <SafeAreaView>
        {callRecevied && (
          <CometChatIncomingCall
            call={incomingCall.current}
            onDecline={(call) => {
              setCallReceived(false);
            }}
            incomingCallStyle={{
              backgroundColor: "white",
              titleColor: "black",
              subtitleColor: "gray",
              titleFont: {
                fontSize: 20,
                fontWeight: "bold",
              },
            }}
          />
        )}
      </SafeAreaView>
    );
    ```
  </Tab>
</Tabs>

## Features

### Incoming Call

The [Incoming Call](/ui-kit/react-native/v4/incoming-call) component of the CometChat UI Kit provides the functionality that lets users receive real-time audio and video calls in the app.

When a call is made to a user, the Incoming Call component triggers and displays a call screen. This call screen typically displays the caller information and provides the user with options to either accept or reject the incoming call.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/JSRiWiPGBHsJZFCg/images/9fe6b364-call_incoming_cometchat_screens-71161a2c460a58cd616c4bb05a99f401.png?fit=max&auto=format&n=JSRiWiPGBHsJZFCg&q=85&s=7bb306f93461d4fc30abfe2e93687862" alt="Image" width="4498" height="3120" data-path="images/9fe6b364-call_incoming_cometchat_screens-71161a2c460a58cd616c4bb05a99f401.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2JiXkJ8lq6PmPGlJ/images/6ea1a65c-call_incoming_cometchat_screens-33385ab1d803599c4ece94d5197fd556.png?fit=max&auto=format&n=2JiXkJ8lq6PmPGlJ&q=85&s=e7acf05550bae09d953b88027d2108a3" alt="Image" width="4498" height="3120" data-path="images/6ea1a65c-call_incoming_cometchat_screens-33385ab1d803599c4ece94d5197fd556.png" />
  </Tab>
</Tabs>

### Outgoing Call

The [Outgoing Call](/ui-kit/react-native/v4/incoming-call) component of the CometChat UI Kit is designed to manage the outgoing call process within your application. When a user initiates an audio or video call to another user or group, this component displays an outgoing call screen, showcasing information about the recipient and the call status.

Importantly, the Outgoing Call component is smartly designed to transition automatically into the ongoing call screen once the receiver accepts the call. This ensures a smooth flow from initiating the call to engaging in a conversation, without any additional steps required from the user.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/2JiXkJ8lq6PmPGlJ/images/6d001c9f-call_outgoing_cometchat_screens-fe5b8ad13bc8f8c3a8abe587541c0746.png?fit=max&auto=format&n=2JiXkJ8lq6PmPGlJ&q=85&s=a1a85963db12e43f071df1f1ffc25847" alt="Image" width="4498" height="3120" data-path="images/6d001c9f-call_outgoing_cometchat_screens-fe5b8ad13bc8f8c3a8abe587541c0746.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/FGBCGWXGo5d9bVxR/images/c1548233-call_outgoing_cometchat_screens-cc3b04064ed099d59926a887aa84e0a3.png?fit=max&auto=format&n=FGBCGWXGo5d9bVxR&q=85&s=3d0f3e93e4b1007479b526d266d6f0a7" alt="Image" width="4498" height="3120" data-path="images/c1548233-call_outgoing_cometchat_screens-cc3b04064ed099d59926a887aa84e0a3.png" />
  </Tab>
</Tabs>

### Ongoing Call

The [OngoingCall](/ui-kit/react-native/v4/ongoing-call) component is the user interface that displays during an ongoing call. For an audio call, this screen displays the participant's name, call duration, and buttons to mute the audio, enable or disable video, switch the camera, and end the call.

For a video call, the Call Screen might additionally display the video footage from both the user's camera and the recipient's camera.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/mq8rEbFfi0JjKmkM/images/65e5e5fb-call_ongoing_cometchat_screens-4036e0eef2bf14f0f6d1a1d6e4839126.png?fit=max&auto=format&n=mq8rEbFfi0JjKmkM&q=85&s=26117d1f0c4509cf0bcde734e2c58067" alt="Image" width="4498" height="3120" data-path="images/65e5e5fb-call_ongoing_cometchat_screens-4036e0eef2bf14f0f6d1a1d6e4839126.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/PaxBG9I1yMoeQmt2/images/36f0f9db-call_ongoing_cometchat_screens-89994d87b989a74bda142c4342f7e6d7.png?fit=max&auto=format&n=PaxBG9I1yMoeQmt2&q=85&s=786eb550ced8a7f2c83813eb60974295" alt="Image" width="4498" height="3120" data-path="images/36f0f9db-call_ongoing_cometchat_screens-89994d87b989a74bda142c4342f7e6d7.png" />
  </Tab>
</Tabs>

### Call Logs

[Call Logs](/ui-kit/react-native/v4/call-log-with-details) component provides you with the records call events such as who called who, the time of the call, and the duration of the call. This information can be fetched from the CometChat server and displayed in a structured format for users to view their past call activities.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/mkn0UqPQ5BXljCV1/images/92f705bf-call_logs_cometchat_screens-79a3636f9fff7737c4d0f76534efb904.png?fit=max&auto=format&n=mkn0UqPQ5BXljCV1&q=85&s=d9382d78fac1a892a8fbd6ed51ab5cf2" alt="Image" width="4498" height="3120" data-path="images/92f705bf-call_logs_cometchat_screens-79a3636f9fff7737c4d0f76534efb904.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/G6Puyz_3Zlaowa9R/images/ce6b81b1-call_logs_cometchat_screens-e9152dc727652add2ab66917172a0fe5.png?fit=max&auto=format&n=G6Puyz_3Zlaowa9R&q=85&s=af591e33ea05e794f351df214b80ccfb" alt="Image" width="4498" height="3120" data-path="images/ce6b81b1-call_logs_cometchat_screens-e9152dc727652add2ab66917172a0fe5.png" />
  </Tab>
</Tabs>
