Skip to content

2.11.0

Latest
Compare
Choose a tag to compare
@charliesantos charliesantos released this 02 May 16:46
· 1 commit to master since this release

2.11.0 (May 2, 2024)

New Features

Chrome Extensions Manifest V3 Support

In Manifest V2, Chrome Extensions have the ability to run the Voice JS SDK in the background when making calls. But with the introduction of Manifest V3, running the Voice JS SDK in the background can only be achieved through service workers. Service workers don't have access to certain features such as DOM, getUserMedia, and audio playback, making it impossible to make calls with previous versions of the SDK.

With this new release, the SDK can now run in a service worker context to listen for incoming calls or initiate outgoing calls. When the call object is created, it can be forwarded to an offscreen document where the SDK has access to all the necessary APIs to fully establish the call. Check our example to see how this works.

Client side incoming call forwarding and better support for simultaneous calls

Prior versions of the SDK support simultaneous outgoing and incoming calls using different identities. If an incoming call comes in and the Device with the same identity is busy, the active call needs to be disconnected before accepting the incoming call. With this new release of the SDK, multiple incoming calls for the same identity can now be accepted, muted, or put on hold, without disconnecting any existing active calls. This can be achieved by forwarding the incoming call to a different Device instance. See the following new APIs and example for more details.

New APIs

Example

// Create a Device instance that handles receiving of all incoming calls for the same identity.
const receiverDevice = new Device(token, options);
await receiverDevice.register();

receiverDevice.on('incoming', (call) => {
  // Forward this call to a new Device instance using the call.connectToken string.
  forwardCall(call.connectToken);
});

// The forwardCall function may look something like the following.
async function forwardCall(connectToken) {
  // For every incoming call, we create a new Device instance which we can
  // interact with, without affecting other calls.
  // IMPORTANT: The token for this new device needs to have the same identity
  // as the token used in the receiverDevice.
  const device = new Device(token, options);
  const call = await device.connect({ connectToken });

  // Destroy the device after the call is completed
  call.on('disconnect', () => device.destroy());
}