Avaya Client SDK

< Back to Package Overview

Third party call control for video calls

Overview

Computer telephony integration (CTI, or third party call control 3PCC) is a technology that enables applications to interact with telephones. Avaya Aura Application Enablement Services (AES) implement CTI and allow third party applications to monitor and control SIP endpoints including your Client SDK based application.

Third party applications can use the Telephony Services Application Programming Interface (TSAPI) to access the full complement of the third-party call control capabilities available on Avaya Aura Communication Manager (CM). TSAPI is a public interface to the TSAPI service resident on AES acting as an access server.

Client SDK can receive and handle 3PCC requests to:

  • Place an outgoing call;
  • Answer an incoming call;
  • Put an existing call on hold;
  • Un-hold a held call;
  • Redirect an incoming call to another endpoint;
  • Transfer a call to another endpoint;
  • Make a conference call;
  • Drop user from a conference call;
  • End a call;
  • etc.

Handling 3PCC requests

Client SDK handles the most of 3PCC commands automatically without application involvement. There are only two 3PCC commands which require handling in your application: make video call and answer video call.

Video call establishment requires your application to prepare video devices and video rendering surface, and requires your application to respond to 3PCC requests to accept or start a video call.

To handle these requests your application shall implement the following methods provided by CallServiceListener interface:

  • onStartCallRequestReceived occurs when your application is requested to start a video call;
  • onAcceptCallRequestReceived occurs when your application is requested to answer an incoming video call.

Requested video direction is provided as the argument of video call request. Your application may choose to not apply requested video direction due to missing resources and may change video direction according to available resources.

For example, your application receives 3PCC request to start a video call with SendReceive video mode, but the device does not have a camera plugged in. In this case your application shall update video direction of the call to ReceiveOnly, prepare video rendering surface and finally start the call.

All the other 3PCC commands including start or accept audio-only call are handled by Client SDK automatically using the user-selected (or default) microphone and playback devices.

class AppCallServiceHandler implements CallServiceListener
{
    @Override
    public void onStartCallRequestReceived(CallService callService, 
        Call call, VideoMode videoMode) {

        log("onStartCallRequestReceived(): with CallID {} videoMode:{}", 
            call.getCallId(), videoMode);

        // Place here code to initialize video resources 
        // (e.g., video rendering surface, camera, etc.)

        final Call outgoingCall = call;
        call.setVideoMode(videoMode, new CallCompletionHandler() {
            @Override
            public void onSuccess() {
                outgoingCall.start();
            }

            @Override
            public void onError(CallException e) {
                log("setVideoMode() failed. Error: {}", e.getError());
            }
        });
    }

    @Override
    public void onAcceptCallRequestReceived(CallService callService, 
        Call call, VideoMode videoMode) {

        log("onAcceptCallRequestReceived(): with CallID {} videoMode:{}", 
            call.getCallId(), videoMode);

        // Place here code to initialize video resources 
        // (e.g., video rendering surface, camera, etc.)

        final Call incomingCall = call;
        call.setVideoMode(videoMode, new CallCompletionHandler() {
            @Override
            public void onSuccess() {
                incomingCall.accept();
            }

            @Override
            public void onError(CallException e) {
                log("setVideoMode() failed. Error: {}", e.getError());
            }
        });
    }

    ...
};

If the place or answer call request is for a bidirectional video, but the local camera device cannot be initialized, your client application should proceed with establishing a receive-only video call by first calling Call.setVideoMode(VideoMode.RECEIVE_ONLY), and then calling Call.start() or Call.accept().

If, for some reason, your client application is unable to create a receive-only video call, you should proceed with creating an audio-only call, by first calling Call.setVideoMode(VideoMode.DISABLE), and then calling Call.start() or Call.accept().

At the final step, add the created event handler as a listener to CallService instance.

AppCallServiceHandler callServiceHandler = new AppCallServiceHandler();
CallService callService = mUser.getCallService();
callService.addListener(callServiceHandler);