Call Features

Mute audio in call#

Whenever you are in the audio/video call, you can able to mute the mic so that receiver don't hear your voice or surrounding noise. In order the use the mute faeture you can utilise the call sdk method below:

ArgumentTypeDescription
MUTE_AUDIObooleanPass true,if you want to disable audio else pass false
CallManager.muteAudio(MUTE_AUDIO);

Mute video in call#

Whenever you are in the video call, you can able to turn off the camera so that receiver don't see your video. In order the use the video mute faeture you can utilise the call sdk method below:

ArgumentTypeDescription
MUTE_VIDEObooleanPass true,if you want to disable audio else pass false

Note: The below method accepts CallActionListener as a optional paramter. you can pass the listener to get the response when camera mute/unmute action completed.

CallManager.muteVideo(MUTE_VIDEO);

Check mute status of user in call#

At any time in call, you can able to check the audio/video mute status of the end user in call.

To check the audio muted status, call the below method:

ArgumentTypeDescription
END_USER_JIDStringjid of the end call user
CallManager.isRemoteAudioMuted(END_USER_JID);

To check the video muted status, call the below method:

ArgumentTypeDescription
END_USER_JIDStringjid of the end call user
CallManager.isRemoteVideoMuted(END_USER_JID);

Choose audio output device#

Whenever a user is in call and if they would like to change the output audio device then they can use the below call sdk method to change the output device for the call.

Get available audio devices#

You can get available audio devices by using the below sdk method to show it in your UI.

CallManager.getAudioDevices();

Select audio device#

ArgumentTypeDescription
AUDIO_DEVICEStringany one of values of AudioDevice

The AUDIO_DEVICE device can be any of the below,

AudioDevice.SPEAKER_PHONE
AudioDevice.WIRED_HEADSET
AudioDevice.EARPIECE
AudioDevice.BLUETOOTH
CallManager.setAudioDevice(AUDIO_DEVICE);

Note: whenever you are connected to bluetooth headset while using sdk call, if the gsm call arrives and if you attends it then gsm call will take priority for the bluetooth headset.so, even if you disconnect the gsm call, bluetooth headset will not connect back to the sdk call.

Switching between camera in video call#

Whenever you are in video call, you can able to switch between camera's by using the below method.

CallManager.switchCamera();

Switch audio call to video call#

Whenever you are in one to one audio call, you can able to switch to video call by using the below method.

CallManager.requestVideoCallSwitch();

Handling audio call to video call switch requests#

In your call activity, which you have given to the sdk using the CallManager.setCallActivityClass()

you need to check the below boolean flag in onCreate() as well as in onNewIntent() lifecycle callbacks.

CallManager.isCallConversionRequestAvailable();

if the above method returns true, you may need to show call switch requesting dialog with ACCEPT and REJECT buttons.

if the user accepts call switch then you need to call the below method to notify the call switch requested user.

CallManager.acceptVideoCallSwitchRequest();

if the user rejects call switch then you need to call the below method to notify the call switch requested user.

CallManager.declineVideoCallSwitchRequest();

Getting call logs from the sdk#

Call sdk keeps a local db for storing call logs which inlcudes all types of call logs with required information for the each and every call log. you can able to retrieve the call logs by using the below sdk method.

CallLogManager.getCallLogs(PAGE_NUMBER);
ArgumentTypeDescription
PAGE_NUMBERIntnumber of the page

Note : To get a call logs of respective page, pass the page number pageNumber parameter.

Observing call logs changes from the sdk#

In order to observe the call log changes in sdk, you can set the below listener. Whenever a call log is updated in the db you will get notified by the onCallLogsUpdated() callback.

CallLogManager.setCallLogsListener(() -> {
});
caution

Please don't forget to remove the call logs listener by calling CallLogManager.setCallLogsListener(null) in onDestroy/onDestroyView method of activity/fragment.

Getting missed call count#

Call sdk keeps a local db for storing missed call logs with required information for the each and every call log. you can able to retrieve the missed call count by using the below sdk method.

CallLogManager.getUnreadMissedCallCount();

when the user reads the missed calls in UI, you need notify the sdk using the below method to keep track of the actual unread missed call count.

CallLogManager.markAllUnreadMissedCallsAsRead();

Delete call logs#

Call sdk keeps a local db for storing call logs which inlcudes all types of call logs with required information for the each and every call log. you can able to delete single or all call log by using the below sdk method.

ArgumentTypeDescription
IS_CLEAR_ALLBooleanif true, entire call log will be delete
CALL_LOG_ID_LISTList<String>list of call log id's
CALLBACKChatActionListenercallback to observe the action status
ChatManager.deleteCallLog(IS_CLEAR_ALL, CALL_LOG_ID_LIST, (isSuccess, message) -> {
});

Mute call notifications#

Note: Call notifications are enabled by default.

When the user wants to mute the notifications for call when the app is in background, you can use the below method.

ArgumentTypeDescription
MUTE_STATUSBooleanif true, call notification/ui will not be shown when app is in background
CallManager.muteCallNotification(MUTE_STATUS);

Configuring the call quality parameters#

Note: If you are satisfied with with provided default video call quality configuration, then you not required to configure the call quality parameters. if you are not fine with default video quality configuration then you can use the below methods to tweak the video call quality. Keep in mind that changing the video quality parameters will affect the call data usage.

When the user wants to change the maximum video bitrate for sending video, then you can use the below method.

ArgumentTypeDescription
MAX_BITRATEIntbitrate in kbps
CallManager.setMaxVideoBitrate(MAX_BITRATE);

When the user wants to change the minimum video bitrate for sending video, then you can use the below method.

ArgumentTypeDescription
MIN_BITRATEIntbitrate in kbps
CallManager.setMinVideoBitrate(MIN_BITRATE);

Note: Sdk has adaptive bitrate implementation which will optimise the videobitrate based on the network quality. The maximum bitrate value MAX_BITRATE will be used at first for video calls, if the sdk detects slow internet it will reduce upto minimum video bitrate value MIN_BITRATE. When the internet speed increases, sdk will automatically increase video bitrate upto the maximum bitrate value MAX_BITRATE.

When the user wants to change the video resolutions based on the user count for video calls, then you can use the below method.

ArgumentTypeDescription
VIDEO_RESOLUTION_ADJUSTERVideoWidthHeightAdjusterImplementation which will be used to configure video resolution based on users count
CallManager.setVideoWidthHeightAdjuster(VIDEO_RESOLUTION_ADJUSTER);

Default implementation for VideoWidthHeightAdjuster will look like below, you can use this to implement your own VideoWidthHeightAdjuster. All the values are in pixels.

/**
* Default implementation of video width height adjuster
*/
public class DefaultVideoWidthHeightAdjuster implements VideoWidthHeightAdjuster {
@Override
public int getVideoHeightConstraint(int usersCount) {
switch (usersCount){
case 1:
case 2:
return 640; //px
case 3:
return 320;
case 4:
return 240;
default:
return 160;
}
}
@Override
public int getVideoWidthConstraint(int usersCount) {
switch (usersCount){
case 1:
case 2:
return 360; //px
case 3:
return 240;
case 4:
return 160;
default:
return 120;
}
}
}

Note: As per the default implementation above, for 1 or 2 users it will return a resolution of 640*360 which will be used for one to one video calls.

Implementing Speaking Indicators in UI#

Call sdk provides speaking related events to the UI. By observing the speaking events user can able to easily implement the speaking indicators in UI.

when user is speaking in call, the below event will be triggered from the sdk.

call sdk will trigger onUserSpeaking event for all the speaking users including the current user.

@Override
public void onUserSpeaking(@NonNull String userJid, int audioLevel) {
}

userJid will be the userId of the user who is speaking and audioLevel value will be in the range of 1..10. When the call users speaks louder, we will get a higher values and vice versa.

when user is stopped speaking in call, the below event will be triggered from the sdk. Sdk will trigger onUserStoppedSpeaking event for all the users who just stopped speaking including the current user.

@Override
public void onUserStoppedSpeaking(@NonNull String userJid) {
}

userJid will be the userId of the user who just stopped speaking.

info

Call Sdk requires chat sdk integration for user management.