Skip to main content
// Set custom timeout (in seconds)
const callSettings = new CometChatCalls.CallSettingsBuilder()
  .setIdleTimeoutPeriod(300) // 5 minutes
  .setCallListener(new CometChatCalls.OngoingCallListener({
    onSessionTimeout: () => {
      console.log("Session timed out");
      CometChatCalls.endSession();
    }
  }))
  .build();
  • Default idle timeout: 180 seconds (3 minutes) alone in a session
  • Warning dialog appears 60 seconds before auto-termination
  • Listen for onSessionTimeout to handle auto-termination
  • Customize with setIdleTimeoutPeriod(seconds) in CallSettings (v4.1.0+)
Available since v4.1.0 The Calls SDK automatically terminates call sessions when a participant is alone for too long, preventing abandoned calls from consuming resources. You can customize the timeout duration and handle the termination event.

How It Works

When a participant is alone in a session:
  1. A warning dialog appears 60 seconds before the timeout, with “Stay” or “Leave” options
  2. If no action is taken, the call auto-terminates and the onSessionTimeout event fires
The default timeout is 180 seconds (3 minutes).

Configuration

Set a custom timeout period using setIdleTimeoutPeriod() in CallSettingsBuilder. The warning dialog will always appear 60 seconds before the configured timeout.
const callSettings: any = new CometChatCalls.CallSettingsBuilder()
  .setIdleTimeoutPeriod(300) // 5 minutes
  .enableDefaultLayout(true)
  .setCallListener(callListener)
  .build();

Handling the Timeout Event

Listen for onSessionTimeout in your OngoingCallListener to clean up when the call auto-terminates:
const callListener = new CometChatCalls.OngoingCallListener({
  onSessionTimeout: () => {
    console.log("Session timed out due to inactivity");
    CometChatCalls.endSession();
    // Close the calling screen
  },
  // ... other listeners
});
See Call Session — Call Listeners for the full list of events.

Next Steps

Default Calling

Implement ringing call flows with accept/reject functionality

Call Session

Configure call settings including idle timeout

Standalone Calling

Implement calling without the Chat SDK