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

# Outgoing Call

> Outgoing Call — CometChat documentation.

The outgoing call component is a visual representation of a user-initiated call, whether it's a voice or video call. It serves as an interface for managing outgoing calls, providing users with essential options to control the call experience. This component typically includes information about the call recipient, call controls for canceling the call, and feedback on the call status, such as indicating when the call is in progress.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/fxK75AS6FzDL1Oqo/images/b9a8040d-outgoing_call_overview_cometchat_screens-4d87f2516c9c1a7e1f9eee3ecd249cfb.png?fit=max&auto=format&n=fxK75AS6FzDL1Oqo&q=85&s=97bda6ba16ad3bb0c160ac310027299e" alt="Image" width="4498" height="3120" data-path="images/b9a8040d-outgoing_call_overview_cometchat_screens-4d87f2516c9c1a7e1f9eee3ecd249cfb.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/7a4hqm7gLVRmX34O/images/02a16653-outgoing_call_overview_cometchat_screens-0b011bca0971734bc8dacdb7ba203609.png?fit=max&auto=format&n=7a4hqm7gLVRmX34O&q=85&s=5e632d5132c3c2afe7850143559bb8c3" alt="Image" width="4498" height="3120" data-path="images/02a16653-outgoing_call_overview_cometchat_screens-0b011bca0971734bc8dacdb7ba203609.png" />
  </Tab>
</Tabs>

The `Outgoing Call` is comprised of the following components:

## Usage

### Integration

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import {
      CometChatOutgoingCall,
      CometChatUiKitConstants,
    } from "@cometchat/chat-uikit-react-native";

    function App(): React.JSX.Element {
      const [call, setCall] = useState<CometChat.Call>();

      useEffect(() => {
        //login
        const callObject = new CometChat.Call(
          "receiver-uid",
          CometChatUiKitConstants.MessageTypeConstants.audio,
          CometChatUiKitConstants.ReceiverTypeConstants.user
        );

        CometChat.initiateCall(callObject)
          .then((c) => {
            setCall(c);
          })
          .catch(console.log);
      }, []);

      return <>{call && <CometChatOutgoingCall call={call} />}</>;
    }
    ```
  </Tab>
</Tabs>

### Actions

[Actions](/ui-kit/react-native/v4/components-overview#actions) dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.

##### 1. onDeclineButtonPressed

The `onDeclineButtonPressed` event gets activated when the cancel button is clicked. It does not have a default behavior. However, you can override its behavior using the following code snippet.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import {
      CometChatOutgoingCall,
      CometChatUiKitConstants,
    } from "@cometchat/chat-uikit-react-native";

    function App(): React.JSX.Element {
      const [call, setCall] = useState<CometChat.Call>();

      useEffect(() => {
        //login
        const callObject = new CometChat.Call(
          "receiver-uid",
          CometChatUiKitConstants.MessageTypeConstants.audio,
          CometChatUiKitConstants.ReceiverTypeConstants.user
        );

        CometChat.initiateCall(callObject)
          .then((c) => {
            setCall(c);
          })
          .catch(console.log);
      }, []);

      const cancelCall = (c: CometChat.Call) => {
        //code
        CometChat.endCall(c.getSessionId()).then(() => {
          setCall(undefined);
        });
      };

      return (
        <>
          {call && (
            <CometChatOutgoingCall
              call={call}
              onDeclineButtonPressed={cancelCall}
            />
          )}
        </>
      );
    }
    ```
  </Tab>
</Tabs>

***

### Filters

**Filters** allow you to customize the data displayed in a list within a `Component`. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using `RequestBuilders` of Chat SDK.

The `Outgoing Call` component does not have any exposed filters.

***

### Events

[Events](/ui-kit/react-native/v4/components-overview#events) are emitted by a `Component`. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.

The list of events emitted by the Incoming Call component is as follows.

| Event             | Description                                                            |
| ----------------- | ---------------------------------------------------------------------- |
| **ccCallEnded**   | This event is triggered when the initiated call successfully ends.     |
| **ccCallFailled** | This event is triggered when an error occurs during the intiated call. |

<Tabs>
  <Tab title="Adding Listeners">
    ```tsx theme={null}
    import { CometChatUIEventHandler } from "@cometchat/chat-uikit-react-native";

    CometChatUIEventHandler.addCallListener("CALL_LISTENER_ID", {
      ccCallEnded: ({ call }) => {
        //code
      },
    });

    CometChatUIEventHandler.addCallListener("CALL_LISTENER_ID", {
      ccCallFailled: ({ call }) => {
        //code
      },
    });
    ```
  </Tab>
</Tabs>

***

<Tabs>
  <Tab title="Removing Listeners">
    ```tsx theme={null}
    import { CometChatUIEventHandler } from "@cometchat/chat-uikit-react-native";

    CometChatUIEventHandler.removeCallListener("CALL_LISTENER_ID");
    ```
  </Tab>
</Tabs>

***

## Customization

To fit your app's design requirements, you can customize the appearance of the Outgoing Call component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.

### Style

Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.

##### 1. OutgoingCallStyle

To customize the appearance, you can assign a `OutgoingCallStyle` object to the `Outgoing Call` component.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/TO10Bmu50bb5qPTI/images/2cd5324f-outgoing_call_style_cometchat_screens-bdd0367f25c79fd2ce3e1d68d25bfc32.png?fit=max&auto=format&n=TO10Bmu50bb5qPTI&q=85&s=70d448a0154bb265f3e87be0595cdfd3" alt="Image" width="4498" height="3120" data-path="images/2cd5324f-outgoing_call_style_cometchat_screens-bdd0367f25c79fd2ce3e1d68d25bfc32.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/7emVxEQ5MCxvzC60/images/1f19e79b-outgoing_call_style_cometchat_screens-df595a920ee563448831daf8fa1950ce.png?fit=max&auto=format&n=7emVxEQ5MCxvzC60&q=85&s=0448e0e850f5e386650134fbe282e61b" alt="Image" width="4498" height="3120" data-path="images/1f19e79b-outgoing_call_style_cometchat_screens-df595a920ee563448831daf8fa1950ce.png" />
  </Tab>
</Tabs>

In this example, we are employing the `outgoingCallStyle`.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import {
      CometChatOutgoingCall,
      OutgoingCallStyleInterface,
      CometChatUiKitConstants,
    } from "@cometchat/chat-uikit-react-native";

    function App(): React.JSX.Element {
      const [call, setCall] = useState<CometChat.Call>();

      useEffect(() => {
        //login
        const callObject = new CometChat.Call(
          "receiver-uid",
          CometChatUiKitConstants.MessageTypeConstants.audio,
          CometChatUiKitConstants.ReceiverTypeConstants.user
        );

        CometChat.initiateCall(callObject)
          .then((c) => {
            setCall(c);
          })
          .catch(console.log);
      }, []);

      const cancelCall = (c: CometChat.Call) => {
        //code
        CometChat.endCall(c.getSessionId()).then(() => {
          setCall(undefined);
        });
      };

      const outgoingCallStyle: OutgoingCallStyleInterface = {
        titleColor: "#6851D6",
        subtitleColor: "#6851D6",
      };

      return (
        <>
          {call && (
            <CometChatOutgoingCall
              call={call}
              onDeclineButtonPressed={cancelCall}
              outgoingCallStyle={outgoingCallStyle}
            />
          )}
        </>
      );
    }
    ```
  </Tab>
</Tabs>

The following properties are exposed by OutgoingCallStyle:

| Property            | Description                     | Code                                 |
| ------------------- | ------------------------------- | ------------------------------------ |
| **border**          | Used to set border              | `border?: BorderStyleInterface,`     |
| **borderRadius**    | Used to set border radius       | `borderRadius?: number;`             |
| **backgroundColor** | Used to set background colour   | `background?: string;`               |
| **height**          | Used to set height              | `height?: number` \| `string;`       |
| **width**           | Used to set width               | `width?: number` \| `string;`        |
| **titleFont**       | Used to set title text font     | `titleFont?: FontStyleInterface,`    |
| **titleColor**      | Used to set title text color    | `titleColor?: string;`               |
| **subtitleFont**    | Used to set subtitle text font  | `subtitleFont?: FontStyleInterface;` |
| **subtitleColor**   | Used to set subtitle text color | `subtitleColor?: string;`            |

***

##### 2. Decline Button Style

If you want to apply customized styles to the `Cancel Button`, you can use the `buttonStyle` property for the same.

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/NN4EdpOU3viwWMb_/images/0f7a849b-outgoing_call_button_style_cometchat_screens-f7137d5ae31043241cb3754ad1183106.png?fit=max&auto=format&n=NN4EdpOU3viwWMb_&q=85&s=902388ec45acdd4125135666502ffbd3" alt="Image" width="4498" height="3120" data-path="images/0f7a849b-outgoing_call_button_style_cometchat_screens-f7137d5ae31043241cb3754ad1183106.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/JSRiWiPGBHsJZFCg/images/996644bf-outgoing_call_button_style_cometchat_screens-736b4cf05310dc99398f130f1eee247f.png?fit=max&auto=format&n=JSRiWiPGBHsJZFCg&q=85&s=8533d4d71e54e5566311850a641821ea" alt="Image" width="4498" height="3120" data-path="images/996644bf-outgoing_call_button_style_cometchat_screens-736b4cf05310dc99398f130f1eee247f.png" />
  </Tab>
</Tabs>

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import {
      CometChatOutgoingCall,
      OutgoingCallStyleInterface,
      CometChatUiKitConstants,
      ButtonStyleInterface,
    } from "@cometchat/chat-uikit-react-native";

    function App(): React.JSX.Element {
      const [call, setCall] = useState<CometChat.Call>();

      useEffect(() => {
        //login
        const callObject = new CometChat.Call(
          "receiver-uid",
          CometChatUiKitConstants.MessageTypeConstants.audio,
          CometChatUiKitConstants.ReceiverTypeConstants.user
        );

        CometChat.initiateCall(callObject)
          .then((c) => {
            setCall(c);
          })
          .catch(console.log);
      }, []);

      const cancelCall = (c: CometChat.Call) => {
        //code
        CometChat.endCall(c.getSessionId()).then(() => {
          setCall(undefined);
        });
      };

      const outgoingCallStyle: OutgoingCallStyleInterface = {
        backgroundColor: "#c2b8f5",
      };

      const declineButtonStyle: ButtonStyleInterface = {
        backgroundColor: "#c2b8f5",
      };

      return (
        <>
          {call && (
            <CometChatOutgoingCall
              call={call}
              onDeclineButtonPressed={cancelCall}
              outgoingCallStyle={outgoingCallStyle}
              buttonStyle={declineButtonStyle}
            />
          )}
        </>
      );
    }
    ```
  </Tab>
</Tabs>

***

##### 3. Avatar Style

If you want to apply customized styles to the `Avatar` component within the `Outgoing Call` Component, you can use the following code snippet. For more information you can refer [Avatar Styles](/ui-kit/react-native/v4/avatar#avatarstyleinterface).

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import {
      CometChatOutgoingCall,
      OutgoingCallStyleInterface,
      CometChatUiKitConstants,
      BorderStyleInterface,
      AvatarStyleInterface,
    } from "@cometchat/chat-uikit-react-native";

    function App(): React.JSX.Element {
      const [call, setCall] = useState<CometChat.Call>();

      useEffect(() => {
        //login
        const callObject = new CometChat.Call(
          "receiver-uid",
          CometChatUiKitConstants.MessageTypeConstants.audio,
          CometChatUiKitConstants.ReceiverTypeConstants.user
        );

        CometChat.initiateCall(callObject)
          .then((c) => {
            setCall(c);
          })
          .catch(console.log);
      }, []);

      const cancelCall = (c: CometChat.Call) => {
        //code
        CometChat.endCall(c.getSessionId()).then(() => {
          setCall(undefined);
        });
      };

      const borderStyle: BorderStyleInterface = {
        borderWidth: 10,
        borderStyle: "solid",
        borderColor: "#cc5e95",
      };

      const avatarStyle: AvatarStyleInterface = {
        outerViewSpacing: 5,
        outerView: {
          borderWidth: 2,
          borderStyle: "dotted",
          borderColor: "blue",
        },
        border: borderStyle,
      };

      return (
        <>
          {call && (
            <CometChatOutgoingCall
              call={call}
              onDeclineButtonPressed={cancelCall}
              avatarStyle={avatarStyle}
            />
          )}
        </>
      );
    }
    ```
  </Tab>
</Tabs>

***

### Functionality

These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements.

Here is a code snippet demonstrating how you can customize the functionality of the `Outgoing Call` component.

<Tabs>
  <Tab title="App.tsx">
    ```tsx theme={null}
    import { CometChat } from "@cometchat/chat-sdk-react-native";
    import {
      CometChatOutgoingCall,
      OutgoingCallStyleInterface,
      CometChatUiKitConstants,
      ButtonStyleInterface,
    } from "@cometchat/chat-uikit-react-native";
    import EndCall from "./end-call-icon.png";

    function App(): React.JSX.Element {
      const [call, setCall] = useState<CometChat.Call>();

      useEffect(() => {
        //login
        const callObject = new CometChat.Call(
          "receiver-uid",
          CometChatUiKitConstants.MessageTypeConstants.audio,
          CometChatUiKitConstants.ReceiverTypeConstants.user
        );

        CometChat.initiateCall(callObject)
          .then((c) => {
            setCall(c);
          })
          .catch(console.log);
      }, []);

      const cancelCall = (c: CometChat.Call) => {
        //code
        CometChat.endCall(c.getSessionId()).then(() => {
          setCall(undefined);
        });
      };

      const declineButtonStyle: ButtonStyleInterface = {
        iconTint: "#f2b1b1",
      };

      return (
        <>
          {call && (
            <CometChatOutgoingCall
              call={call}
              onDeclineButtonPressed={cancelCall}
              declineButtonText=" "
              disableSoundForCalls={false}
              declineButtonIcon={EndCall}
              buttonStyle={declineButtonStyle}
            />
          )}
        </>
      );
    }
    ```
  </Tab>
</Tabs>

<Tabs>
  <Tab title="iOS">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/jpEUuHUk-hvu4tQT/images/a65fe8be-outgoing_call_fun_cometchat_screens-1e0718bfa1f4ce9d25d64513bb782e55.png?fit=max&auto=format&n=jpEUuHUk-hvu4tQT&q=85&s=fb8b826abc3b13cda8512aa802a15d51" alt="Image" width="4498" height="3120" data-path="images/a65fe8be-outgoing_call_fun_cometchat_screens-1e0718bfa1f4ce9d25d64513bb782e55.png" />
  </Tab>

  <Tab title="Android">
    <img src="https://mintcdn.com/cometchat-22654f5b-docs-rn-guide-message-privately/19qJLi95IaEk2j9s/images/fee889db-outgoing_call_fun_cometchat_screens-90f49ea7425e8ef8c1373e10121a7e51.png?fit=max&auto=format&n=19qJLi95IaEk2j9s&q=85&s=e632c04722cbbb98ef7b4bd740d5bd0d" alt="Image" width="4498" height="3120" data-path="images/fee889db-outgoing_call_fun_cometchat_screens-90f49ea7425e8ef8c1373e10121a7e51.png" />
  </Tab>
</Tabs>

Below is a list of customizations along with corresponding code snippets

| Property                 | Description                                                                       | Code                                                 |
| ------------------------ | --------------------------------------------------------------------------------- | ---------------------------------------------------- |
| **declineButtonText**    | Used to set custom decline button text                                            | `declineButtonText?: string`                         |
| **declineButtonIcon**    | Used to set custom decline button icon URL                                        | `declineButtonIcon?: ImageType`                      |
| **customSoundForCalls**  | Used to set custom sound for calls                                                | `customSoundForCalls?: string`                       |
| **disableSoundForCalls** | Used to disable/enable the sound of Outgoing calls, by default it is set to false | `disableSoundForCalls?: boolean`                     |
| **call**                 | Sets the call object for CometChatOutgoingCall                                    | `call?: CometChat.Call `\| `CometChat.CustomMessage` |

***

### Advance

For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.

The `Outgoing Call` component does not offer any advanced functionalities beyond this level of customization.

***
