Ringing functionality requires the CometChat Chat SDK for Flutter to be integrated alongside the Calls SDK. The Chat SDK handles call signaling (initiating, accepting, rejecting calls), while the Calls SDK manages the actual call session.
How Ringing Works
The ringing flow involves two SDKs working together:- Chat SDK - Handles call signaling (initiate, accept, reject, cancel)
- Calls SDK - Manages the actual call session once accepted
Initiate a Call
Use the Chat SDK to initiate a call to a user or group:Call Timeout
By default, if the receiver does not answer within 45 seconds, the call is automatically marked asunanswered and the caller receives the onOutgoingCallRejected callback. You can customize this duration by passing a timeout parameter (in seconds) when initiating the call.
When the timeout expires without the call being accepted, the SDK automatically:
- Sends an
unansweredcall status to the server. - Triggers the
onOutgoingCallRejectedcallback on the caller’s side with the call status set tounanswered. - Cleans up the call session.
If the call is accepted, rejected, or cancelled before the timeout expires, the timer is automatically stopped and the timeout has no effect.
Listen for Incoming Calls
Register a call listener to receive incoming call notifications:Accept a Call
When an incoming call is received, accept it using the Chat SDK:Reject a Call
Reject an incoming call:Cancel a Call
Cancel an outgoing call before it’s answered:Join the Call Session
After accepting a call (or when your outgoing call is accepted), join the call session using the Calls SDK:In Flutter,
joinSession returns a Widget? through the onSuccess callback. You must place this widget in your Flutter widget tree to render the call UI. See Join Session for more details.End a Call
Properly ending a call requires coordination between both SDKs to ensure all participants are notified and call logs are recorded correctly. When using the default call UI, listen for the end call button click usingButtonClickListener and call endCall():
onCallEndedMessageReceived callback and should leave the session: