Avaya Client SDK

< Back to Package Overview

Answering an Audio Call

Using the Avaya Client SDK, you can easily integrate the ability for users of your application to make and receive audio or video calls.

To receive and answer an incoming audio call, you must complete the following activities.

  • Implement the call service event handlers to monitor for call service events
  • Accept the incoming call

Implement the call service event handlers

In order to get notifications for any incoming calls, your application can define an object that implements the call service delegate methods and set this methods as CallService events (CallService.IncomingCallReceived, CallService.CallRemoved etc.) to receive call service notifications.

class AppCallServiceDelegate {

    void user_IncomingCall(object sender, CallEventArgs e)
    {
        // Called to report that there is an incoming call. 
        // Add code here to handle this incoming call, eg, 
        // update UI to alert user, provide options for handling 
        // the call, ... etc.
    }

    void user_CallRemoved(object sender, CallEventArgs e)
    {
        // Called to report that the call has been removed before 
        // answer.
        // Add code here to handle the removed call, eg, 
        // update UI to remove the call... etc.
    }

    ...
}

You can instantiate a call service delegate (AppCallServiceDelegate) and add it as a delegate to the call service.

AppCallServiceDelegate callServiceDelegate = new AppCallServiceDelegate();
user.CallService.IncomingCallReceived += 
new EventHandler(callServiceDelegate.user_IncomingCall);
user.CallService.CallRemoved += 
new EventHandler(callServiceDelegate.user_CallRemoved);

When there is an incoming call, the AppCallServiceDelegate.user_IncomingCall method is called with a Call object in the arguments. You can instantiate a call handler and add that as a delegate to this call object for handling subsequent call events.

Answer the incoming call

To answer the incoming call, you can call the accept method on the incoming call object.

call.accept();