Avaya Client SDK

< Back to Package Overview

Shared Control Service

Overview

Shared Control Mode enables your application to control your registered desk phone (Hard Phone), soft phone application. Your application can place outgoing calls and answer incoming calls using your application specify the media, audio, streamed to the controlled Desk Phone or soft phone.

The Shared Control Service has two main entities:

  • Controlled Endpoint: Avaya SIP endpoints (soft/hard phone) which register to the system indicating support of Shared Control mode as a Controlled endpoint (e.g. 96x1 desk phone, Jxxx desk phone, Workplace as VDI client).

    • supports Audio calls;
    • supports establishing Shared Control Session as a Controlled endpoint;
    • supports call control commands from controlling endpoint;
    • notifies Controlling endpoint about new calls and call state updates.
  • Controlling Endpoint: Avaya SIP endpoints which register to the system indicating support of Shared Control mode as a Controlling endpoint (e.g. Client SDK based client).

    • discovers the list of available Controllable endpoints;
    • allows to activate Shared Control mode with a selected endpoint (establishing Shared Control Session);
    • allows to deactivate Shared Control mode;
    • provides controls to manage calls on the Controlled endpoint (placing an outgoing call, answering incoming call and so on).
    • provides information about calls and call state updates on the Controlled endpoint.

Shared Control mode can be activated using Shared Control Service.

It is recommended that your application should not activate a Shared Control session while the local client is currently involved in a call.

Obtain Controllable endpoints list

The SharedControlService object is obtained from the Client SDK's User object. Start by obtaining it.

SharedControlService sharedControlService = user.SharedControlService;

Then implement handlers for Shared Control events in order to retrieve a list of active controllable endpoints and to track Shared Control session connection status.

private void OnControllableEndpointsAvailable(object sender, 
    UccControllableEptAvailabilityEventArgs e)
{
    Log("OnControllableEndpointsAvailable. Number of endpoints: {0}", 
        controllableEndpointsList.Count().ToString());
    controllableEndpointsList = e.UccControllableEndpoints;
}

private void OnControllableEndpointsUpdated(object sender, 
    UccControllableEptAvailabilityEventArgs e)
{
    Log("OnControllableEndpointsUpdated. Number of endpoints: {0}", 
        controllableEndpointsList.Count().ToString());
    controllableEndpointsList = e.UccControllableEndpoints; 
}

private void OnControllableEndpointsUnavailable(object sender, 
    EventArgs eventArgs)
{
    Log("OnControllableEndpointsUnavailable. No Endpoint available");
    //no available endpoints, reset list
    controllableEndpointsList = 
        new ReadOnlyCollection(
            new List());
}

private void OnSharedControlSessionConnected(object sender, 
    SharedControlSessionConnectEventArgs e)
{
    Log("OnSharedControlSessionConnected. Endpoint: {0} {1}", 
        e.Endpoint.Id.ToString(), e.Endpoint.URI.ToString());
}

private void OnSharedControlSessionDisconnected(object sender, 
    SharedControlSessionEventArgs e)
{
    Log("OnSharedControlSessionDisconnected. Endpoint: {0} {1}  Reason: {2}",
        e.Endpoint.Id.ToString(), e.Endpoint.URI.ToString(), 
        e.Reason.ToString());
}

private void OnSharedControlSessionSetupFailed(object sender, 
    SharedControlSessionEventArgs e)
{
    Log("OnSharedControlSessionSetupFailed. Endpoint: {0} {1}  Reason: {2}",
        e.Endpoint.Id.ToString(), e.Endpoint.URI.ToString(), 
        e.Reason.ToString());
}

Add the created event handlers to SharedControlService instance.

sharedControlService.ControllableEndpointsAvailable += 
    OnControllableEndpointsAvailable;
sharedControlService.ControllableEndpointsListUpdated += 
    OnControllableEndpointsUpdated;
sharedControlService.ControllableEndpointsUnavailable += 
    OnControllableEndpointsUnavailable;

sharedControlService.SharedControlSessionConnected += 
    OnSharedControlSessionConnected;
sharedControlService.SharedControlSessionDisconnected += 
    OnSharedControlSessionDisconnected;
sharedControlService.SharedControlSessionSetupFailed +=
    OnSharedControlSessionSetupFailed;

Activate Shared Control mode

Once you have received Controllable Endpoints List, you are ready to activate Shared Control Mode. First, implement completion handler for this operation.

private void ActivateSharedControlCompletionHandler(
    SharedControlCompletionHandlerEventArgs error)
{
    if (error != null)
    {
        Log(string.Format(
            "ActivateSharedControl error Reason={0} ProtocolResponseCode={1} " + 
            "ProtocolReason={2} ProtocolWarningCode={3} ProtocolWarning={4}",
            error.Reason, error.ProtocolResponseCode, error.ProtocolReason, 
            error.ProtocolWarningCode, error.ProtocolWarning));
    }
    else
    {
        Log("Shared Control session activated");
    }
}

Then call the ActivateSharedControl method of the SharedControlService instance.

if (controllableEndpointsList.Count > 0)
{
    sharedControlService.ActivateSharedControl(
        controllableEndpointsList.LastOrDefault(), 
        ActivateSharedControlCompletionHandler);
}

After Shared Control mode activation completes, you can make or answer calls using CallService API as usual to originate and answer calls.

Deactivate Shared Control mode

To deactivate Shared Control mode, implement completion handler for this operation.

private void DeactivateSharedControlCompletionHandler(
    SharedControlCompletionHandlerEventArgs error)
{
    if (error != null)
    {
        Log("DeactivateSharedControl failed: {0}", 
            error.ProtocolReason.ToString());
    }
    else
    {
        Log("DeactivateSharedControl succeeded.");
    }
}

Then call the DeactivateSharedControl method of the SharedControlService instance.

sharedControlService.DeactivateSharedControl(
    DeactivateSharedControlCompletionHandler);