Call Features

Audio Mute/Unmute#

Pass the boolean value true for mute & false for unmute into muteAudio method.

await SDK.muteAudio(BOOLEAN);

Request Params#

ParamDescriptionTypeRequired
BOOLEANtrue - Mute the audio
false - Unmute the audio
BOOLEANtrue

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Video Mute/Unmute#

Pass the boolean value true for mute & false for unmute into muteVideo method.

await SDK.muteVideo(BOOLEAN);

Request Params#

ParamDescriptionTypeRequired
BOOLEANtrue - Mute the video
false - Unmute the video
BOOLEANtrue

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Invite users#

Invite users by providing the callee’s user JID in array format into the inviteUsers method.

caution

If GroupCall feature is unavailable for your plan, then it will throw 403 exception

await SDK.inviteUsers(['USER1_JID', 'USER2_JID'...]);

Request Params#

ParamDescriptionTypeRequired
[USER_JID]Invite users JID list in array formatArraytrue

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Video Call Switch#

To initiate the video call switch process, a callSwitchListener callback should already be registered in the client app to receive the request, accept, decline & cancel status information. Because whenever user perform any action related to this call switch, Client app will receive the user action status in this callback.

Request the Call Switch#

To send the call switch request, call the requestVideoCallSwitch method.

await SDK.requestVideoCallSwitch();

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Cancel the request#

To cancel the call switch request which is aready sent to the remote user, call the cancelVideoCallSwitchRequest method.

await SDK.cancelVideoCallSwitchRequest();

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Accept the request#

To accept the call switch request, call the acceptVideoCallSwitchRequest method.

await SDK.acceptVideoCallSwitchRequest();

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Decline the request#

To decline the call switch request, call the declineVideoCallSwitchRequest method.

await SDK.declineVideoCallSwitchRequest();

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Get Call Logs Details#

Get the call logs details by calling getCallLogs method.

await SDK.getCallLogs('PAGE_NUMBER');

Request Params#

ArgumentsDescriptionType
pageNumberPage numberNumber

Response Format#

{
statusCode: `STATUS_CODE`,
message: `ERROR|SUCCESS message`,
data: {
callLogs: [ // array of object
{
callMode: "onetoone|onetomany",
callState: 1
callTime: 1687942398316000,
callType: "audio|video",
callerDevice: "WEB",
endTime: 1687942643614000,
fromUser: "FROM_USER_JID",
groupId: ""|GROUP_ID,
inviteUserList: "",
roomId: "937a8b33-fe33-4d93-b0e4-00716aed3cbb",
sessionStatus: "closed",
startTime: 1687942407172000,
toUser: "TO_USER_JID",
userList: "USER_JID"
}
],
totalPages: 'NUMBER'
},
}

Response Params#

ArgumentsDescriptionType
dataObject of ArrayObject
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Display Browser Notification#

Display the browser notification by providing the notification object into the showCallNotification method. Notification would display when a user receive a call or end call while user on different screen instead of on webchat application screen.

SDK.showCallNotification(`NOTIFICATION_OBJECT`);
// Exmple
SDK.showCallNotification({
title: `NOTIFICATION_TITLE`, // Title of the notification
body: `NOTIFICATION_BODY`, // Body of the notification
onClick: `CALLBACK_METHOD`, // Callback will be triggered when user click on notification
forceShow: `BOOLEAN` // Display the notification in all cases set this value as TRUE
});

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Call Join Via Link#

Get call link#

When you are in ongoing audio/video call, you can get the call link by using getCallLink method. This method will return call link when you are connected to a call or else it will return error.

SDK.getCallLink();

Response Format#

{
statusCode: `STATUS_CODE`,
message: `ERROR|SUCCESS message`,
data: "ehl-niyc-wcc"
}

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString
dataCall link to share with the others to join the ongoing callString

Subscribe call#

Subscribe a call by providing the room link and users display name into the subscribeCall method. A callback method also need to given as an input to handle the success/error of this method. It will hold the success and error object as params.

Once the call subscribed successfully, callback with the success object will be triggered. After this callback success, you can show the Join Now button in the screen.

Same time callUsersUpdateListener will also triggered that will hold the list of users on the call. You can use this event to show the users list in the preview screen. This event callUsersUpdateListener will be triggered whenever there is a change in users list. So you can add/remove users from the preview UI. If callUsersUpdateListener triggered with empty users list, then the call has been ended. You need to close the preview screen and show the message like Call Ended.

If the callback with the error object is triggered, then there is some issue in subscribing the call. You can get the error code and error message from the error object. Based on that you can show alerts or redirect to any other screen in the UI.

SDK.subscribeCall('CALL_LINK', 'USERNAME', 'CALLBACK');
// Example
SDK.subscribeCall('CALL_LINK', 'USERNAME', (success, error) => {
if(error){
console.log(error.message)
} else {
// You can proceed with the success response
}
});

Request Params#

ParamDescriptionTypeRequired
CALL_LINKCall linkStringtrue
USERNAMEDisplay Name of the current userStringtrue
CALLBACKCallback method to handle success/errorFunctiontrue

Success/Error Object#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Join a call#

When you are in the preview screen, to join a call use the joinCall method.

A callback method need to given as an input to handle the success/error of this method. It will hold the success and error object as params. Once the call joined successfully, callback with the success object will be triggered. Then you will receive the normal call events.

If the callback with the error object is triggered, then there is some issue in joining the call. You can get the error code and error message from the error object. Based on that you can show alerts or redirect to any other screen in the UI.

SDK.joinCall('CALLBACK');
// Example
SDK.joinCall((success, error) => {
if(error){
console.log(error.message)
} else {
// You can proceed with the success response
}
});

Request Params#

ParamDescriptionTypeRequired
CALLBACKCallback method to handle success/errorFunctiontrue

Success/Error Object#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Unsubscribe a call#

When you are in the preview screen and decided to close the UI without joining the call, you need to clear/unsubscribe the call data by using the unsubscribeCall method.

await SDK.unsubscribeCall();

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess MessageString

Get call users username#

When you are in ongoing audio/video call or in the preview screen for joining the call, you can get the call user's username by using getCallUsername method. This method will return username when you are connected/subscribed to a call or else it will return error.

await SDK.getCallUsername(USER_ID);

Request Params#

ParamDescriptionTypeRequired
USER_IDUser id of the userStringtrue

Response#

Username of the user is shown in the UI.