Announcing General Availability of Twilio’s Programmable Voice Mobile SDKs 3.0

April 26, 2019
Written by
Aymen Naim
Twilion

Programmable Voice iOS SDK

With Twilio’s Programmable Voice SDKs for iOS and Android, you can easily build engaging and high quality voice calling experiences into your Apps. Whether it is calling a phone number (PSTN), another App user (VoIP), or your contact center, you can bring a contextual and secure calling experience to your users directly from your App.

We are thrilled to announce that our latest version of Programmable Voice Mobile SDKs, 3.0, is now generally available. With 3.0, you can make your customer call experiences even more engaging: with improved audio quality, increased efficiency, and contextual calling. This release includes features such as support for Opus codec, call control functions, and custom parameters.

We will walk you through the advantages of using Mobile VoIP with some common use cases, what new features rolled out with 3.0, and explain how to get started and/or migrate to Twilio Programmable Voice SDKs 3.0.

Eager to get started? Click here!

Mobile VoIP Advantages and Applicability

Applications that embed Programmable Voice SDKs to provide Mobile VoIP calling can take advantage of features that allow you to create secure and engaging applications not available through traditional calling.

For example, instead of having your customers traverse a myriad of Interactive Voice Response (IVR) options to connect to the right department or person, you can leverage your knowledge of where a user is in your app’s UI to determine the customer’s needs and connect that information to the right person when your customer calls.

Programmable Voice SDKs can be useful for services that allow users to interact directly with each other but do not want to share their phone number. Programmable Voice can protect users’ information by connecting their calls using VoIP to keep their phone numbers private.

Programmable Voice SDKs come with the benefit of building on top of Twilio’s infrastructure, enabling you to unlock Twilio’s suite of programmability features. You can create conferences, transfer calls, queue calls, record calls, playback automated messages, break out to PSTN or other SIP infrastructure, and collect payments during the call. You can leverage these building blocks to build an engaging end to end experience.

Highlights of Programmable Voice Mobile SDK 3.0

Programmable Voice SDK 3.0 continues to support placing calls, receiving calls through push notifications, CallKit integration on iOS, and sending Dual-Tone Multi-Frequency (DTMF) digits as SDK 2.x did. With this release, we have also added the following new features:

  • Support for Opus codec: Provides superior sound quality for half of the bandwidth of G711 (PCMU) and better handling of transient network problems which can occur in mobile networks
  • Hold and Resume: Introduces two new API calls for holding and resuming a call
  • Call Ringing State: Emits an event when the remote party’s device starts ringing
  • Custom Parameters: Enables the callee to read custom call parameters set by your TwiML application. Use this to send contextual information or any application data you like
  • Media statistics API: Retrieves real time data on how the call is performing
  • Real-time insights: Collects metrics and events to visualise your data and find any problems earlier
  • AudioDevice API for iOS: Allows you to process sound input before sending and process sound output before playback
  • Network connectivity and network handover improvements: Adds IPv6 support and enables seamless switching between networks. This release brings around 15% reduction in connection time
  • API documentation: Includes improved API docs with all relevant information and code snippets in one place

Improved Audio quality, Opus Codec and WebRTC

Twilio’s Programmable Voice SDK 3.0 media engine is now built on top of Chromium’s implementation of WebRTC. This enables more media features as well as Opus support.

Media engine features include Acoustic Echo Cancellation (AEC), Forward Error Correction (FEC), and  Automatic Gain Control (AGC). The Interactive Connectivity Establishment (ICE) media flow setup is optimised for the available networks, media flow disruption is mitigated with the improved network handover capabilities.

With this new media engine, we are seeing improvements in low quality indicators such as 90% less Low Moss events, and 75% less High Jitter events generated.

Compared to G.711 (PCMU), the other codec currently supported, Opus delivers a superior voice quality at less than half the bandwidth (around 40kb/s as opposed to 80kb/s).

Want to know more about Opus? Check out our recent blog post for more information.

Hold/Resume

The SDK now directly enables you to place a connected call on hold and resume it.

Check the following for a code snippet for Android and Obj-C API

Ringing Call State

With answerOnBridge enabled, SDK 3.0 now generates a ringing event. With this event, your application can generate a ringing tone or provide some other indicator to the caller when the remote party’s phone starts ringing. 

Check the following for code snippets: Obj-C, Swift and Android

Caller Name and Custom Parameters

It is now possible to send custom parameters to the callee’s application. To pass a custom parameter, add a <Parameter> element and set its name attribute to “caller_name” in your TwiML response. This value can then be retrieved by your application to display the caller’s name.

Here is a TwiML example of passing parameters:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial callerId="+15108675309">
    <Client>
      <Identity>tommy</Identity>
      <Parameter name="caller_name" value="Jenny" />
    </Client>
  </Dial>
</Response>

Check the following for usage examples: Obj-C, Swift and Android

Media Statistics

Audio level, packets sent, received and lost are among the new metrics introduced in the Statistics APIs. With these new APIs you get real- time info about the call’s performance.

Check the following for how to read the call stats: Obj-C, Swift and Android

Improved Connectivity

Improved connectivity is achieved behind the scenes with no code changes required. For example, the SDK makes fewer DNS lookups and one less round trip when connecting. This results in a 15% reduction in connect times.

New Insights Events

We added more insights events to track the users’ calling experiences. These insight events are listed in the API documentation (iOS and Android). For example, TVOCall and Call list all the insight events that are generated when using these classes. This will allow you to monitor call quality and troubleshoot problems your users report.

AudioDevice API for iOS

The AudioDevice API lets you provide custom input/output audio processing.

Your custom device supplies the audio frames you would like to be sent to the media engine, and the media engine supplies you the incoming audio packets for you to process and play out.

You can use this API to play out a media file and the mic input together to the remote party. The following diagram shows an example of how you could add custom audio processing.

This diagram shows an example of how you could add custom audio processing

Check out the custom AudioDevice example created by our Video SDK team. The Voice SDK version of AudioDevice is identical. You can find it here for Obj-C, Swift 

Push Notifications & Background Operation

As with Mobile Voice SDK 2.x, you can receive calls even when your app is in the background or not running. Twilio will send your application a Push Notification when there’s an incoming call. This notification will wake up the application which allows the SDK to initialize and process the incoming call logic.

iOS CallKit Support

We continue to support CallKit integration on iOS. With this release, we allow for greater flexibility around AudioSession handling. In SDK 3.0, you have full access to the AudioSession object so you can handle the AudioSession events as best suited to your application.

Check the following CallKit starter project for Obj-C and Swift for how to add CallKit functionality to your App.

Let’s Get Started

If you are already using SDK 2.x, we have a migration guide. See our migration guide for iOS and Android.

Haven’t built a Mobile Programmable Voice Mobile application before? No problem, we have the perfect Getting Started guides for iOS and Android. With these guides, you create an App that can make and receive calls.


We are very proud of this feature full SDK release. With improved audio quality, in-app ringing state event, and contextual calls through call parameters, SDK 3.0 enables you to provide an engaging and high quality calling experience for your customers. We can't wait to see what you’ll build with Programmable Voice SDK 3.0!

If you have any questions or need help with anything Twilio, don’t hesitate to reach us at support@twilio.com. You can also reach us through Github iOS and Android.