Quick Reference - Generate token and start a call session:
Overview
This section demonstrates how to start a call session in a React Native application. Previously known as Direct Calling.Available via: SDK | UI Kits
If you want to implement a complete calling experience with ringing functionality (incoming/outgoing call UI), follow the Ringing guide first. Once the call is accepted, return here to start the call session.
Generate Call Token
A call token is required for secure access to a call session. Each token is unique to a specific session and user combination, ensuring that only authorized users can join the call. Use thegenerateToken() method to create a call token:
- JavaScript
- TypeScript
Start Call Session
Use theCometChatCalls.Component to render the call UI. This component requires a call token and a CallSettings object.
- JavaScript
- TypeScript
Call Settings
Configure the call experience using the followingCallSettingsBuilder methods:
Call Listeners
TheOngoingCallListener provides real-time callbacks for call session events.
You can register listeners in two ways:
- Via CallSettingsBuilder: Use
.setCallEventListener(listener)when building call settings - Via addCallEventListener: Use
CometChatCalls.addCallEventListener(listenerId, listener)to add multiple listeners
- JavaScript
- TypeScript
Events
End Call Session
Ringing Flow
When using the Ringing flow, you must coordinate between the CometChat Chat SDK and the Calls SDK.
- JavaScript
- TypeScript
onCallEnded() callback):
- JavaScript
- TypeScript
Session Only Flow
When using the Session Only flow (direct call without ringing), callCometChatCalls.endSession() in the onCallEndButtonPressed() callback.
- JavaScript
- TypeScript
Methods
These methods are available for performing custom actions during an active call session.These methods can only be called when a call session is active.
Switch Camera
Mute Audio
Pause Video
Set Audio Mode
Switch To Video Call
Get Audio Output Modes
End Call
Best Practices
Best Practices
- Generate call tokens just before use — they are session-specific and time-limited
- Always handle call end in both flows: Ringing requires both
CometChat.endCall()andCometChatCalls.endSession() - Clean up listeners on component unmount to prevent memory leaks
- Wrap the call component in a full-screen container with
height: '100%',width: '100%', andposition: 'relative' - Use unique listener IDs per component instance
Troubleshooting
Troubleshooting
- Call token generation fails: Ensure the user is logged in and the auth token is valid
- Call UI does not render: Verify the
CometChatCalls.Componentis wrapped in aViewwith explicit dimensions - Listeners not firing: Check that the listener is registered before the call session starts
- onCallEnded not triggered in group calls: The callback only fires for 1:1 calls (exactly 2 participants)
- Audio or video not working: Check device permissions for camera and microphone
Next Steps
Ringing
Implement a complete calling experience with incoming and outgoing call UI
Recording
Record call sessions for playback and compliance
Video View Customisation
Customize the main video container and participant tiles
Presenter Mode
Enable screen sharing and presenter layouts in calls