SessionStatusListeners. This listener provides callbacks for session join/leave events, connection status changes, and session timeouts.
Prerequisites
- An active call session
- Access to the
CallSessioninstance
Register Listener
Register aSessionStatusListeners to receive session status callbacks:
Callbacks
onSessionJoined
Triggered when you successfully join a call session.- Update UI to display the call interface
- Start foreground service for ongoing call notification
- Initialize call-related features
onSessionLeft
Triggered when you leave the call session (either by callingleaveSession() or being removed).
- Clean up call-related resources
- Stop foreground service
- Navigate away from call screen
onSessionTimedOut
Triggered when the session times out due to inactivity (e.g., being alone in the call for too long).Configure the timeout period using
setIdleTimeoutPeriod() in SessionSettings. Default is 300 seconds (5 minutes).- Display timeout notification to user
- Clean up resources and navigate away
- Log analytics event
onConnectionLost
Triggered when the connection to the call server is lost (e.g., network issues).- Display “Reconnecting…” indicator
- Disable call controls temporarily
- Log connection issue for debugging
onConnectionRestored
Triggered when the connection is restored after being lost.- Hide reconnecting indicator
- Re-enable call controls
- Show success notification
onConnectionClosed
Triggered when the connection is permanently closed (cannot be restored).- Display error message to user
- Clean up resources
- Navigate away from call screen
Complete Example
Here’s a complete example handling all session status events:Remove Listener
Remove the listener in your widget’sdispose() method to prevent memory leaks:
Callbacks Summary
Next Steps
Participant Event Listener
Handle participant join/leave and state changes
Media Events Listener
Handle recording, screen share, and media state changes