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 or audio and video, streamed to the controlled Desk 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, VDI Equinox client).

    • supports Audio or Audio and Video 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 CSSharedControlService object is obtained from the Client SDK's CSUser object. Start by obtaining it.

CSSharedControlService *sharedControlService = user.sharedControlService;

Then define an object that implements the <CSSharedControlDelegate> protocol and add this delegate to the CSSharedControlService in order to retrieve a list of active controllable endpoints and to track Shared Control session connection status.

@interface AppSharedControlServiceHandler() 
...
@property (nonatomic, strong) NSArray *controllableEndpoints;
...
@end

@implementation AppSharedControlServiceHandler

    - (void)sharedControlService:(CSSharedControlService*)sharedControlService 
    didFindControllableEndpoints:(NSArray*)endpoints {
        NSLog(@"didFindControllableEndpoints. Number of endpoints: %d", 
            [endpoints count]);
        controllableEndpoints = [NSArray arrayWithArray: endpoints];
    }

    - (void)  sharedControlService:(CSSharedControlService*)sharedControlService 
    didUpdateControllableEndpoints: (NSArray*)endpoints {
        NSLog(@"didUpdateControllableEndpoints. Number of endpoints: %d", 
            [endpoints count]);
        controllableEndpoints = [NSArray arrayWithArray: endpoints];
    }

    - (void)sharedControlServiceDidDetectAllControllableEndpointsUnavailable:
    (CSSharedControlService*)sharedControlService {
        NSLog(@"DidDetectAllControllableEndpointsUnavailable.");
        //no available endpoints, reset list
        controllableEndpoints = nil;
    }



    - (void)sharedControlService:(CSSharedControlService *)sharedControlService
            didConnectToEndpoint:(CSControllableEndpoint *)endpoint {
        // Called to report that connection with the controllable endpoint 
        // has been established.
        NSLog(@"didConnectToEndpoint {%d} {%@}", 
            endpoint.intId, endpoint.URI];
    }

    - (void)sharedControlService:(CSSharedControlService *)sharedControlService
       didDisconnectFromEndpoint:(CSControllableEndpoint *)endpoint
                       withError:(NSError *)error {
        // Called to report that connection with the controllable endpoint
        // has been lost. ", error.userInfo.description];
        NSLog(@"didDisconnectFromEndpoint {%d} {%@} Error description: %@", 
            endpoint.intId, endpoint.URI, error.userInfo.description];
    }

    - (void)sharedControlService:(CSSharedControlService *)sharedControlService
      didFailToConnectToEndpoint:(CSControllableEndpoint *)endpoint
                       withError:(NSError *)error {
        // Called to report that connection with the controllable endpoint
        // has failed. ", error.userInfo.description];
        NSLog(@"didFailToConnectToEndpoint {%d} {%@} Error description: %@", 
            endpoint.intId, endpoint.URI, error.userInfo.description];
    }

    ...

@end

You can instantiate a Shared Control service handler (AppSharedControlServiceHandler) and add it as a delegate to the CSSharedControlService instance.

AppSharedControlServiceHandler* sharedControlServiceHandler = 
    [[AppSharedControlServiceHandler alloc] init];
sharedControlService.sharedControlDelegate = sharedControlServiceHandler;

Activate Shared Control mode

Once you have received Controllable Endpoints List, you are ready to activate Shared Control Mode. Call the activateSharedControlWithControllableEndpoint:completionHandler: method of the CSSharedControlService instance.

[sharedControlService 
    activateSharedControlWithControllableEndpoint:endpoint 
                                completionHandler:^(NSError *error){
        if (error != nil){
            NSLog(@"Activation of shared control failed with the error: %@.", 
                error.userInfo.description);
        }
        else{
            NSLog(@"Shared Control session activated.");
        }
    }
];

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

Deactivate Shared Control mode

To deactivate Shared Control mode, call the deactivateSharedControlWithCompletionHandler method of the CSSharedControlService instance.

[sharedControlService 
    deactivateSharedControlWithCompletionHandler:^(NSError *error){
        if (error != nil){
            NSLog(@"Deactivation of shared control failed with the error: %@.", 
                error.userInfo.description);
        }
        else{
            NSLog(@"Shared Control session deactivated.");
        }
    }
];