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.
- Caller initiates a call using
initiateCall() - Receiver gets notified via
onIncomingCallReceived()callback - Receiver can either:
- Accept the call using
acceptCall() - Reject the call using
rejectCall()with statusCALL_STATUS_REJECTED
- Accept the call using
- Caller can cancel the call using
rejectCall()with statusCALL_STATUS_CANCELLED - Once accepted, both participants call
startSession()to join the call
Initiate Call
TheinitiateCall() method sends a call request to a user or a group. On success, the receiver gets an onIncomingCallReceived() callback.
On success, a
Call object is returned containing the call details including a unique sessionId required for starting the call session.
Call Listeners
Register theCallListener to receive real-time call events. Each listener requires a unique listenerId string to prevent duplicate registrations and enable targeted removal.
Events
Accept Call
When an incoming call is received viaonIncomingCallReceived(), use acceptCall() to accept it. On success, start the call session.
Reject Call
UserejectCall() 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 usingrejectCall() with status CALL_STATUS_CANCELLED.
Start Call Session
Once the call is accepted, both participants need to start the call session. Caller flow: In theonOutgoingCallAccepted() callback, generate a token and start the session.
Receiver flow: In the acceptCall() success callback, generate a token and start the session.
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, theonCallEndButtonPressed() callback is triggered. Inside this callback, call CometChat.endCall() to notify other participants. On success, call CometChat.clearActiveCall() and CometChatCalls.endSession() to release resources.
onCallEnded() callback):
Busy Call Handling
If the receiver is already on another call, you can reject the incoming call withCALL_STATUS_BUSY status.