Easy Call Control Initialization
To use call control functionalities via the Easy Call Control module, you must first initialize the module using the EasyCallControlFactory
class. This class provides helper functions for taking control over IDevice
instances and gives access to call control for the device.
The Easy Call Control module can be initialized with either Single Call or Multiple Call functionalities.
Option A) Single Call
To initialize the module with Single Call functionalities, see the following code sample.
using Jabra.NET.Sdk.Core;
using Jabra.NET.Sdk.Modules.EasyCallControl;
using Jabra.NET.Sdk.ToolsAndHelpers;
namespace InitializeECCSingleCall
{
class ECCSingleCall
{
static async Task Main()
{
// Initialize the Jabra SDK
try
{
var jabraCore = Init.InitSdk(new Config());
// Set up for ISingleCallControl
var easyCallControlFactory = new EasyCallControlFactory(jabraCore);
// Whenever the core module detects new devices
jabraCore.DeviceAdded.Subscribe(
async device =>
{
// Create Easy Call Control for single call handling
if (easyCallControlFactory.SupportsEasyCallControl(device))
{
var singleCallControl = await easyCallControlFactory.CreateSingleCallControl(device);
// Call single-call-control related functionality, for example
// Start a call, wait five seconds, end the call.
await singleCallControl.StartCall();
System.Threading.Thread.Sleep(5000);
await singleCallControl.EndCall();
// etc.
}
});
}
catch (JabraException ex)
{
Debug.WriteLine(ex.Message);
}
// Prevent the app from terminating, to allow for attaching and detaching.
await Task.Delay(System.Threading.Timeout.Infinite);
}
}
}
Option B) Multiple Call
To initialize the module with Multiple Call functionalities, see the following code sample.
using Jabra.NET.Sdk.Core;
using Jabra.NET.Sdk.Modules.EasyCallControl;
using Jabra.NET.Sdk.ToolsAndHelpers;
namespace InitializeECCMultiCall
{
class ECCMultiCall
{
static async Task Main()
{
// Initialize the Jabra SDK
try
{
var jabraCore = Init.InitSdk(new Config());
// Set up for ISingleCallControl
var easyCallControlFactory = new EasyCallControlFactory(jabraCore);
// Whenever the core module detects new devices
jabraCore.DeviceAdded.Subscribe(
async device =>
{
// Create Easy Call Control for multi call handling
// Note different creation method from the previous example
if (easyCallControlFactory.SupportsEasyCallControl(device))
{
var multiCallControl = await easyCallControlFactory.CreateMultiCallControl(device);
// Call multi-call-control related functionality, for example
// Start a call, wait five seconds, put call on hold, wait, resume, wait, then end the call.
await multiCallControl.StartCall();
System.Threading.Thread.Sleep(5000);
await multiCallControl.Hold();
System.Threading.Thread.Sleep(5000);
await multiCallControl.Resume();
System.Threading.Thread.Sleep(5000);
await multiCallControl.EndCall();
// etc.
}
});
}
catch (JabraException ex)
{
Debug.WriteLine(ex.Message);
}
// Prevent the app from terminating, to allow for attaching and detaching.
await Task.Delay(System.Threading.Timeout.Infinite);
}
}
}