Making a call

Make a call#

Call feature is essential for the modern day communication. Call sdk allows users to make a one to one audio/video call with the another sdk user.

Note: Check Permissions Before Working in Call Feature.

Required permissions#

For audio call, the below permissions:

Microphone Permission

For video call, we need below permissions:

Microphone Permission
Camera Permission

Make a Voice Call#

To make a one to one voice call, call the below method.

Mirrorfly.makeVoiceCall(toUserJid: USER_JID, flyCallBack: (FlyResponse response) {
if (response.isSuccess) {
}
});
ArgumentTypeDescription
USER_JIDStringJid of another registered user
flyCallbackFlyResponsecallback to observe the action status
caution

If one to one call feature unavailable for your plan then it will throw 403 exception.

Make a video call#

Make video call feature allows users to make a one to one video call with the another sdk user. You can make a video call using the below method.

Mirrorfly.makeVideoCall(toUserJid: USER_JID, flyCallBack: (FlyResponse response) {
if (response.isSuccess) {
}
});
ArgumentTypeDescription
USER_JIDStringJid of another registered user
caution

If one to one call feature unavailable for your plan then it will throw 403 exception.

Make a group voice call#

Make group voice call feature allows users to make a voice call with multiple users. You can make a group voice call using the below method.

Mirrorfly.makeGroupVoiceCall(groupJid: GROUP_JID, toUserJidList: USER_LIST, flyCallBack: (FlyResponse response) {
if (response.isSuccess) {
}
});
ArgumentTypeDescription
GROUP_JIDStringJid of the group from which call is initiated, empty if made outside the Group Chat
USER_LISTStringJid List of Callee's
flyCallbackFlyResponsecallback to observe the action status

Make a group video call#

Make group video call feature allows users to make a video call with multiple users. You can make a group video call using the below method.

Mirrorfly.makeGroupVideoCall(groupJid: GROUP_JID, toUserJidList: USER_LIST, flyCallBack: (FlyResponse response) {
if (response.isSuccess) {
}
});
ArgumentTypeDescription
USER_LISTStringJid List of Callee's
GROUP_JIDStringJid of the group from which call is initiated, empty if made outside the Group Chat
flyCallbackFlyResponsecallback to observe the action status
caution

If group call feature unavailable for your plan then it will throw 403 exception.

Add participants to the call#

After call is connected, you can able to add more users to the ongoing call. You can use the following methods to invite users to the call, once they accepted the incoming call, they will join in the ongoing call.

Mirrorfly.inviteUsersToOngoingCall(jidList: USER_LIST);
ArgumentTypeDescription
USER_LIST<String>Jid List of Callee's

Receiving a incoming audio/video call#

Whenever you receive the audio/video call from the another sdk user, it will be reported to SDK and Incoming Call Notification will be displayed from Plugin.

Answer the incoming call#

Once the Call is being presented with Accept/Reject Call buttons, we can either choose to attend or reject the call. If we attend the call the below event listener onCallStatusUpdated will be triggered, and the status will be of the case Attended.

Mirrorfly.onCallStatusUpdated.listen((event) {
var statusUpdateReceived = jsonDecode(event);
var callMode = statusUpdateReceived["callMode"].toString();
var userJid = statusUpdateReceived["userJid"].toString();
var callType = statusUpdateReceived["callType"].toString();
var callStatus = statusUpdateReceived["callStatus"].toString();
});
ArgumentTypeDescription
callModeStringFor this callMode OneToOne or groupCall will be returned from SDK
userJidStringFor this userJID will be returned from SDK
callTypeStringFor this callType Video or Audio will be returned from SDK
callStatusCallStatusAn enum class defines the current status of the call

Note: if the required permissions are not available then call be will be automatically declined even though you answered a call in Android.

Disconnect the ongoing call#

Whenever you make the audio/video call to the another sdk user and you just want to disconnect the call before getting connected or If you want to just disconnect a connected call after the end of conversation, whenever user presses the disconnect button from your call UI , you need to call the below sdk method to disconnect the call and notify the caller.

Mirrorfly.disconnectCall(flyCallBack: (FlyResponse response) {
if (response.isSuccess) {
}
});