Quick Reference for AI Agents & DevelopersAvailable since: v4.1.0
Default timeout: 180 seconds (3 minutes alone)
Warning shown: 60 seconds before auto-termination
Default timeout: 180 seconds (3 minutes alone)
Warning shown: 60 seconds before auto-termination
Overview
CometChat Calls SDK provides a mechanism to handle session timeouts for idle participants. By default, if a participant is alone in a call session for 180 seconds (3 minutes), the following sequence is triggered:- After 120 seconds of being alone in the session, the participant sees a dialog box
-
This dialog provides options to either:
- Stay in the call
- Leave immediately
- If no action is taken within the next 60 seconds, the call automatically ends
Session Timeout Flow
Best Practices
Set Appropriate Timeout Duration
Set Appropriate Timeout Duration
Choose a timeout duration that balances resource management with user experience. 180 seconds (3 minutes) is suitable for most use cases, but consider longer durations for scenarios where users may step away briefly.
Handle onSessionTimeout Gracefully
Handle onSessionTimeout Gracefully
Implement the
onSessionTimeout() callback to clean up resources and navigate users away from the call screen. Show a clear message explaining why the call ended.Inform Users About Timeout Policy
Inform Users About Timeout Policy
Display information about the idle timeout policy in your app’s help section or during onboarding so users understand why calls may auto-terminate.
Test Timeout Behavior
Test Timeout Behavior
Test the timeout flow thoroughly, including the warning dialog and auto-termination, to ensure users have enough time to respond and the experience is smooth.
Troubleshooting
Timeout Occurs Too Quickly
Timeout Occurs Too Quickly
Symptom: Call terminates before the expected timeout period.Cause: The
setIdleTimeoutPeriod() value may be set too low, or the timeout is being triggered by other factors.Solution: Verify the timeout value in your CallSettingsBuilder. Ensure you’re setting the value in seconds (e.g., 300 for 5 minutes). Check that the call isn’t ending due to other reasons like network issues.Warning Dialog Not Appearing
Warning Dialog Not Appearing
Symptom: Call terminates without showing the 60-second warning dialog.Cause: The default UI layout may be disabled, or the dialog is being blocked by custom UI elements.Solution: Ensure
setDefaultLayoutEnable(true) is set in your call settings. Check that no custom views are overlaying the call UI and blocking the dialog.onSessionTimeout Not Called
onSessionTimeout Not Called
Symptom: The
onSessionTimeout() callback is not triggered when the call auto-terminates.Cause: Event listener may not be properly registered or the SDK version doesn’t support this callback.Solution: Verify you’re using SDK v4.1.0 or later. Ensure the event listener is registered using setEventListener() in your call settings before starting the session.