Skip to main content
The CometChatOngoingCall component shows the screen users see during a voice or video call. It requests a call token for the session, then renders the Calls SDK call view, with video tiles and call controls such as mute, pause video, switch camera, and end call. Until the token arrives, it shows a loading spinner.

Usage

Integration

CometChatIncomingCall and CometChatOutgoingCall render CometChatOngoingCall for you once a call connects, so most apps never render it directly. Render it yourself when you build your own call flow. Pass the call’s session ID and a CometChatCalls.CallSettingsBuilder. Set an OngoingCallListener on the builder so your app knows when the call ends.
This listener handles the call-ended case like CometChatIncomingCall, calling leaveSession(). It does not replicate the kit’s full teardown — the kit also ends the call from onUserLeft and gates endCall on isDefaultCall(call). To match that behavior, add an onUserLeft handler that leaves the session (gating endCall on isDefaultCall(call) where applicable), so the call also tears down when the remote participant leaves — not only on an explicit end. The kit itself still calls endSession(), which Calls SDK 5.x deprecates in favor of leaveSession().
The component fills its parent, so render it full screen, for example inside a React Native Modal as CometChatOutgoingCall does.

Actions

Actions dictate how a component functions. CometChatOngoingCall has one user-defined action.

1. onError

Fires when the component cannot get a call token: no user is logged in, or CometChat.getLoggedinUser() or CometChatCalls.generateToken() fails. A plain JavaScript Error, such as the one for no logged-in user, arrives as a CometChatException with the code TOKEN_GENERATION_FAILED.
Keep onError stable (wrap it in useCallback, as above). The token request re-runs whenever sessionID or onError changes, and its cleanup clears the built call settings. A new onError function on every render therefore restarts the request and leaves the loading spinner on screen for good. React StrictMode in development runs that cleanup once on mount, which shows the same spinner.
Errors during the call are not sent to this prop. They go to the onError handler of the OngoingCallListener on your builder. CometChatOngoingCall has no call-ended action. To act when the call ends, set onCallEnded on the builder’s OngoingCallListener, as shown in Integration.

Filters

Filters narrow the data a component shows. CometChatOngoingCall shows no list. Instead, callSettingsBuilder controls the call itself.

1. CallSettingsBuilder

CometChatCalls.CallSettingsBuilder from @cometchat/calls-sdk-react-native offers these methods:

Example

In the example below, the call shows the recording button and starts with audio muted:
Voice and video calls need microphone and camera permissions on iOS and Android. Add them as described in Add Permissions.

Events

Events are emitted by a component. CometChatOngoingCall emits no events of its own. When CometChatIncomingCall or CometChatOutgoingCall render it for you, they emit this event when the call ends:
If you render CometChatOngoingCall yourself, nothing emits this event. Use onCallEnded on your builder’s OngoingCallListener instead.

Customization

To fit your app’s requirements, you can customize how the call behaves through the component’s props and callSettingsBuilder.

Style

CometChatOngoingCall has no style prop. The Calls SDK draws the call screen. The UI Kit wraps it in a safe-area container (top and bottom edges) filled with the theme’s background1 color, and shows a loading spinner in the theme’s primary color until the call is ready.

Functionality

  • callSettingsBuilder must be a CometChatCalls.CallSettingsBuilder instance, because the component calls its build() method. A plain settings object does not work.
  • The call uses the settings built on the component’s first render. Passing a different builder later has no effect.

Advanced

For advanced customization, UI Kit components accept custom views for parts of their UI. CometChatOngoingCall has no view slots, so it offers no customization beyond callSettingsBuilder.

Common Patterns

Show the Ongoing Call After Accepting a Call

Accept the call with the Chat SDK, then render the call screen for the accepted call. This mirrors what CometChatIncomingCall does by default.

Configure Call Settings for a Video Call

When you render CometChatOngoingCall yourself, also set the OngoingCallListener from Integration.

Audio-Only Call Configuration

When you render CometChatOngoingCall yourself, also set the OngoingCallListener from Integration.

Listen for Call End Events

How you learn that a call ended depends on what renders the call screen:
  • You render CometChatOngoingCall: set onCallEnded on the builder’s OngoingCallListener, as in Integration.
  • CometChatIncomingCall or CometChatOutgoingCall renders it: listen for ccCallEnded, as in Events.

Use Your Own Settings with Incoming Call, Outgoing Call or Call Buttons

These components take a builder for the call screen they open: Two things differ from rendering CometChatOngoingCall yourself:
  • These components set their own OngoingCallListener on your builder, which replaces any listener you set. React to the call through their callbacks and events instead.
  • Without a builder, they turn on the default layout and make audio calls audio-only. Your builder is used as it is, so set enableDefaultLayout(true) and setIsAudioOnlyCall(...) yourself.
There is one more path that opens the call screen: joining a group call from the meeting bubble in a group chat. The calling extension renders CometChatOngoingCall in a modal, built with CallingConfiguration.groupCallSettingsBuilder (called as (undefined, group, isAudioOnly)) or, without one, a plain builder with setIsAudioOnlyCall(...). It also sets its own OngoingCallListener, and this path emits no ccCallEnded. Leaving the call only closes the modal, through ccShowOngoingCall with { child: null }. CallingConfiguration is not exported from the package root.

Next Steps

Incoming Call

Display and handle incoming calls

Outgoing Call

Display and manage outgoing calls

Call Buttons

Add voice and video call buttons to your UI

Call Features

Overview of all calling features