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 delegate to monitor for call service events
  • Accept the incoming call

Implement the call service delegate

In order to get notifications for any incoming calls, your application can define an object that implements the <CSCallServiceDelegate> protocol and add this delegate to the CSCallService object to receive call service notifications.

@interface AppCallServiceHandler() 
...
@end

@implementation AppCallServiceHandler

    - (void)   callService:(CSCallService *)callService 
    didReceiveIncomingCall:(CSCall *)call {
        // 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)callService:(CSCallService *)callService 
          didRemoveCall:(CSCall *)call {
        // 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.
    }

    ...

@end

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

AppCallServiceHandler* callServiceHandler = 
    [[AppCallServiceHandler alloc] init];
CSCallService* callService = user.callService;
callService.delegate = callServiceHandler;

When there is an incoming call, the callService:didReceiveIncomingCall: method is called with a CSCall 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];