Appearance
Easy Call Control
The recommended way for integrating call control with Jabra headsets into a softphone is to use our Easy Call Control (multi-call option) which is part of the JavaScript SDK.
Legacy CallControl and Easy Call Control (single-call option)
If you have an existing softphone integration using the legacy CallControl or Easy Call Control (single-call option), you can keep using that and it is fully supported. However, for all new integrations, we strongly recommend basing only on Easy Call Control (multi-call option).
Easy Call Control offers a high-level abstraction for call control integrations and is intended to be quick and easy to integrate with no need to understand the complexities of signals to and from headsets.
Once Easy Call Control is set up for a device, you can change the call state using high-level methods. Likewise, you can subscribe to events from Easy Call Control letting you know what state the device has requested.
Call control live sample and code
See code samples for a complete live demo implementation of Easy Call Control.
Setup Easy Call Control
The @gnaudio/jabra-js npm package contains the core SDK including everything needed for call control integrations. See Getting Started for instructions on how to install the SDK and set up your project.
To set up Easy Call Control for a device, you should first check that the device supports call control and then create an instance of Easy Call Control.
js
// Create an Easy Call Control Factory from your
// instance of the IApi you got when initializing SDK.
const easyCallControlFactory = new EasyCallControlFactory(jabraSdk);
// If the device supports Easy Call Control, enable it.
if (easyCallControlFactory.supportsEasyCallControl(device)) {
/**@type {import('@gnaudio/jabra-js').IMultiCallControl} */
const easyCallControl = await easyCallControlFactory.createMultiCallControl(device);
};Subscribe to events
By listening to these events your application can keep track of the call state of the device and update your application's state accordingly.
js
// OngoingCalls is the number of ongoing calls on the device. This includes active and held calls.
easyCallControl.ongoingCalls.subscribe((ongoingCalls) =>
{
// (...)
});
// MuteState is the microphone mute state of the device.
easyCallControl.muteState.subscribe((muteState) =>
{
// (...)
});
// HoldState indicates if call is on hold or not.
easyCallControl.holdState.subscribe((holdState) =>
{
// (...)
});
// SwapRequest is called when the user wants to swap between two calls.
easyCallControl.swapRequest.subscribe(() =>
{
// (...)
});Change call state
By using these methods you can update the Jabra device with state changes from your application.
js
// New incoming call
// The async call to signalIncomingCall() will not resolve
// until the call is either accepted or rejected.
console.log("signalIncomingCall()");
const callAcceptedResult = await easyCallControl.signalIncomingCall();
if (callAcceptedResult) {
console.log("signalIncomingCall() - Call accepted");
} else {
console.log("signalIncomingCall() - Call rejected");
};js
// Accept incoming call.
// Note there is an optional parameter in case of multiple calls to specify whether to
// accept and hang up current call, or accept and put current call on hold.
await easyCallControl.acceptIncomingCall();js
// Reject incoming call.
await easyCallControl.rejectIncomingCall();js
// New outgoing call
await easyCallControl.startCall();js
// End active call
await easyCallControl.endCall();js
// Put active call on hold
await easyCallControl.hold();js
// Resume call from held state
await easyCallControl.resume();js
// Mute headset microphone
await easyCallControl.mute();js
// Unmute headset microphone
await easyCallControl.unmute();