Skip to content

Releases: twilio/twilio-voice.js

2.11.0

02 May 16:46
Compare
Choose a tag to compare

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());
}

2.10.2

14 Feb 18:09
Compare
Choose a tag to compare

2.10.2 (February 14, 2024)

Bug Fixes

  • Fixed an issue where an error is thrown when rtcConstraints parameter is provided.
  • Fixed an issue (#118, #210) where certain calls are not ended right away after a page refresh.

2.10.1

12 Jan 16:57
Compare
Choose a tag to compare

2.10.1 (January 12, 2024)

Bug Fixes

  • Fixed an issue where device.register() does not return a promise rejection when the WebSocket fails to connect. Thank you @kamalbennani for your contribution.
  • Fixed an issue where audio processor insights events are not generated if there is an existing processed stream at the start of a call.

2.10.0

05 Jan 17:37
Compare
Choose a tag to compare

2.10.0 (January 5, 2024)

Improvements

  • Added tags to client logs for easier filtering
  • Added log statements to API calls and events for debugging purposes

Bug Fixes

  • Fixed an issue where updating token after signaling connection has gone offline causes an Invalid State error.
  • Fixed an issue where Device.Options.logLevel is only accepting a number type. With this release, strings are now also allowed. See Device.Options.logLevel for a list of possible values.
  • Fixed an issue where call.mute() does not have an effect while the call.status() is either ringing or connecting. Thank you @zyzmoz for your contribution.

2.9.0

28 Nov 20:21
Compare
Choose a tag to compare

2.9.0 (November 28, 2023)

New Features

Audio Processor APIs

The SDK now includes Audio Processor APIs, enabling access to raw audio input and the ability to modify audio data before sending it to Twilio. With this new feature, the following use cases can now be easily achieved on the client side:

  • Background noise removal using a noise cancellation library of your choice
  • Music playback when putting the call on hold
  • Audio filters
  • AI audio classification
  • ... and more!

Please visit this page for more details about the Audio Processor APIs.

2.8.0

16 Oct 18:15
Compare
Choose a tag to compare

2.8.0 (October 16, 2023)

New Features

  • Added a new feature flag enableImprovedSignalingErrorPrecision to enhance the precision of errors emitted by Device and Call objects.

    const token = ...;
    const device = new Device(token, {
      enableImprovedSignalingErrorPrecision: true,
    });

    The default value of this option is false.

    When this flag is enabled, some errors that would have been described with a generic error code are now described with a more precise error code. With this feature, the following errors now have their own error codes. Please see this page for more details about each error.

    • Device Error Changes

      const device = new Device(token, {
        enableImprovedSignalingErrorPrecision: true,
      });
      device.on('error', (deviceError) => {
        // the following table describes how deviceError will change with this feature flag
      });
      Device Error Name Device Error Code with Feature Flag Enabled Device Error Code with Feature Flag Disabled
      GeneralErrors.ApplicationNotFoundError 31001 53000
      GeneralErrors.ConnectionDeclinedError 31002 53000
      GeneralErrors.ConnectionTimeoutError 31003 53000
      MalformedRequestErrors.MissingParameterArrayError 31101 53000
      MalformedRequestErrors.AuthorizationTokenMissingError 31102 53000
      MalformedRequestErrors.MaxParameterLengthExceededError 31103 53000
      MalformedRequestErrors.InvalidBridgeTokenError 31104 53000
      MalformedRequestErrors.InvalidClientNameError 31105 53000
      MalformedRequestErrors.ReconnectParameterInvalidError 31107 53000
      SignatureValidationErrors.AccessTokenSignatureValidationFailed 31202 53000
      AuthorizationErrors.NoValidAccountError 31203 53000
      AuthorizationErrors.JWTTokenExpirationTooLongError 31207 53000
      ClientErrors.NotFound 31404 53000
      ClientErrors.TemporarilyUnavilable 31480 53000
      ClientErrors.BusyHere 31486 53000
      SIPServerErrors.Decline 31603 53000
    • Call Error Changes

      const device = new Device(token, {
        enableImprovedSignalingErrorPrecision: true,
      });
      const call = device.connect(...);
      call.on('error', (callError) => {
        // the following table describes how callError will change with this feature flag
      });
      Call Error Name Call Error Code with Feature Flag Enabled Call Error Code with Feature Flag Disabled
      GeneralErrors.ConnectionDeclinedError 31002 31005
      AuthorizationErrors.InvalidJWTTokenError 31204 31005
      AuthorizationErrors.JWTTokenExpiredError 31205 31005

    IMPORTANT: If your application logic currently relies on listening to the generic error code 53000 or 31005, and you opt into enabling the feature flag, then your applicaton logic needs to be updated to anticipate the new error code when any of the above errors happen.

2.7.3

06 Oct 18:00
Compare
Choose a tag to compare

2.7.3 (October 6, 2023)

Bug Fixes

  • Fixed an issue where, sometimes a TypeError is raised while handling an incoming call under the following circumstances:
    • Network interruptions
    • updating the token before accepting the call

2.7.2

21 Sep 19:46
Compare
Choose a tag to compare

2.7.2 (September 21, 2023)

Changes

  • Fixed an issue where audio in the Chrome browser is choppy when another application is also using the audio devices.
  • Added missing documentation for the following events:
    • call.on('ringing', handler)
    • call.on('warning', handler)
    • call.on('warning-cleared', handler)
    • device.on('destroyed', handler)

2.7.1

03 Aug 23:00
Compare
Choose a tag to compare

2.7.1 (August 3, 2023)

Bug Fixes

  • Fixed an issue where call.sendMessage() API throws an error if the SDK is imported as an ECMAScript Module (ESM) using the @twilio/voice-sdk/esm path.

2.7.0

01 Aug 20:51
Compare
Choose a tag to compare

2.7.0 (August 1, 2023)

ECMAScript Module Support

Currently, the SDK is imported as a CommonJS Module (CJS) using the root path @twilio/voice-sdk. With this release, the SDK contains an experimental feature that allows it to be imported as an ECMAScript Module (ESM) using the @twilio/voice-sdk/esm path. As this is an experimental feature, some frameworks using bundlers like Vite and Rollup may not work. Full support for ESM will be available in a future release and will become the default import behavior of the SDK.

Example:

import { Device } from '@twilio/voice-sdk/esm';