Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Voice Android SDK Changelog



Welcome to the Programmable Voice Android SDK

welcome-to-the-programmable-voice-android-sdk page anchor

The Twilio Programmable Voice SDKs allow you to add voice-over-IP (VoIP) calling into your native Android applications. See Android Getting Started Guide(link takes you to an external page) to begin using the SDK.

(information)

Info

As of June 2023, legacy Firebase Cloud Messaging (FCM) credentials have been deprecated and will be removed in June 2024, please upgrade to FCM v1 credentials as soon as possible. The Android Voice SDK already supports FCM v1 credentials and a migration guide(link takes you to an external page) has been prepared to help aid developers through the process. For information about the deprecation, please visit Google's announcement(link takes you to an external page).

(warning)

Warning

The Twilio Programmable Voice SDKs use Semantic Versioning(link takes you to an external page). Twilio supports version N-1 for 12 months after the first GA release of version N. We recommend that you upgrade to the latest version as soon as possible to avoid any breaking changes. Version 6.x is the latest Android version.


May 21st, 2024

API Updates

api-updates page anchor
  • Call Message types (CallMessage.messageType) are treated as strings instead of enumerated values.
    • The SDK no longer validates CallMessage.messageType and acts as a pass through for unknown message types in both directions (messages received by the SDK and those sent by the SDK).
    • To send a user defined message, the sendMessage() API should be invoked with a CallMessage object where the messageType is set to one of the supported message types from https://www.twilio.com/docs/voice/sdks/call-message-events(link takes you to an external page)
    • Added new error code 31210 for invalid call message type when sendMessage() API is invoked with a CallMessage object where the messageType is not set to user-defined-message .
  • Added new Call Exception, InvalidPhoneNumberException that happens when a call is attempted with an invalid phone number id error 13224(link takes you to an external page) .
  • New constant-audio-output-level call quality warning added. This warning is triggered when the audio received is of a constant volume and can be used to determine when someone is speaking. Please note, if the remote party mutes the audio track or places the call on hold , this warning will still be raised.
  • Metrics and events reported to Twilio Insights is now encoded via gzip to reduce transmission bandwidth.

Size Report

ABIAPK Size Impact
x864.3MB
x86_644.3MB
armeabi-v7a3.4MB
arm64-v8a4MB
universal15.6MB

April 15th, 2024

  • Increased sampling resolution of Voice Insights call quality metrics events.
ABIAPK Size Impact
x864.3MB
x86_644.2MB
armeabi-v7a3.4MB
arm64-v8a4MB
universal15.6MB

Mar 12th, 2024

  • A new AudioOptions API has been added, enabling audio processing operations on the local audio track/source.
    • Audio processing operations include Echo Cancellation, Automatic Gain Control, Noise Suppression, High Pass Filtering, setting jitter buffer max size in packets, and setting jitter buffer min delay in milliseconds (msec).
    • By default, all audio processing operations are enabled (set to true), the jitter buffer's maximum size is 200 packets, and the jitter buffer's minimum delay is 0 msec.
    • The default values can be modified and custom AudioOptions can be set as part of ConnectOptions when making outbound calls and/or as part of AcceptOptions when receiving incoming calls.
  • Example of customized AudioOptions when making an outbound call - In this example, Automatic Gain Control and High Pass Filtering are disabled, jitter buffer max size is set to 100 packets and jitter buffer min delay is set to 5 msec.

_10
connectOptions = new ConnectOptions.Builder(accessToken)
_10
.iceOptions(iceOptions)
_10
.audioOptions(new AudioOptions.Builder()
_10
.autoGainControl(false)
_10
.highpassFilter(false)
_10
.audioJitterBufferMaxPackets(100)
_10
.audioJitterBufferMinDelayMs(5)
_10
.build())
_10
.build();
_10
Voice.connect(context, connectOptions, callListener);

  • Example of customized AudioOptions when receiving an incoming call - In this example, Echo Cancellation and Noise Suppression are disabled, and jitter buffer max size is set to 50 packets.

_10
acceptOptions = new AcceptOptions.Builder()
_10
.iceOptions(iceOptions)
_10
.audioOptions(new AudioOptions.Builder()
_10
.echoCancellation(false)
_10
.noiseSuppression(false)
_10
.audioJitterBufferMaxPackets(50)
_10
.build())
_10
.build();
_10
callInvite.accept(context, acceptOptions, callListener);

The following table outlines the APK size impact for different Application Binary Interfaces (ABIs):

ABIAPK Size Impact
x864.3MB
x86_644.2MB
armeabi-v7a3.4MB
arm64-v8a4MB
universal15.6MB

Feb 12th, 2024

  • Call.CallMessageListener methods have been updated to include the CallSid, which is a unique identifier for the Call or the CallInvite. The updated APIs are:

_10
public interface CallMessageListener {
_10
_10
void onMessageReceived(final String callSid, final CallMessage callMesssage);
_10
_10
void onMessageSent(final String callSid, final String voiceEventSID);
_10
_10
void onMessageFailure(final String callSid, final String voiceEventSID, final VoiceException error);
_10
_10
}

  • LogParameters class includes a Throwable field named tr . This allows us to log stack traces from Exceptions and other Throwable objects.
  • LogParameters objects can now be constructed using LogParameters.Builder() that utilizes a builder pattern avoiding multi argument cumbersome direct constructors.
  • The existing constructors for LogParameters have been deprecated in favor of construction using LogParamters.Builder() and will be removed in the next major release.
  • Removed dead/unused c/c++ jni method, Java_com_twilio_voice_JniUtils_nativeJavaUtf16StringToStdString. This is somewhat realted to github issue 572(link takes you to an external page) .
  • Added new Call Exception, InvalidCallerIdException that happens when a call is attempted with an invalid caller id error 13214 .
  • Report the usage of Default Logger or Custom Logger to Twilio Insights. It only reports the type of Logger but not the actual log messages.

Size Report

ABIAPK Size Impact
x864.3MB
x86_644.2MB
armeabi-v7a3.4MB
arm64-v8a4MB
universal15.6MB

Nov 30th, 2023

  • Upgraded to use WebRTC-112.

Size Report

ABIAPK Size Impact
x864.3MB
x86_644.2MB
armeabi-v7a3.4MB
arm64-v8a4MB
universal15.6MB

Nov 9th, 2023

  • The SDK now supports sending and receiving in-call user-defined messages. Use the Call::sendMessage(...) method to send messages. Endpoints subscribed to the events of the call will be receiving the messages. The CallMessageInterface::onReceiveMessage(...) callback will be raised to the application when a message is received by the client. Please visit this page for more details about this feature. Additionally, please see the following for more information on how to send and receive messages on the server. This feature is currently in Beta. Example below.

_39
private static class TestCallMessageObserver implements Call.CallMessageListener {
_39
@Override
_39
public void onMessageReceived(CallMessage callMesssage) {
_39
Log.d("[test]", "Call Message received");
_39
}
_39
@Override
_39
public void onMessageSent(String voiceEventSID) {
_39
Log.d("[test]", "Call Message:" + voiceEventSID + " sent");
_39
}
_39
@Override
_39
public void onMessageFailure(String voiceEventSID, VoiceException error) {
_39
Log.d("[test]", "Call Message: " + voiceEventSID + " failed to send: " + error.getMessage());
_39
}
_39
}
_39
.
_39
.
_39
.
_39
// register notification callbacks upon connect
_39
ConnectOptions cxnOptions = new ConnectOptions.Builder(accessToken))
_39
.callMessageListener(new TestCallMessageObserver())
_39
.build();
_39
Call call = Voice.connect(context, connectOptions, new Call.Listener() {...});
_39
.
_39
.
_39
.
_39
// send a message
_39
final CallMessage callMessage = (
_39
new CallMessage.Builder(CallMessage.MessageType.UserDefinedMessage))
_39
.contentType("application/json")
_39
.content((new JSONObject())
_39
.put("foo", "bar")
_39
.toString())
_39
.build();
_39
call.sendMessage(callMessage);
_39
.
_39
.
_39
.
_39
// receive call message before accpeting invite
_39
Voice.handleMessage(this, data, new TestCallMessageObserver());

Size Report

ABIAPK Size Impact
x864.8MB
x86_644.8MB
armeabi-v7a3.6MB
arm64-v8a4.5MB
universal17.4MB

Oct 2nd, 2023

  • Adds a thread member to LogParameters class. The thread member contains the name (or id) of the thread where the log message was generated.
  • Fixed a crash when the incoming call listener goes out of scope after timeout.

Size Report

ABIAPK Size Impact
x864.8MB
x86_644.8MB
armeabi-v7a3.6MB
arm64-v8a4.5MB
universal17.4MB

Sept 5th, 2023

  • Provides a LoggerInterface interface. This interface contains a log method that is invoked with a LogParameters object every time a log message becomes available. The LogParameters object contains all the information relevant to the log message being delivered.
  • The Android SDK internally implements the LoggerInterface to provide default logging capabilities to stdout using android.util.Log.
  • Provides a Voice.SetLogger(LoggerInterface) method that allows setting a custom logger that conforms to LoggerInterface to which log messages will be delivered.
  • Provides a Voice.GetLogger() method that returns the logger that was previously set with setLogger . If no custom logger was set, this method returns the default logger currently used by the SDK.
  • Users can send their messages to be logged by the SDK using Voice.GetLogger().log(LogParameters) . This logs the message using the SDK's default logger.
  • Users can also implement custom loggers that conform to LoggerInterface to customize the logging mechanism, for eg., logging to a file, sending the logs to a server, etc.
  • The existing Logger class is deprecated and will be removed in the next major version release.

Size Report

ABIAPK Size Impact
x864.8MB
x86_644.8MB
armeabi-v7a3.6MB
arm64-v8a4.5MB
universal17.3MB

June 23rd, 2023

Fixed a bug where the incoming call invite could only ring up to 3 minutes instead of the maximum 10 minutes call timeout.

ABIAPK Size Impact
x864.8MB
x86_644.8MB
armeabi-v7a3.6MB
arm64-v8a4.5MB
universal17.3MB

June 12th, 2023

  • Upgraded to use WebRTC-105.
  • AudioOption, typing_detection is now deprecated, no longer supported by WebRTC.
  • Fixed a crash when using an external audio device due to JAVA stack frame not being constructed.
  • Fixed a crash due to file handle exhaustion.
  • Fixed memory leaks regarding WebRTC shutdown & lingering Media Factory references.
ABIAPK Size Impact
x864.8MB
x86_644.8MB
armeabi-v7a3.6MB
arm64-v8a4.5MB
universal17.3MB

July 11th, 2022

  • New edge umatilla is now supported. Set the Voice.setEdge(...) property before connecting or accepting the call.
  • Restrictive networks may fail unless ICE servers are provided via ConnectOptions.Builder.iceOptions(...) or AcceptOptions.Builder.iceOptions(...) . ICE servers can be obtained from Twilio Network Traversal Service .
ABIAPK Size Impact
x864MB
x86_644MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
universal14.9MB

May 26th, 2022

  • Fixed a crash when the home region specifier ( twr ) in the access token is null .
  • Restrictive networks may fail unless ICE servers are provided via ConnectOptions.Builder.iceOptions(...) or AcceptOptions.Builder.iceOptions(...) . ICE servers can be obtained from Twilio Network Traversal Service .
ABIAPK Size Impact
x864MB
x86_644MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
universal14.9MB

May 9th, 2022

  • The Voice Android SDK now supports Twilio Regional by providing the home region specifier in the access token header when calling the Voice.register() method, the Voice.unregister() method, or the Voice.connect() method.

Existing customers can now migrate their Voice use-cases to data centers in Ireland or Australia to establish data residency within the region. In addition, new customers may now select Ireland or Australia as their region of choice for Voice related use cases. There is no additional cost to use the new data centers in Ireland or Australia. To learn more about Regional Voice, check out our blog post(link takes you to an external page) or head over to our developer docs to get started.

Below is an example of specifying home region in the access token using the Twilio Node.js(link takes you to an external page) helper library:


_10
const accessToken = new twilio.jwt.AccessToken(
_10
credentials.accountSid,
_10
credentials.apiKeySid,
_10
credentials.apiKeySecret, {
_10
identity,
_10
ttl,
_10
region: 'au1',
_10
},
_10
);

The decoded header of your access token should look like this:


_10
{
_10
"alg": "HS256",
_10
"typ": "JWT",
_10
"cty": "twilio-fpa;v=1",
_10
"twr": "au1"
_10
}

  • The SDK compileSDKVersion and targetSDKVersion were updated to 31.
  • Updated getStats(...) API doc.
  • Fixed IceCandidatePairStats javadoc. Added responsesSent attribute to IceCandidatePairStats .
  • Restrictive networks may fail unless ICE servers are provided via ConnectOptions.Builder.iceOptions(...) or AcceptOptions.Builder.iceOptions(...) . ICE servers can be obtained from Twilio Network Traversal Service .
ABIAPK Size Impact
x864MB
x86_644MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
universal14.9MB

February 8th, 2022

New Features

new-features page anchor
  • Upgraded SDK to build with Java 11.
  • Updated the SDK to Android Gradle Plugin 7.0.4.
  • Restrictive networks may fail unless ICE servers are provided via ConnectOptions.Builder.iceOptions(...) or AcceptOptions.Builder.iceOptions(...) . ICE servers can be obtained from Twilio Network Traversal Service .
ABIAPK Size Impact
x864MB
x86_644MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
universal14.9MB

November 19, 2021

  • Updated the SDK to Android Gradle Plugin 4.2.2.
  • Restrictive networks may fail unless ICE servers are provided via ConnectOptions.Builder.iceOptions(...) or AcceptOptions.Builder.iceOptions(...) . ICE servers can be obtained from Twilio Network Traversal Service .
ABIAPK Size Impact
x864MB
x86_644MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
universal14.8MB

November 5, 2021

  • Upgraded the SDK to use AndroidX.
  • Restrictive networks may fail unless ICE servers are provided via ConnectOptions.Builder.iceOptions(...) or AcceptOptions.Builder.iceOptions(...) . ICE servers can be obtained from Twilio Network Traversal Service .
ABIAPK Size Impact
x864MB
x86_644MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
universal14.8MB

November 2, 2021

  • The minimum Android SDK version has been increased from 16 to 21.
  • The voice SDK now validates full remote domain names while setting up the TLS connection.
  • Restrictive networks may fail unless ICE servers are provided via ConnectOptions.Builder.iceOptions(...) or AcceptOptions.Builder.iceOptions(...) . ICE servers can be obtained from Twilio Network Traversal Service .
ABIAPK Size Impact
x864MB
x86_644MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
universal14.8MB

May 24, 2021

  • This release is based on Chromium WebRTC 88.
  • The SDK uses Unified Plan SDP semantics instead of Plan-B.
ABIAPK Size Impact
x864MB
x86_643.9MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
universal14.8MB

March 29, 2021

  • Voice Android artifacts are now published to MavenCentral instead of Bintray.

    • Ensure to include mavenCentral() listed in your project's buildscript repositories section:


      _10
      buildscript {
      _10
      repositories {
      _10
      mavenCentral()
      _10
      ...
      _10
      }
      _10
      }

  • Voice Android SDK now publishes the checksum in the release notes.
  • Fixed a crash when onNetworkChanged was called during the teardown process.
ABIAPK Size Impact
x863.9MB
x86_643.9MB
armeabi-v7a3.2MB
arm64-v8a3.7MB
universal14.4MB

March 11, 2021

  • Fixed a potential bug in the core module where the Logger could be accessed after being destroyed by another thread.
ABIAPK Size Impact
x863.9MB
x86_643.9MB
armeabi-v7a3.2MB
arm64-v8a3.7MB
universal14.4MB

January 26, 2021

  • Updated the SDK to Android Gradle Plugin to 4.1.1.
ABIAPK Size Impact
x863.9MB
x86_643.8MB
armeabi-v7a3.2MB
arm64-v8a3.7MB
universal14.3MB

January 5, 2021

  • Fixed a bug where caller did not receive the onDisconnected callback with error when the callee hung up.
  • Fixed a bug where callee did not receive the onCancelledCallInvite callback with error when signaling connection error happened.
  • Private IP addresses are masked in Release mode for the SDK logs and the ice-candidate Insights event payload.
  • Private IP addresses will not be masked in Debug mode. The selected-ice-candidate-pair event will contain private IP address of the local active ICE candidate for debugging purpose in both Release and Debug modes.
  • Stop publishing Voice Insights event with invalid access token.
ABIApp Size Increase
universal14.3MB
armeabi-v7a3.2MB
arm64-v8a3.7MB
x863.9MB
x86_643.8MB

September 29th, 2020

  • The SDK compileSDKVersion and targetSDKVersion were updated to 30 from 28. No changes are required to migrate to this version in an existing application.
ABIApp Size Increase
universal14.3MB
armeabi-v7a3.2MB
arm64-v8a3.7MB
x863.9MB
x86_643.8MB

September 16, 2020

  • The Voice Android SDK uses Chromium WebRTC 83.
  • The Voice Android SDK is built with NDK r20b.
  • PeerConnection state is now reported to Insights.
  • mos calculation algorithm has been updated to make it monotonically decreasing with increasing jitter and packets-lost-fraction values over a range of rtt values. The final mos should always be in the range [1.0, 4.6].
Event GroupLevelEvent NameDescription
pc-connection-stateDEBUGnewRaised when peer connection state is new
pc-connection-stateDEBUGconnectingRaised when peer connection state is connecting
pc-connection-stateDEBUGconnectedRaised when peer connection state is connected
pc-connection-stateDEBUGdisconnectedRaised when peer connection state is disconnected
pc-connection-stateERRORfailedRaised when peer connection state is failed
pc-connection-stateDEBUGclosedRaised when peer connection state is closed
  • A new Insights event selected-ice-candidate-pair is reported with the active local ICE candidate and remote ICE candidate.
Event GroupLevelEvent NameDescription
ice-candidateDEBUGselected-ice-candidate-pairRaised when the active local and remote ICE candidates of the peer connection are determined
  • Defined new error code
Error CodesErrorCodeError Message
53407EXCEPTION_MEDIA_DTLS_TRANSPORT_FAILEDMedia connection failed due to DTLS handshake failure
  • Fixed a crash bug when processing empty stats reports or stats reports without remote audio tracks.

The table below highlights the updated App Size Impact.

ABIApp Size Impact 5.3.0App Size Impact 5.5.0
universal15.2MB14.3MB
armeabi-v7a3.3MB3.2MB
arm64-v8a3.8MB3.7MB
x864MB3.9MB
x86_644.1MB3.8MB
ABIApp Size Increase
universal14.3MB
armeabi-v7a3.2MB
arm64-v8a3.7MB
x863.9MB
x86_643.8MB

September 14, 2020

  • Fixed a crash bug when processing empty stats reports or stats reports without remote audio tracks.
ABIApp Size Increase
universal15.3MB
armeabi-v7a3.4MB
arm64-v8a3.9MB
x864.1MB
x86_644.2MB

September 1, 2020

  • Fixed a bug when attempting to execute work on the worker thread from a custom audio device.
  • Upgraded to Android Gradle Plugin 4.0.0 and Gradle 6.1.1
  • Starting with Voice Android SDK 5.4.1, the SDK is no longer binary compatible with applications that target Java 7. In order to use this and future releases, developers must upgrade their applications to target Java 8. Follow the snippet below for reference:

_10
android {
_10
compileOptions {
_10
sourceCompatibility 1.8
_10
targetCompatibility 1.8
_10
}
_10
}

ABIApp Size Increase
universal15.3MB
armeabi-v7a3.4MB
arm64-v8a3.9MB
x864.1MB
x86_644.2MB

July 9, 2020

  • A CallerInfo object is introduced to represent information about the caller. Currently, this information is limited to SHAKEN/STIR status of incoming PSTN Calls, but may later be expanded to include CNAM, and other endpoint types. isVerified attribute represents whether or not the caller's phone number has been verified by Twilio using SHAKEN/STIR validation. The value of this attribute is true if the caller has been validated at 'A' level, false if the caller has been verified at any lower level or has failed validation. If SHAKEN/STIR information is unavailable for the caller or stir status value is null , the value of this attribute will be null .
  • CallInvite class includes getCallerInfo(..) method that returns the CallerInfo of the caller.

For details on how Twilio uses SHAKEN/STIR to make trusted calls and protect against unlawful spoofing, please visit /docs/voice/trusted-calling-using-shakenstir.

  • Fixed crash bugs during teardown of a Call .
ABIApp Size Increase
universal15.3MB
armeabi-v7a3.4MB
arm64-v8a3.9MB
x864.1MB
x86_644.2MB

June 23, 2020

  • Fixed a bug in Voice.setRegion(..) API that disallowed to use non default values.
ABIApp Size Increase
universal15.2MB
armeabi-v7a3.4MB
arm64-v8a3.9MB
x864.1MB
x86_644.1MB

June 3, 2020

  • A new Call.Listener callback onCallQualityWarningsChanged() is introduced.

_10
void onCallQualityWarningsChanged(Call call,
_10
Set<CallQualityWarning> currentWarnings,
_10
Set<CallQualityWarning> previousWarnings);

The Set that contain the warnings are consisted of enum with values of the newly introduced CallQualityWarning


_10
public enum CallQualityWarning {
_10
WARN_HIGH_RTT("high-rtt"),
_10
WARN_HIGH_JITTER("high-jitter"),
_10
WARN_HIGH_PACKET_LOSS("high-packet-loss"),
_10
WARN_LOW_MOS("low-mos"),
_10
WARN_CONSTANT_AUDIO_IN_LEVEL("constant-audio-input-level"),
_10
}

The trigger conditions for the warnings defined in the enumeration are defined as follows:

  • WARN_HIGH_RTT - Round Trip Time (RTT) > 400 ms for 3 out of last 5 samples.
  • WARN_HIGH_JITTER - Jitter > 30 ms for 3 out of last 5 samples.
  • WARN_HIGH_PACKET_LOSS - Raised when average packet loss > 3% in last 7 samples. Cleared when average packet loss <= 1% in last 7 samples.
  • WARN_LOW_MOS - Mean Opinion Score (MOS) < 3.5 for 3 out of last 5 samples.
  • WARN_CONSTANT_AUDIO_IN_LEVEL - Raised when the standard deviation of audio input levels for last 10 samples is less than or equals 1% of the maximum possible audio input level (32767) i.e. 327.67 and the call is not in the muted state and the call is not on hold. Cleared when the standard deviation of audio input levels for last 10 samples is greater than 3% of the maximum possible audio input level.
  • A new method getCallQualityWarnings() is added to Call to retrieve the present set of call quality related warnings.
  • This release also adds the Mean Opinion Score (MOS) measurement mos to RemoteAudioTrackStats . Use Call.getStats() API during a call to retrieve the score. The mos is computed once per second. Since the MOS is calculated from network performance measurements, it can be used to indicate the current network condition to the user to provide better usability. See API Docs(link takes you to an external page) for more information.

Example:


_11
call.getStats(new StatsListener() {
_11
@Override
_11
public void onStats(@NonNull List<StatsReport> statsReports) {
_11
for (StatsReport statsReport : statsReports) {
_11
List<RemoteAudioTrackStats> remoteAudioStatsList = statsReport.getRemoteAudioTrackStats();
_11
for (RemoteAudioTrackStats remoteAudioStats : remoteAudioStatsList) {
_11
float mos = remoteAudioStats.mos;
_11
}
_11
}
_11
}
_11
});

  • This release includes support for the expansion of Twilio's Global Infrastructure via Edge Locations which allows customers to control their connectivity into and out of Twilio's platform. The Voice Android SDK uses these Edges to connect to Twilio's infrastructure via the new property Voice.edge . This new property supersedes the now deprecated Voice.region . See the new Edge names and how they map to the old region names.

Here is an example:


_10
// Connect using global low latency
_10
Voice.setEdge("roaming")

Below are the new methods signatures introduced in Voice class.


_10
@NonNull public static String getEdge();
_10
public static void setEdge(@NonNull String edge)

The following APIs have been deprecated in favor of the new methods.


_10
@NonNull public static String getRegion();
_10
public static void setRegion(@NonNull String region)

  • Added a boolean property enableIceGatheringOnAnyAddressPorts in CallOptions that allows gathering of ICE candidates from "any address" ports. This allows applications to work in certain VPN environments.

Reference the following code snippet to enable or disable this feature. Note, enableIceGatheringOnAnyAddressPorts is disabled by default.

Configure enableIceGatheringOnAnyAddressPorts with ConnectOptions


_10
ConnectOptions connectOptions = new ConnectOptions.Builder(accessToken)
_10
.enableIceGatheringOnAnyAddressPorts(iceGatheringOnAnyAddressPorts)
_10
.build();
_10
Voice.connect(context, connectOptions, callListener);

Configure enableIceGatheringOnAnyAddressPorts with AcceptOptions


_10
AcceptOptions acceptOptions = new AcceptOptions.Builder()
_10
.enableIceGatheringOnAnyAddressPorts(iceGatheringOnAnyAddressPorts)
_10
.build();
_10
callInvite.accept(context, acceptOptions, callListener);

ABIApp Size Increase
universal15.2MB
armeabi-v7a3.4MB
arm64-v8a3.9MB
x864.1MB
x86_644.1MB

April 27, 2020

The AudioDevice API is an advanced API that can be used to create innovative and sophisticated in-app audio capabilities. For example, enable pre-recorded messages to be played in-call, or apply noise reduction algorithms before playing out the received audio.

An AudioDevice is a logical device that is used to capture and render audio. The captured audio is sent to the remote party, and the received audio is rendered locally. By default, the SDK uses DefaultAudioDevice(link takes you to an external page) which uses the mic for capturing and the local speaker/earpiece/headset for rendering. The AudioDevice API allows for the creation of custom audio capturers and renderers. See this example(link takes you to an external page) and API docs(link takes you to an external page) to learn more about custom audio devices.

The AudioDevice feature requires additional native APIs that result in a small increase in SDK size. The table below highlights the updated App Size Impact.

ABIApp Size Impact 5.1.1App Size Impact 5.2.0
universal14.9MB15.1MB
armeabi-v7a3.3MB3.3MB
arm64-v8a3.8MB3.9MB
x864MB4MB
x86_644.1MB4.1MB

March 20th, 2020

  • Fixed data types in event payload for Voice Insights events.
  • Fixed Voice Insights data with valid transport id value.
ABIApp Size Increase
universal15 MB
armeabi-v7a3.3MB
arm64-v8a3.9MB
x864MB
x86_644.1MB

February 28, 2020

  • An ongoing call will automatically switch to a more preferred network type if one becomes available. The following are the network types listed in preferred order: ETHERNET, LOOPBACK, WIFI, VPN, and CELLULAR. For example, if a WIFI network becomes available whilst in a call that is using CELLULAR data, the call will automatically switch to using the WIFI network.
  • Attempts to re-establish the media connection will be done preemptively if no media flow is detected for 3 seconds.
  • Fixed data types in event payload for Voice Insights events.
ABIApp Size Increase
universal15MB
armeabi-v7a3.3MB
arm64-v8a3.9MB
x864MB
x86_644.1MB

December 6, 2019

  • The HttpsURLConnection thread is now tagged using Traffic.setThreadStatsTag . This change prevents warnings and/or crashes when an App is started using strictMode .
  • Application name, id, version, build number, and min/major sdk version are now published to Insights. This helps with isolating problems if an issue is encountered.
ABIApp Size Increase
universal14.9MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x864MB
x86_644.1MB

November 19, 2019

  • Incoming call handling improvements. Previously, if we encountered network issues before an incoming call was answered or rejected, we disconnected the call. With this release, we will continue to try and establish a connection to Twilio for a maximum of 40 seconds before we disconnect the call.
  • We now publish the negotiated codec and its associated parameters to Insights.
Event GroupLevelEvent NameDescription
settingsINFOcodecRaised when the codec has been selected
  • Improved the way we perform DNS resolution. Previously, some DNS requests could indirectly block the main thread. This is no longer the case.
ABIApp Size Increase
universal14.9MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x864MB
x86_644.1MB

October 28, 2019

This release introduces an update to the Programmable Voice call model. To upgrade your application please follow the migration guide(link takes you to an external page).

Prior to 5.0.0, when Voice.register(...) is invoked, the Voice SDK registers for two push notifications: a call and cancel push notification. The call and cancel push notification payloads could then be passed as arguments to Voice.handleMessage(...) and your application would be provided with a callback via MessageListener indicating if the message was a CallInvite or CancelledCallInvite.

Starting with 5.0.0, when Voice.register(...) is invoked, the Voice SDK will register for call push notifications and cancelled call invites will be determined via a signaling connection. Voice.handleMessage(...) no longer processes cancel push notification payloads and will return false if provided with a cancel message. As a result, developers must re-register via Voice.register(...) after upgrading their application to 5.0.0 to stop receiving cancel push notifications.

CallInvite and CancelledCallInvite updates

callinvite-and-cancelledcallinvite-updates page anchor

A valid call push notification, when passed to Voice.handleMessage(...), will still result in a CallInvite being raised to the provided MessageListener. A CancelledCallInvite will be raised to the provided MessageListener if any of the following events occur:

  • The call is prematurely disconnected by the caller.
  • The callee does not accept or reject the call within 30 seconds.
  • The Voice SDK is unable to establish a connection to Twilio.

A CancelledCallInvite will not be raised if a CallInvite is accepted or rejected.

To provide observability for incoming call cancellations the following Insights events have been added:

Event GroupLevelEvent NameDescription
connectionINFOlistenRaised when an attempt to listen for cancellations is made
connectionINFOlisteningRaised when an attempt to listen for cancellations has succeeded
connectionINFOcancelRaised when a cancellation has been reported
connectionERRORlistening-errorRaised when an attempt to listen for cancellation has failed
registrationERRORunsupported-cancel-message-errorRaised when a "cancel" push notification is processed by the SDK. This version of the SDK does not support "cancel" push notifications
  • MessageListener.onCancelledCallInvite has been updated to the following signature.


    _10
    void onCancelledCallInvite(@NonNull CancelledCallInvite cancelledCallInvite, @Nullable CallException callException)

    The provided CallException will indicate if a call was cancelled as the result of an error. If no error occurred, then the CallException is null.

  • Both Voice.handleMessage(...) methods require an Android Context as the first argument.
  • CallInvite class includes isValid(...) utility method to validate whether the payload is a valid notification sent by Twilio. A valid notification payload will result in a CallInvite being raised via MessageListener.onCallInvite(...) callback when passed to Voice.handleMessage(...) .
  • Enabling insights and setting the region are now specified on the Voice class. These options were previously accessible on ConnectOptions and AcceptOptions.

    • Sending stats data to Insights is enabled by default.
    • The default region uses Global Low Latency routing, which establishes a connection with the closest region to the user.

    Below are the new methods signatures introduced in Voice class.


    _10
    public static boolean isInsightsEnabled();
    _10
    public static void enableInsights(boolean enable);
    _10
    @NonNull public static String getRegion();
    _10
    public static void setRegion(@NonNull String region)

  • Introduced a new error code that gets surfaced when handleMessage(..) API is called with push notification bundle with twilio.voice.cancel as the twi_message_type .
Error CodeLevelError MessageDescription
31302ErrorUnsupported Cancel Message ErrorThis version of the SDK no longer supports processing cancel push notification messages. You must register via Voice.register(...) with this version of the SDK to stop receiving cancel push notification messages. Cancellations are now handled internally and reported to you on behalf of the SDK.
  • CLIENT-6757 Updated the Android Gradle Plugin to 3.5.0 and Gradle to 5.4.1.
ABIApp Size Increase
universal14.9MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x864MB
x86_644MB


August 20th, 2019

Differentiated Services Code Point (DSCP) Tagging API

differentiated-services-code-point-dscp-tagging-api page anchor

The Differentiated Services Code Point (DSCP)(link takes you to an external page) Tagging API allows you to mark the audio packets with Expedited Forwarding (EF) for the purposes of improved packet routing. This behavior is enabled by default. When enabled, supporting networks will prioritize audio packet delivery for improved audio quality.

Reference the following code snippet to control enabling DSCP.

Configure DSCP with ConnectOptions


_10
ConnectOptions connectOptions = new ConnectOptions.Builder(accessToken)
_10
.enableDscp(enableDscp)
_10
.build();
_10
Voice.connect(context, connectOptions, callListener);

Configure DSCP with AcceptOptions


_10
AcceptOptions acceptOptions = new AcceptOptions.Builder()
_10
.enableDscp(enableDscp)
_10
.build();
_10
callInvite.accept(context, acceptOptions, callListener);

ABIApp Size Increase
universal14.7MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

August 2nd, 2019

Custom Parameters in Canceled Call Notification

custom-parameters-in-canceled-call-notification page anchor

You can now retrieve the custom parameters set in your TwiML application from CancelledCallInvite. With this addition, you can for example, display a missed call notification with the caller's display name retrieved from the CancelledCallInvite getCustomParamaters().

For more information, refer to the API docs(link takes you to an external page)


_11
// Pass custom parameters in TwiML
_11
<?xml version="1.0" encoding="UTF-8"?>
_11
<Response>
_11
<Dial answerOnBridge="false" callerId="client:alice">
_11
<Client>
_11
<Identity>bob</Identity>
_11
<Parameter name="caller_first_name" value="alice" />
_11
<Parameter name="caller_last_name" value="smith" />
_11
</Client>
_11
</Dial>
_11
</Response>

cancelledCallInvite.getCustomParameters() returns a map of key-value pair passed in the TwiML.


_10
"caller_first_name" -> "alice"
_10
"caller_last_name" -> "smith"

  • CLIENT-5845 Insights events ringing in the connection group guarantees to include CallSid .
ABIApp Size Increase
universal14.7MB
armeabi-v7a3.2MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

July 29th, 2019

  • CLIENT-6428 The SDK Android Gradle Plugin was updated from 3.3.2 to 3.4.2 and the Gradle version was updated from 4.10.3 to 5.1.1.
  • CLIENT-6331 OpenSLES(link takes you to an external page) is now disabled by default for both incoming and outgoing calls unless explicitly enabled. To enable OpenSLES, execute the following before invoking Voice.connect(...) or CallInvite.accept(...) : tvo.webrtc.voiceengine.WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false) .
ABIApp Size Increase
universal14.7MB
armeabi-v7a3.2MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

July 24th, 2019

  • The SDK compileSDKVersion and targetSDKVersion SDK was updated to 28 from 27. No changes are required to migrate to this version in an existing application.
ABIApp Size Increase
universal14.7MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

July 12th, 2019

Max Average Bandwidth API

max-average-bandwidth-api page anchor

By default, Opus codec is set up with a bitrate of around 32kbps (40-50kbps on the wire). With this release, you are able to set a custom max average bitrate transmission to better control how much bandwidth your VoIP application should use. See RFC-7587 7.1(link takes you to an external page) for information about Max Average Bitrate.

The main purpose of this API is to set a lower max average bitrate to minimize bandwidth usage. This is particularly useful in deployments where bandwidth is a premium. Where bandwidth is not of concern, you do not need to use this API.

Max Average Bitrate can be set to as low as 6,000bps and as high as 51,000bps. Values outside this range are ignored and the default Opus operation mode is used. See API Docs(link takes you to an external page) for more information.

As would be expected, lowering the max average bitrate impacts audio quality. We don't recommend setting max average bitrate to a value below 8,000bps. On the other hand, setting values over 32,000bps will have negligible audio quality improvements.

For example, to set a new max average bitrate to 16,000bps:


_10
ConnectOptions connectOptions = new ConnectOptions.Builder(accessToken)
_10
.params(params)
_10
.preferAudioCodecs(Arrays.asList( new OpusCodec(16000)))
_10
.build();
_10
Call call = Voice.connect(VoiceActivity.this, connectOptions, callListener);

  • Programmable Voice Android SDK transmits data for VoIP calls and for Insights(link takes you to an external page) . With this release, we have reduced Insights related data consumption by around 25%. This was accomplished by reducing the events reporting interval.
  • The SDK now reports ice-candidate events to Insights. These events are raised when OnIceCandidate is called on the PeerConnection .
ABIApp Size Increase
universal14.7MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

June 28th, 2019

This release introduces the new Reconnecting State API. This API adds a new state RECONNECTING to Call.State and two new Call.Listener() callbacks, onReconnecting(...) and onReconnected(...).

Call reconnection capability has been available since SDK 3.0. For example, if a call is established over a wifi network and the wifi network becomes unavailable, the SDK will automatically switch the call over to the next available network.

This release adds the reconnection related callbacks. onReconnecting(...) indicates when a call is being reconnected due to a network disruption or network switch over and onReconnected(...) is called once the call has been re-connected. You can use this information to provide intuitive feedback to your App user when a reconnection is taking place.

Migrating from 3.x is very simple. Please refer to our migration guide(link takes you to an external page) for more information.

ABIApp Size Increase
universal14.7MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

June 26th, 2019

  • Insights events reconnecting and reconnected in the connection group are now documented in the Javadoc for the Call class.
  • CLIENT-6218 Insights events 53001 / Signaling connection disconnected and 53405 / Media connection failed in the connection group that are raised when attempting to reconnect are now raised with Insights level "warning". Previously, they were raised with level "error".
  • CLIENT-6257 Added AddressIncompleteException to indicate that the number of the callee is malformed.
Error CodeError Message
31484Address Incomplete
  • CLIENT-6205 Fixed an issue where a 31408 / Request Timeout would result in a 31005 / Connection error
ABIApp Size Increase
universal14.7MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

June 21st, 2019

  • CLIENT-6282 The SDK can now be compiled alongside the Programmable Video SDK. Please perform the following steps to properly upgrade to 3.2.0
    • Modify the classpath of any java files used from org.webrtc.* to tvo.webrtc.* . Calling APIs to any class in org.webrtc.* will have no effect within the Voice SDK.
    • Perform the following modifications to your proguard file when compiling the Voice SDK for a release build with obfuscation.
      • Change -keep class org.webrtc.** { *; } to -keep class tvo.webrtc.** { *; }
      • Change -dontwarn org.webrtc.** to -dontwarn tvo.webrtc.**
ABIApp Size Increase
universal14.7MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

June 20th, 2019

  • CLIENT-6246 Fixed bug on API 19 and below where the SDK would incorrectly surface a REGISTRATION_ERROR_CODE/31301 exception for calls to Voice.register(...) or Voice.unregister(...) when a EXCEPTION_INVALID_ACCESS_TOKEN/20101 actually occurred.
ABIApp Size Increase
universal14.7MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

June 12th, 2019

  • Switched CI provider for build, test, and release pipeline.
  • The Twilio CDN will no longer host the Voice Android aar artifacts or Javadocs. All artifacts and javadocs previously hosted on the Twilio CDN will remain.

If you are downloading Voice Android SDK artifacts from the Twilio CDN then there are two options available moving forward.

  1. Follow our Get Started with the Programmable Voice SDKs .
  2. Download the artifacts directly from Bintray(link takes you to an external page) .

All Javadocs back to 3.0.0-preview1 are now hosted on Github Pages(link takes you to an external page) with the following URL scheme. https://twilio.github.io/twilio-voice-android/docs/{version}

ABIApp Size Increase
universal14.7MB
armeabi-v7a3.3MB
arm64-v8a3.8MB
x863.9MB
x86_644MB

May 16th, 2019

We now surface more details about errors encountered during Voice.register(...)(link takes you to an external page), Voice.unregister(...)(link takes you to an external page), Voice.connect(...)(link takes you to an external page), and CallInvite.accept(...)(link takes you to an external page). Previously, these functions reported these errors with the generic error REGISTRATION_ERROR_CODE/31301(link takes you to an external page) or EXCEPTION_CONNECTION_ERROR/31005(link takes you to an external page).

With the new error codes, you can make more informed decisions about how to remedy the problem. For example, error code EXCEPTION_BAD_REQUEST and EXCEPTION_TOO_MANY_REQUEST indicate potential programming issues, while EXCEPTION_ACCESS_TOKEN_REJECTED indicates an issue with your Access Token.

Please note, you may need to change your code if you have added special handling for REGISTRATION_ERROR_CODE/31301(link takes you to an external page) or EXCEPTION_CONNECTION_ERROR/31005(link takes you to an external page).

For more information see the API docs(link takes you to an external page)

The following is a summary of the new codes available for Voice.register(...) and Voice.unregister(...):

Error CodeError Message
31400Bad Request
31403Forbidden
31404Not Found
31408Request Timeout
31409Conflict
31426Upgrade Required. This is most likely related to a TLS version not accepted by Twilio's infrastructure
31429Too Many Requests
31500Internal Server
31502Bad Gateway
31503Service Unavailable
31504Gateway Timeout

The following is a summary of the new codes available for Voice.connect(...) and CallInvite.accept(...):

Error CodeError Message
31009Transport error
31400Bad Request
31403Forbidden
31404Not Found
31408Request Timeout
31480Temporarily Unavailable
31481Call/Transaction Does Not Exist
31486Busy Here
31487Request Terminated
31500