Skip to main content

Overview

This section explains how to implement a complete calling workflow with ringing functionality, including incoming/outgoing call UI, call acceptance, rejection, and cancellation. Previously known as Default Calling.
After the call is accepted, you need to start the call session. See the Call Session guide for details on starting and managing the actual call.
Call Flow:
  1. Caller initiates a call using initiateCall()
  2. Receiver gets notified via onIncomingCallReceived() callback
  3. Receiver can either:
    • Accept the call using acceptCall()
    • Reject the call using rejectCall() with status CALL_STATUS_REJECTED
  4. Caller can cancel the call using rejectCall() with status CALL_STATUS_CANCELLED
  5. Once accepted, both participants call startSession() to join the call

Initiate Call

The initiateCall() method sends a call request to a user or a group. On success, the receiver gets an onIncomingCallReceived() callback.
ParameterDescription
receiverIDThe UID or GUID of the recipient
receiverTypeThe type of the receiver: CometChatConstants.RECEIVER_TYPE_USER or CometChatConstants.RECEIVER_TYPE_GROUP
callTypeThe type of the call: CometChatConstants.CALL_TYPE_AUDIO or CometChatConstants.CALL_TYPE_VIDEO
On success, a Call object is returned containing the call details including a unique sessionId required for starting the call session.

Call Listeners

Register the CallListener to receive real-time call events. Each listener requires a unique listenerId string to prevent duplicate registrations and enable targeted removal.

Events

EventDescription
onIncomingCallReceived(call: Call)Invoked when an incoming call is received. The call contains caller details, session ID, and call type. Display incoming call UI here.
onOutgoingCallAccepted(call: Call)Invoked on the caller’s device when the receiver accepts. Generate call token and start the session here.
onOutgoingCallRejected(call: Call)Invoked on the caller’s device when the receiver rejects the call. Dismiss outgoing call UI here.
onIncomingCallCancelled(call: Call)Invoked on the receiver’s device when the caller cancels before answering. Dismiss incoming call UI here.
onCallEndedMessageReceived(call: Call)Invoked when a call ends. The call contains final status and duration. Update call history here.

Accept Call

When an incoming call is received via onIncomingCallReceived(), use acceptCall() to accept it. On success, start the call session.

Reject Call

Use rejectCall() to reject an incoming call. Set the status to CALL_STATUS_REJECTED.

Cancel Call

The caller can cancel an outgoing call before it’s answered using rejectCall() with status CALL_STATUS_CANCELLED.

Start Call Session

Once the call is accepted, both participants need to start the call session. Caller flow: In the onOutgoingCallAccepted() callback, generate a token and start the session. Receiver flow: In the acceptCall() success callback, generate a token and start the session.
For more details on call settings and customization, see the Call Session guide.

End Call

To end an active call in the ringing flow, the process differs based on who ends the call. User who ends the call: When the user presses the end call button, the onCallEndButtonPressed() callback is triggered. Inside this callback, call CometChat.endCall() to notify other participants. On success, call CometChat.clearActiveCall() and CometChatCalls.endSession() to release resources.
Remote participant (receives onCallEnded() callback):
For more details, see the End Call Session guide.

Busy Call Handling

If the receiver is already on another call, you can reject the incoming call with CALL_STATUS_BUSY status.