-
Alex initiates the call to Bob using the
initiateCall()
method. -
Bob now has two choices:
a. Accept the call from Alex using theacceptCall()
method.
b. Reject the call from Alex using therejectCall("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 Integration 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.
Accept the incoming Call
Once you have received an incoming call from auser
or in any group
in onIncomingCallReceived(incomingCall:, error:)
, you need to accept the call using the acceptCall()
method.
Reject the incoming Call
You can also choose to reject the incoming call once it is received using therejectCall()
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 |