Avaya Client SDK

< Back to Package Overview

Making 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 make an audio call, you must complete the following activities:

  • Create a call object and initialize the details for the call
  • Implement the call event handlers to monitor for call progress events
  • Start the call

Create a call object

Creating a Call object allows you to set various properties for the call before the call is actually placed.

The Call object is created from the CallService.

CallService callService = user.CallService;
Call call = callService.CreateCall();

You can specify the phone number to dial by setting the remote address.

call.RemoteAddress = callNumber;

Implement the call event handlers

To monitor call progress events, the Call events can be used. This events provides notification as the call state changes.


class AppCallDelegate{
    void call_Started(object sender, EventArgs e)
    {
        Call call = (Call)sender;
        // Called to report that call has started (ie, call is in progress).
        // Add code here to update the UI as appropriate.
    }

    void call_RemoteAlerting(object sender, EventArgs e)
    {
        Call call = (Call)sender;
        // Called to report that an outgoing call is ringing at the far end.
        // Add code here to update the UI as appropriate.
    }

    void call_Established(object sender, EventArgs e)
    {
        Call call = (Call)sender;
        // Called to report that an outgoing call has been established 
        // (ie, far end has answered and speechpath has been established).
        // Add code here to update the UI as appropriate.
    }

    void call_Ended(object sender, CallEndedEventArgs e)
    {
        // Called to report that call has ended.
        // Add code here to update the UI as appropriate.
    }
}

You can instantiate an application call delegate (AppCallDelegate) and add that as a delegate to the call.

AppCallDelegate callDelegate = new AppCallDelegate();
call.Started += new EventHandler(callDelegate.call_Started);
call.RemoteAlerting += 
new EventHandler(callDelegate.call_RemoteAlerting);
call.Established += new EventHandler(callDelegate.call_Established);
call.Ended += new EventHandler(callDelegate.call_Ended);

Start the call

Once a call delegate has been added, you can call the Start method on the Call object. Call progress events will be provided through the AppCallDelegate methods.

call.Start();

End the call

To terminate the call, you can call the End method on the Call object.

call.End();

The call_Ended callback event is sent to the call delegate when the call has been ended. You can use this event to update the UI of your application.