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

Inivite users#

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

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

Send the Custom Data#

To send the custom data to other users in call by providing the data which user want to pass as a argument into sendCustomData method. Once a user send the custom data, a customDataListener callback will be triggered and sent data will be received in the first argument of this callback.

SDK.sendCustomData('DATA');
// Example
// SDK.sendCustomData({prop1:'val1', prop2:'val2'}); -- Send object
// SDK.sendCustomData(['val1', 'val2']); -- Send array

Request Params#

ParamDescriptionTypeRequired
DATACustom data. User could send any type of data such as OBJECT, STRING, ARRAY, BOOLEANanytrue

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
// Sample Response
{
data: [], // array of object
message: `ERROR|SUCCES message`,
statusCode: `STATUS_CODE`,
}

Response Params#

ArgumentsDescriptionType
dataArray of objectArray
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 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 to show in the UI.