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.Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
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:| Parameter | Type | Description |
|---|---|---|
receiverID | String | UID of the user or GUID of the group to call |
receiverType | String | CometChatConstants.receiverTypeUser or receiverTypeGroup |
callType | String | CometChatConstants.callTypeVideo or callTypeAudio |
timeout | int | Optional. The timeout duration in seconds for the call to be answered before it’s automatically cancelled. Defaults to 45 seconds. |
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.
| Parameter | Type | Description |
|---|---|---|
call | Call | The call object with receiver and call type details |
timeout | int | Time in seconds to wait before marking the call as unanswered. Defaults to 45. Values ≤ 0 fall back to the default 45 seconds. |
- 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:| Callback | Description |
|---|---|
onIncomingCallReceived | A new incoming call is received |
onOutgoingCallAccepted | The receiver accepted your outgoing call |
onOutgoingCallRejected | The receiver rejected your outgoing call, or the call timed out as unanswered |
onIncomingCallCancelled | The caller cancelled the incoming call |
onCallEndedMessageReceived | The call has ended |
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:
Call Status Values
| Status | Description |
|---|---|
initiated | Call has been initiated but not yet answered |
ongoing | Call is currently in progress |
busy | Receiver is busy on another call |
rejected | Receiver rejected the call |
cancelled | Caller cancelled before receiver answered |
ended | Call ended normally |
missed | Receiver didn’t answer in time |
unanswered | Call was not answered within the timeout duration |