- Alex initiates the call to Bob using the
initiateCall()
method. - Bob now has two choices:
- Accept the call from Alex using the
acceptCall()
method. - Reject the call from Alex using the
rejectCall("rejected")
method passing the status asrejected
.
- In the meantime, Alex has the option to cancel the call he initiated to Bob using the
rejectCall("cancelled")
method passing the status ascancelled
. - If Bob accepts the call from Alex, both Alex and Bob need to call the
startCall()
method. Alex in theonIncomingCallReceived()
method of theCallListener
and Bob in the success obtained from the call toacceptCall()
method and both will be connected to each other.
Initiate Call
TheinitiateCall()
method sends a call request to a user or a group.
Call
class. The constructor for Call
class takes the following parameters:
Properties | |
---|---|
Parameter | Descriptions |
receiverID | The UID or GUID of the recipient |
receiverType | The type of the receiver viz. - user - group |
callType | The type of the receiver viz. - audio - video |
Receive Calls
In order to receive allcall
events, you must add protocol conformance CometChatCallDelegate
as Shown Below :
viewDidLoad()
as CometChat.calldelegate = self
As mentioned in the Overview section, Once the call is initiated, there are three options that can be possible:
- The receiver of the call accepts the call.
- The receiver of the call rejects the call.
- The initiator of the call cancels the call.
user
or in any group
in onIncomingCallReceived(incomingCall:, error:)
, you need to accept the call using the acceptCall()
method.
rejectCall()
method.
Properties | |
---|---|
status | Reason for rejection of the call |
sessionID | The unique session ID available in the Call object |
CometChatConstants.callStatus.rejected
as the call is being rejected by the receiver of the call.
Cancel the Outgoing Call
In the case where the initiator wishes to cancel the call, use the same aboverejectCall()
method and just pass the status to the rejectCall()
method as CometChatConstants.callStatus.cancelled
The possible values for the status can be one of the below:
Description | ||
---|---|---|
status | interpretation | Enum available |
rejected | The receiver rejects the call as it is received without accepting the call | .rejected |
cancelled | The initiator ends the call without the receiver accepting the call | .cancelled |
busy | The receiver rejects the call, as he/she is busy on another call | .busy |
Start a Call
Once the call request is sent and the receiver has accepted the call, both the initiator and the receiver need to call thestartSession()
method.