intent == null
).The Call Message Events feature in the Twilio Voice React Native SDK, previously released in 1.0.0
as Beta, is promoted to Generally Available (GA).
(Breaking) The error code for attempting to send a call message with a payload size exceeding maximum limits has changed from 31209
to 31212
.
The behavior of call.sendMessage
has been changed to support future contentType
s.
Please see the API Docs for more information.
6.6.2
of the Twilio Voice Android SDK.6.11.2
of the Twilio Voice iOS SDK.minSdkVersion
to 23
to match the latest versions of React Native.Fixed crash issue on API 34 when activity is not running in background or foreground and an incoming call is received.
Fixed some RTCStats members not available on Android. Specifically, mos
, bytesSent
, and bytesReceived
.
Added support for Android 34.
The SDK now gracefully handles missing microphone permissions on the Android platform.
When using the JavaScript API, callInvite.accept()
and voice.connect()
will now reject with error PermissionsError
and code 31401
.
When accepting an incoming call through the native notification, you can catch the analogous 31401
error by attaching a listener to voice.on(Voice.Event.Error, ...)
. See the following example:
1voice.on(Voice.Event.Error, (error) => {2// handle error3if (error.code === 31401) {4// show the end-user that they did not give the app the proper permissions5}6});
Resolved an issue where Call Messages were not being constructed with the specified contentType
or messageType
.
Resolved an issue where some OutgoingCallMessage.Event.Failure
events were not being raised due to a race condition.
(Breaking) Removed CallMessage.MessageType
and CallMessage.ContentType
enumerations and types. These types have been replaced by string
.
(Breaking) Simplified the Call
and CallInvite
APIs for sending call messages. Call.sendMessage
and CallInvite.sendMessage
now take a plain-JS object, or interface, as a parameter.
The following is an example of the updated API considering the above changes.
For outgoing calls:
1const call = await voice.connect(...);2const outgoingCallMessage = await call.sendMessage({3content: { foo: 'bar' },4contentType: 'application/json',5messageType: 'user-defined-message',6});
For call invites:
1voice.on(Voice.Event.CallInvite, (callInvite) => {2const outgoingCallMessage = await callInvite.sendMessage({3content: { foo: 'bar' },4contentType: 'application/json',5messageType: 'user-defined-message',6});7});
Error Code | Description |
---|---|
31210 | Raised when a Call Message is sent with an invalid message type. |
31211 | Raised when attempting to send a Call Message before the Call/CallInvite is ready to send messages. This can typically happen when the Call/CallInvite is not yet in a ringing state. |
Twilio Voice React Native SDK has now reached milestone 1.0.0
and is Generally
Available (GA). Included in this version are the following.
sent
and failure
cases:1const message = new CallMessage({2content: { key1: 'This is a message from the parent call' },3contentType: CallMessage.ContentType.ApplicationJson,4messageType: CallMessage.MessageType.UserDefinedMessage5});6const outgoingCallMessage: OutgoingCallMessage = await call.sendMessage(message);78outgoingCallMessage.addListener(OutgoingCallMessage.Event.Failure, (error) => {9// outgoingCallMessage failed, handle error10});1112outgoingCallMessage.addListener(OutgoingCallMessage.Event.Sent, () => {13// outgoingCallMessage sent14});
receive
a CallMessage:1call.addListener(Call.Event.MessageReceived, (message: CallMessage) => {2// callMessage received3});
Voice
and Call
listeners. The descriptions of the events and listeners should now point to the correct docstrings.The API for call.getInitialConnectedTimestamp()
has now changed.
Please see the API documentation here for details.
The method call.getInitialConnectedTimestamp()
now returns a Date
object.
1const call = voice.connect(...);2const date = call.getInitialConnectedTimestamp();3const millisecondsSinceEpoch = date.getTime();
The API for Call Invite events has now changed.
The following events have been moved from the Voice
class to the CallInvite
class:
Voice#callInviteAccepted
is now CallInvite#accepted
Voice#callInviteRejected
is now CallInvite#rejected
Voice#callInviteNotificationTapped
is now CallInvite#notificationTapped
Voice#cancelledCallInvite
is now CallInvite#cancelled
Please see the Voice
class API documentation here for details.
Please see the CallInvite
class API documentation here for details.
Call Notifications can be customized on Android.
The following features regarding a call notification can now be modified:
The incoming/outgoing/answered call notification tray icon can be changed by adding a drawable resource with the following id to your application:
incoming_call_small_icon
for incoming call notificationsanswered_call_small_icon
for answered call notificationsoutgoing_call_small_icon
for outgoing call notificationsThe name of the caller or recipient of a call in the notification can be set by adding the following string resources with the following ids to your application:
incoming_call_caller_name_text
for incoming call notificationsoutgoing_call_caller_name_text
for outgoing call notificationsanswered_call_caller_name_text
for answered call notifications
incoming_call_caller_name_text
and answered_call_caller_name_text
, the substring ${from}
will be replaced with the caller and for outgoing_call_caller_name_text
, the substring ${to}
will be replaced with the recipient of the call (if available, defaulting to "unknown").Custom functionality around the displayName
TwiML parameter has been removed.
In previous versions of the SDK, passing a custom TwiML parameter displayName
would override the notification on Android platforms. Now, this functionality has been removed and notification customization is handled with the above features.
CallInvite.updateCallerHandle()
has been added. Use this method to update the caller's name displayed in the iOS system incoming call UI. This method is specific to iOS and unavailable in Android.Twilio Voice React Native SDK has now reached milestone beta.4
. Included in this version are the following.
CustomParameters
type to Record<string, string>
instead of Record<string, any>
.AudioDevice
typings, preferring undefined
over null
for optional values.call.isMuted()
and call.isOnHold()
APIs. They should now always return boolean \| undefined
instead of potentially returning null
.call.getFrom()
, call.getTo()
, and call.getSid()
APIs. They should now always return string \| undefined
instead of potentially returning null
.registered
and unregistered
events are not fired on iOS.Twilio Voice React Native SDK has now reached milestone beta.3
. Included in this version are the following.
Applications can now choose to use their own iOS PushKit implementation or delegate the incoming call handling to the SDK's default handler by calling the Voice.initializePushRegistry()
method, referred henceforth as the "SDK PushKit handler".
Note that when not using the "SDK PushKit handler", applications will need to notify the SDK upon receiving PushKit device token updates so the SDK can perform registration properly. Applications will also need to notify the SDK upon receiving push notifications so the SDK can report incoming calls to the iOS CallKit framework properly. See this page for more details.
Voice.Event.CallInviteNotificationTapped
for more information.Earpiece
instead of earpiece
.Call.mute
and Call.hold
to return the new mute/hold value. Thanks to our community (@treycucco with PR #164) for this addition!IncomingCallService
now specifies foreground service type MICROPHONE on API >= 30
devices.
This fixes issues with microphone access for backgrounded apps.
Note that this change also resulted in the compiled SDK version being bumped to 33
from 29
.Twilio Voice React Native SDK has now reached milestone beta.2
. Included in this version are the following.
Voice.getCalls
, the Call
objects will now have the proper state.Call.Event.Connected
event.
See Call.getInitialConnectedTimestamp
.Twilio Voice React Native SDK is now in beta! Please see the following changes with this new release. Additionally, we are also introducing the new Twilio Voice React Native Reference App as an example implementation of the Twilio Voice React Native SDK and serves to inspire developers who want to leverage the power of Twilio Programmable Voice in their React Native applications. Please see this page for more details.
example/
has been renamed/moved to test/app/
.0.63.4
to 0.66.5
.The voice.connect
method now has the following function signature
1voice.connect(token: string, options?: Voice.ConnectOptions);23interface Voice.ConnectOptions {4contactHandle?: string;5params?: Record<string, string>;6}
Not passing an options object or leaving any member of the options object undefined will result in those options using default values. See the API documentation for descriptions of options here.
The SDK now exports error classes and emits error objects specific to an error code. See the below code snippet for usage.
1import { TwilioErrors } from '@twilio/voice-react-native-sdk';2// ...3voice.on(Voice.Event.Error, (error: TwilioErrors.TwilioError) => {4if (error instanceof TwilioErrors.AuthorizationErrors.AccessTokenInvalid) {5// Update your UI to reflect an invalid access token.6}78// Alternatively, your application logic can use the error code.910if (error.code === 20101) {11// Update your UI to reflect an invalid access token.12}13});
See the API Docs for all error classes.
Call
and Voice
classes were being incorrectly exported. Types and references to addEventListener
are instead now correctly exported as addListener
.NativeEventEmitter
.