Skip to main content
Quick Reference - Generate token and start a standalone call session:
// Generate call token (auth token from REST API, not Chat SDK)
const callToken = await CometChatCalls.generateToken(sessionId, userAuthToken);

// Configure and render
const callSettings = new CometChatCalls.CallSettingsBuilder()
  .enableDefaultLayout(true)
  .setIsAudioOnlyCall(false)
  .build();

// <CometChatCalls.Component callSettings={callSettings} callToken={callToken} />
Available via: SDK | UI Kits

Overview

This section demonstrates how to implement calling functionality using only the CometChat Calls SDK, without requiring the Chat SDK. This is ideal for applications that need video/audio calling capabilities without the full chat infrastructure.
Before you begin, ensure you have completed the Calls SDK setup.

User Authentication

To start a call session, you need a user auth token. Since this implementation doesn’t use the Chat SDK, you’ll need to obtain the auth token via the CometChat REST API.
To understand user authentication in CometChat, see the User Auth documentation.
You can obtain the auth token using one of these REST API endpoints:
Auth tokens grant access to call sessions on behalf of a user. Never expose auth tokens in client-side code in production. Use a secure backend to generate and deliver tokens to your app.

Generate Call Token

Use the generateToken() method to create a call token:
const sessionId = "UNIQUE_SESSION_ID";
const userAuthToken = "USER_AUTH_TOKEN";

CometChatCalls.generateToken(sessionId, userAuthToken).then(
  (callToken) => {
    console.log("Call token generated:", callToken.token);
  },
  (error) => {
    console.log("Token generation failed:", error);
  }
);
ParameterDescription
sessionIdA unique session ID for the call. Share this ID for participants to join the same call.
userAuthTokenThe user auth token obtained from the CometChat REST API.

Start Call Session

Use the CometChatCalls.Component to render the call UI.
const callListener = new CometChatCalls.OngoingCallListener({
  onUserJoined: (user) => console.log("User joined:", user),
  onUserLeft: (user) => console.log("User left:", user),
  onUserListUpdated: (userList) => console.log("User list updated:", userList),
  onCallEnded: () => {
    CometChatCalls.endSession();
  },
  onCallEndButtonPressed: () => {
    CometChatCalls.endSession();
  },
  onError: (error) => console.log("Call error:", error),
  onAudioModesUpdated: (audioModes) => console.log("Audio modes updated:", audioModes),
  onSessionTimeout: () => console.log("Session timed out")
});

const callSettings = new CometChatCalls.CallSettingsBuilder()
  .enableDefaultLayout(true)
  .setIsAudioOnlyCall(false)
  .setCallEventListener(callListener)
  .build();

return (
  <View style={{ height: '100%', width: '100%', position: 'relative' }}>
    <CometChatCalls.Component callSettings={callSettings} callToken={callToken} />
  </View>
);

End Call Session

To end the call session, call CometChatCalls.endSession() in the onCallEndButtonPressed() callback.
CometChatCalls.endSession();

Methods

Switch Camera

CometChatCalls.switchCamera();

Mute Audio

CometChatCalls.muteAudio(true); // true to mute, false to unmute

Pause Video

CometChatCalls.pauseVideo(true); // true to pause, false to resume

Set Audio Mode

CometChatCalls.setAudioMode(CometChat.AUDIO_MODE.EARPIECE);

Switch To Video Call

CometChatCalls.switchToVideoCall();
  • Generate call tokens just before use — they are session-specific and time-limited
  • Use a shared session ID for participants to join the same call
  • Secure your auth tokens — generate them server-side and deliver securely to the client
  • Clean up listeners on component unmount
  • Wrap the call component in a full-screen container
  • Call token generation fails: Verify the auth token is valid and hasn’t expired
  • Call UI does not render: Ensure the component is wrapped in a View with explicit dimensions
  • Participants can’t join the same call: Both participants must use the exact same sessionId
  • Audio or video not working: Check device permissions for camera and microphone

Next Steps

Calls SDK Setup

Install dependencies, configure permissions, and initialize the Calls SDK

Recording

Record call sessions for playback and compliance

Video View Customisation

Customize the main video container and participant tiles

Call Session

Full call session management with the Chat SDK integration