Skip to main content
Implement incoming and outgoing call notifications with accept/reject functionality. Ringing enables real-time call signaling between users, allowing them to initiate calls and respond to incoming call requests.
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:
  1. Chat SDK - Handles call signaling (initiate, accept, reject, cancel)
  2. Calls SDK - Manages the actual call session once accepted
Ringing imports BOTH SDKs, and both declare User. cometchat_calls_sdk and cometchat_sdk each export a User class, so importing both barrels makes the name ambiguous and the file will not compile. Hide it from one import:
Pick whichever side your code actually uses; the Chat SDK’s User is the one the signalling callbacks hand you.

Initiate a Call

Use the Chat SDK to initiate a call to a user or group:

Call Timeout

If the receiver does not answer, the call is eventually marked unanswered and the caller receives the onOutgoingCallRejected callback.
The timeout is server-side and cannot be set from the client. CometChat.initiateCall takes only the Call object plus onSuccess / onError — there is no timeout parameter in the Flutter SDK. To end an unanswered call earlier than the server does, cancel it yourself with CometChat.rejectCall(sessionId, CometChatCallStatus.cancelled) on a timer you own.

Listen for Incoming Calls

Register a call listener to receive incoming call notifications:
Remember to remove the call listener when it’s no longer needed to prevent memory leaks. In Flutter, you must manually remove listeners in your widget’s dispose() method:

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.
Always call CometChat.endCall() when ending a call. This notifies the other participant and ensures the call is properly logged. Without this, the other user won’t know the call has ended and call logs may be incomplete.
When using the default call UI, listen for the end call button click using ButtonClickListeners and call endCall():
The other participant receives onCallEndedMessageReceived callback and should leave the session:

Call Status Values