Join call via link

Prerequisites#

Call sdk ahould be initialised for the join call feature.

Get Call link#

When you are in ongoing audio/video call, you can get the call link by using the below method, that you can share with other users to join the call.

CallManager.getCallLink();

This method will return a call link as String.

Initialisation#

Whenever you are in the join call UI, you need to initialise the join call setup in the call sdk by calling the below method.

CallManager.setupJoinCallViaLink();

after calling the setupJoinCallViaLink you can initialise your surface view for the video preview like below:

YOUR_SURFACE_VIEW.init(CallManager.getRootEglBase()!!.eglBaseContext, null)
YOUR_SURFACE_VIEW.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL)
YOUR_SURFACE_VIEW.setZOrderMediaOverlay(true)
YOUR_SURFACE_VIEW.setMirror(true)
/* setting Target SurfaceViews to VideoSinks */
CallManager.getLocalProxyVideoSink()?.setTarget(YOUR_SURFACE_VIEW)

Observing join call events#

When you are in the join call UI, you might need to observe the call events to update the UI. You can use the below method to set the observer for the call events from call sdk.

ArgumentTypeDescription
joinCallListenerJoinCallListenerListener to observe the events
CallManager.setJoinCallEventsListener(new JoinCallListener(){
@Override
public void onSubscribeSuccess(){
//enable join call UI button here
}
@Override
public void onLocalTrack(@Nullable VideoTrack videoTrack){
if (videoTrack != null) {
videoTrack.addSink(CallManager.getLocalProxyVideoSink())
}
}
@Override
public void onUsersUpdated(@NonNull List<String> usersList){
// update the users list in ui here
}
@Override
public void onError(@NonNull String reason){
// show the error and close the ui here
}
});

onSubscribeSuccessevent will be fired once subscribeCallEvents() called and there is no failures, in this event only you need to enable the join call button in the UI.

onLocalTrack event will be fired once you called startVideoCapture() from the sdk and all the required permissions are already granted.

onUsersUpdated event will be fired whenever there is a changes in users list for the call, you can use this to update the users list in the join call UI screen as well as you can notify the user that call has been ended when there is no users in the list

onError event will be fired whenever there is a error occurred while joining the call.

info

onUsersUpdated event will be fired with an empty list if the call has been ended you can notify the ui by checking the users count in the list

subscribe the call events#

When you are in the join call UI, you need to subscribe to the call events by using the below method.

ArgumentTypeDescription
CALL_LINKStringCall link for the ongoing call
USER_NAMEStringusername of the current user
LISTENERJoinCallActionListenerlistener for action response
CallManager.subscribeCallEvents(CALL_LINK, USER_NAME, new JoinCallActionListener() {
@Override
public void onSuccess() {
}
@Override
public void onFailure(Error error) {
}
});

if onFailure called, you need to show the error message to the user and close the UI

The error object will contains the error code as well as the description

The above method may return the below error codes, if any error occurred.

TypeError codeDescription
INVALID_CALL_LINK100601Call link is not valid
CALL_ENDED_ALREADY100602Call has been ended already
INTERNAL_SERVER_ERROR100605Server responds with failure response

Starting video capture#

When you are in the join call UI, you can call the below method to start the video capture and also to get the video track from the sdk via onLocalTrack event.

Required permissions:

Manifest.permission.RECORD_AUDIO
Manifest.permission.CAMERA
Manifest.permission.READ_PHONE_STATE
CallManager.startVideoCapture();

Joining the call#

When you are in the join call UI, you can call the below method to start joining in the ongoing audio/video call.

CallManager.joinCall(new JoinCallActionListener() {
@Override
public void onSuccess() {
}
@Override
public void onFailure(@NonNull Error error) {
}
});

clearing join call data#

Whenever you are leaving from the the join call UI, you should call the below method to cleanup the call data. you can preferably call the below method from your activity onDestroy.

CallManager.cleanUpJoinCallViaLink();

Getting unknown user name#

Whenever you are in the ongoing audio/video call a unknown user can also join the call via link. In this case you can get the unknown user name from the call sdk by providing their user id.

ArgumentTypeDescription
USER_IDStringuser id of the unknown user
CallManager.getUserName(USER_ID);

Note: you can use the same mute functions for the preview screen from call features link.

info

Call Sdk requires chat sdk integration for user management.