Class Voice
- java.lang.Object
-
- com.twilio.voice.Voice
-
public abstract class Voice extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Voice.RegistrationChannel
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Call
connect(android.content.Context context, ConnectOptions connectOptions, Call.Listener listener)
Creates and returns a newCall
.static Call
connect(android.content.Context context, java.lang.String accessToken, Call.Listener listener)
Creates and returns a newCall
.static void
enableInsights(boolean enable)
Specify reporting statistics to Insights.static AudioDevice
getAudioDevice()
Returns the AudioDevice.static java.lang.String
getEdge()
Returns the edge specified byedge
.static LogLevel
getLogLevel()
Returns the logging level for messages logged by the Voice SDK.static LogLevel
getModuleLogLevel(LogModule module)
Returns the logging level for messages logged by the specified LogModule.static java.lang.String
getRegion()
Deprecated.As of release 5.3.0, usegetEdge()
instead.static java.lang.String
getVersion()
Returns the version of the Voice SDK.static boolean
handleMessage(android.content.Context context, android.os.Bundle data, MessageListener listener)
Handle messages from GCM.static boolean
handleMessage(android.content.Context context, java.util.Map<java.lang.String,java.lang.String> data, MessageListener listener)
Handle messages from FCM.static boolean
isInsightsEnabled()
Returns if reporting statistics to Insights is enabled.static void
register(java.lang.String accessToken, Voice.RegistrationChannel registrationChannel, java.lang.String registrationToken, RegistrationListener listener)
Register for incoming call messages.static void
setAudioDevice(AudioDevice audioDevice)
Sets the custom audio device.static void
setEdge(java.lang.String edge)
Sets the edge (Twilio data center) for the SDK.static void
setLogLevel(LogLevel level)
Sets the logging level for messages logged by the Voice SDK.static void
setModuleLogLevel(LogModule module, LogLevel level)
Sets the logging level for messages logged by a specific module.static void
setRegion(java.lang.String region)
Deprecated.As of release 5.3.0, usesetEdge(String)
instead.static void
unregister(java.lang.String accessToken, Voice.RegistrationChannel registrationChannel, java.lang.String registrationToken, UnregistrationListener listener)
Unregister from receiving further incoming call messages.
-
-
-
Method Detail
-
register
public static void register(@NonNull java.lang.String accessToken, @NonNull Voice.RegistrationChannel registrationChannel, @NonNull java.lang.String registrationToken, @NonNull RegistrationListener listener)
Register for incoming call messages. A successful registration will ensure that push notifications will arrive via the GCM or FCM service for the lifetime of the registration device token provided by the GCM or FCM service instance. When registration is successful,RegistrationListener.onRegistered(...)
callback is raised. Once successfully registered, the registered binding has a time-to-live(TTL) of 1 year. If the registered binding is inactive for 1 year, it is deleted and push notifications to the registered identity will not succeed. However, whenever the registered binding is used to reach the registered identity, the TTL is reset to 1 year.If registration fails,
RegistrationListener.onError(...)
callback is raised withRegistrationException
.RegistrationException.getMessage(...)
provides the root cause of the failure.Registration Exceptions Registration Exception Error Code Description VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN
20101 Twilio was unable to validate your Access Token VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_HEADER
20102 Invalid Access Token header VoiceException.EXCEPTION_INVALID_ISSUER_SUBJECT
20103 Invalid Access Token issuer or subject VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_EXPIRY
20104 Access Token has expired or expiration date is invalid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_NOT_VALID_YET
20105 Access Token not yet valid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_GRANT
20106 Invalid Access Token grants VoiceException.EXCEPTION_INVALID_TTL
20157 Expiration Time in the Access Token Exceeds Maximum Time Allowed VoiceException.EXCEPTION_INVALID_TOKEN
20403 Forbidden. The account lacks permission to access the Twilio API VoiceException.EXCEPTION_ACCESS_TOKEN_REJECTED
51007 Token authentication is rejected by authentication service RegistrationException.EXCEPTION_REGISTRATION_ERROR
31301 Registration failed. Look at RegistrationException.getMessage(...) for details VoiceException.EXCEPTION_BAD_REQUEST
31400 Bad Request. The request could not be understood due to malformed syntax VoiceException.EXCEPTION_FORBIDDEN
31403 Forbidden. The server understood the request, but is refusing to fulfill it VoiceException.EXCEPTION_NOT_FOUND
31404 Not Found. The server has not found anything matching the request VoiceException.EXCEPTION_REQUEST_TIMEOUT
31408 Request Timeout. A request timeout occurred RegistrationException.EXCEPTION_CONFLICT
31409 Conflict. The request could not be processed because of a conflict in the current state of the resource. Another request may be in progress RegistrationException.EXCEPTION_UPGRADE_REQUIRED
31426 Upgrade Required. The client should switch to a different protocol RegistrationException.EXCEPTION_TOO_MANY_REQUEST
31429 Too Many Requests. Too many requests were sent in a given amount of time VoiceException.EXCEPTION_INTERNAL_SERVER_ERROR
31500 Internal Server Error. The server could not fulfill the request due to some unexpected condition VoiceException.EXCEPTION_BAD_GATEWAY
31502 Bad Gateway. The server is acting as a gateway or proxy, and received an invalid response from a downstream server while attempting to fulfill the request VoiceException.EXCEPTION_SERVICE_UNAVAILABLE
31503 Service Unavailable. The server is currently unable to handle the request due to a temporary overloading or maintenance of the server VoiceException.EXCEPTION_GATEWAY_TIMEOUT
31504 Gateway Timeout. The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server The identity provided in the
Insights :accessToken
may only contain alpha-numeric and underscore characters. Other characters, including spaces, will result in undefined behavior.Insights events Group Name Event Name Description Since version registration registration Registration is successful 3.0.0-preview4 registration registration-error Registration failed 3.0.0-preview4 The maximum number of characters for the identity provided in the token is 121. The identity may only contain alpha-numeric and underscore characters. Other characters, including spaces, or exceeding the maximum number of characters, will result in not being able to place or receive calls.
- Parameters:
accessToken
- An access token.registrationChannel
- An enumeration of registration channels.registrationToken
- A GCM or FCM registration token.listener
- A listener that receives registration request status.- Usage example:
final String registrationToken = FirebaseInstanceId.getInstance().getToken(); if (registrationToken != null) { Voice.register(accessToken, Voice.RegistrationChannel.FCM, registrationToken, registrationListener); }
-
unregister
public static void unregister(@NonNull java.lang.String accessToken, @NonNull Voice.RegistrationChannel registrationChannel, @NonNull java.lang.String registrationToken, @NonNull UnregistrationListener listener)
Unregister from receiving further incoming call messages. When unregistration is successful,UnregistrationListener.onUnregistered(...)
callback is raised.If unregistration fails,
UnregistrationListener.onError(...)
callback is raised withRegistrationException
.RegistrationException.getMessage(...)
provides the root cause of the failure.Unregistration Exceptions Registration Exception Error Code Description VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN
20101 Twilio was unable to validate your Access Token VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_HEADER
20102 Invalid Access Token header VoiceException.EXCEPTION_INVALID_ISSUER_SUBJECT
20103 Invalid Access Token issuer or subject VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_EXPIRY
20104 Access Token has expired or expiration date is invalid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_NOT_VALID_YET
20105 Access Token not yet valid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_GRANT
20106 Invalid Access Token grants VoiceException.EXCEPTION_INVALID_TTL
20157 Expiration Time in the Access Token Exceeds Maximum Time Allowed VoiceException.EXCEPTION_INVALID_TOKEN
20403 Forbidden. The account lacks permission to access the Twilio API VoiceException.EXCEPTION_ACCESS_TOKEN_REJECTED
51007 Token authentication is rejected by authentication service RegistrationException.EXCEPTION_REGISTRATION_ERROR
31301 Registration failed. Look at RegistrationException.getMessage(...) for details VoiceException.EXCEPTION_BAD_REQUEST
31400 Bad Request. The request could not be understood due to malformed syntax VoiceException.EXCEPTION_FORBIDDEN
31403 Forbidden. The server understood the request, but is refusing to fulfill it VoiceException.EXCEPTION_NOT_FOUND
31404 Not Found. The server has not found anything matching the request VoiceException.EXCEPTION_REQUEST_TIMEOUT
31408 Request Timeout. A request timeout occurred RegistrationException.EXCEPTION_CONFLICT
31409 Conflict. The request could not be processed because of a conflict in the current state of the resource. Another request may be in progress RegistrationException.EXCEPTION_UPGRADE_REQUIRED
31426 Upgrade Required. The client should switch to a different protocol RegistrationException.EXCEPTION_TOO_MANY_REQUEST
31429 Too Many Requests. Too many requests were sent in a given amount of time VoiceException.EXCEPTION_INTERNAL_SERVER_ERROR
31500 Internal Server Error. The server could not fulfill the request due to some unexpected condition VoiceException.EXCEPTION_BAD_GATEWAY
31502 Bad Gateway. The server is acting as a gateway or proxy, and received an invalid response from a downstream server while attempting to fulfill the request VoiceException.EXCEPTION_SERVICE_UNAVAILABLE
31503 Service Unavailable. The server is currently unable to handle the request due to a temporary overloading or maintenance of the server VoiceException.EXCEPTION_GATEWAY_TIMEOUT
31504 Gateway Timeout. The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server The identity provided in the
Insights :accessToken
may only contain alpha-numeric and underscore characters. Other characters, including spaces, will result in undefined behavior.Insights events Group Name Event Name Description Since version registration unregistration Unregistration is successful 3.0.0-preview4 registration unregistration-error Unregistration failed 3.0.0-preview4 The maximum number of characters for the identity provided in the token is 121. The identity may only contain alpha-numeric and underscore characters. Other characters, including spaces, or exceeding the maximum number of characters, will result in not being able to place or receive calls.
- Parameters:
accessToken
- An access token.registrationChannel
- An enumeration of registration channels.registrationToken
- An FCM or GCM device token.listener
- A listener that receives unregistration request status.- Usage example:
Voice.unregister(accessToken, Voice.RegistrationChannel.FCM, registrationToken, unregistrationListener);
-
connect
@NonNull public static Call connect(@NonNull android.content.Context context, @NonNull ConnectOptions connectOptions, @NonNull Call.Listener listener)
Creates and returns a newCall
. ASecurityException
will be thrown if RECORD_AUDIO is not granted.Call.Listener
receives the state of theCall
.Call.Listener events Callback Name Description Since version Call.Listener.onConnectFailure(Call, CallException)
The call failed to connect. CallException
provides details of the root cause.3.0.0-preview1 Call.Listener.onRinging(Call)
Emitted once before the Call.Listener.onConnected(Call)
callback when the callee is being alerted of aCall
.3.0.0-preview2 Call.Listener.onConnected(Call)
The call has connected. 3.0.0-preview1 Call.Listener.onDisconnected(Call, CallException)
The call was disconnected. If the call ends due to an error the `CallException` is non-null. If the call ends normally `CallException` is null. 3.0.0-preview1 If
connect
fails,Call.Listener.onConnectFailure(Call, CallException)
callback is raised withCallException
.VoiceException.getMessage()
andVoiceException.getExplanation()
provide details of the failure. IfCall.disconnect()
is called while attempting to connect, theCall.Listener.onDisconnected(Call, CallException)
callback will be raised with no error.If
connect(Context, ConnectOptions, Call.Listener)
fails due to an authentication error, the SDK receives one of the following errors.Authentication Exceptions Authentication Exception Error Code Description VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN
20101 Twilio was unable to validate your Access Token VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_HEADER
20102 Invalid Access Token header VoiceException.EXCEPTION_INVALID_ISSUER_SUBJECT
20103 Invalid Access Token issuer or subject VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_EXPIRY
20104 Access Token has expired or expiration date is invalid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_NOT_VALID_YET
20105 Access Token not yet valid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_GRANT
20106 Invalid Access Token grants VoiceException.EXCEPTION_AUTH_FAILURE
20151 Twilio failed to authenticate the client VoiceException.EXCEPTION_INVALID_TTL
20157 Expiration Time in the Access Token Exceeds Maximum Time Allowed VoiceException.EXCEPTION_INVALID_TOKEN
20403 Forbidden. The account lacks permission to access the Twilio API CallException.EXCEPTION_INVALID_APPLICATION_SID
21218 Invalid ApplicationSid If
connect(Context, ConnectOptions, Call.Listener)
fails due to any other reasons, the SDK receives one of the following errors.Insights :
Insights events Group Name Event Name Description Since version connection outgoing Outgoing call is made. Call state is in Call.State.CONNECTING
state3.0.0-beta2 settings codec Negotiated selected codec is received and remote SDP is set 5.0.1 If connect fails, an error event is published to Insights.
Insights events Group Name Event Name Description Since version connection error Error description. Call state transitions to Call.State.DISCONNECTED
3.0.0-beta2 - Parameters:
context
- An Android context.connectOptions
- A set of options that allow you to configure yourCall
.listener
- A listener that receives call status.- Returns:
- A new
Call
- Usage example:
ConnectOptions connectOptions = new ConnectOptions.Builder(accessToken).build(); Call call = Voice.connect(context, connectOptions, new Call.Listener() { @Override public void onRinging(@NonNull Call call) { Log.d(TAG, "Ringing"); } @Override public void onConnected(@NonNull final Call call) { Log.d(TAG, "Received onConnected " + call.getSid()); } @Override public void onConnectFailure(@NonNull Call call, @NonNull CallException callException) { Log.d(TAG, "Received onConnectFailure with CallException: " + callException.getErrorCode()+ ":" + callException.getMessage()); } @Override public void onDisconnected(@NonNull Call call, CallException callException) { if (callException != null) { Log.d(TAG, "Received onDisconnected with CallException: " + callException.getMessage() + ": " + call.getSid()); } else { Log.d(TAG, "Received onDisconnected"); } } }); }
-
connect
@NonNull public static Call connect(@NonNull android.content.Context context, @NonNull java.lang.String accessToken, @NonNull Call.Listener listener)
Creates and returns a newCall
. ASecurityException
will be thrown if RECORD_AUDIO is not granted.Call.Listener
receives the state of theCall
.Call.Listener events Callback Name Description Since version Call.Listener.onConnectFailure(Call, CallException)
The call failed to connect. CallException
provides details of the root cause.3.0.0-preview1 Call.Listener.onRinging(Call)
Emitted once before the Call.Listener.onConnected(Call)
callback when the callee is being alerted of aCall
.3.0.0-preview2 Call.Listener.onConnected(Call)
The call has connected. 3.0.0-preview1 Call.Listener.onDisconnected(Call, CallException)
The call was disconnected. If the call ends due to an error the `CallException` is non-null. If the call ends normally `CallException` is null. 3.0.0-preview1 If
connect
fails,Call.Listener.onConnectFailure(Call, CallException)
callback is raised withCallException
.VoiceException.getMessage()
andVoiceException.getExplanation()
provide details of the failure. IfCall.disconnect()
is called while attempting to connect, theCall.Listener.onDisconnected(Call, CallException)
callback will be raised with no error.If
connect(Context, String, Call.Listener)
fails due to an authentication error, the SDK receives one of the following errors.Authentication Exceptions Authentication Exception Error Code Description VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN
20101 Twilio was unable to validate your Access Token VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_HEADER
20102 Invalid Access Token header VoiceException.EXCEPTION_INVALID_ISSUER_SUBJECT
20103 Invalid Access Token issuer or subject VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_EXPIRY
20104 Access Token has expired or expiration date is invalid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_NOT_VALID_YET
20105 Access Token not yet valid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_GRANT
20106 Invalid Access Token grants VoiceException.EXCEPTION_AUTH_FAILURE
20151 Twilio failed to authenticate the client VoiceException.EXCEPTION_INVALID_TTL
20157 Expiration Time in the Access Token Exceeds Maximum Time Allowed VoiceException.EXCEPTION_INVALID_TOKEN
20403 Forbidden. The account lacks permission to access the Twilio API CallException.EXCEPTION_INVALID_APPLICATION_SID
21218 Invalid ApplicationSid If
connect(Context, String, Call.Listener)
fails due to any other reason, the SDK receives one of the following errors.The identity provided in the
accessToken
may only contain alpha-numeric and underscore characters. Other characters, including spaces, will result in undefined behavior.Insights :
Insights events Group Name Event Name Description Since version connection outgoing Outgoing call is made. Call state is in Call.State.CONNECTING
state3.0.0-beta2 settings codec Negotiated selected codec is received and remote SDP is set 5.0.1 If connect fails, an error event is published to Insights.
Insights events Group Name Event Name Description Since version connection error Error description. Call state transitions to Call.State.DISCONNECTED
3.0.0-beta2 The maximum number of characters for the identity provided in the token is 121. The identity may only contain alpha-numeric and underscore characters. Other characters, including spaces, or exceeding the maximum number of characters, will result in not being able to place or receive calls.
- Parameters:
context
- An Android context.accessToken
- The accessToken that provides the identity and grants of the caller.listener
- A listener that receives call status.- Returns:
- A new
Call
- Usage example:
Call call = Voice.connect(context, accessToken, new Call.Listener() { @Override public void onRinging(@NonNull Call call) { Log.d(TAG, "Ringing"); } @Override public void onConnected(@NonNull final Call call) { Log.d(TAG, "Received onConnected " + call.getSid()); } @Override public void onConnectFailure(@NonNull Call call, @NonNull CallException callException) { Log.d(TAG, "Received onConnectFailure with CallException: " + callException.getErrorCode()+ ":" + callException.getMessage()); } @Override public void onDisconnected(@NonNull Call call, CallException callException) { if (callException != null) { Log.d(TAG, "Received onDisconnected with CallException: " + callException.getMessage() + ": " + call.getSid()); } else { Log.d(TAG, "Received onDisconnected"); } } }); }
-
handleMessage
public static boolean handleMessage(@NonNull android.content.Context context, @NonNull java.util.Map<java.lang.String,java.lang.String> data, @NonNull MessageListener listener)
Handle messages from FCM.Twilio sends
call
notification messages via GCM/FCM. The message type is encoded in the dictionary with the keytwi_message_type
with the valuetwilio.voice.call
.A
call
message is sent when someone wants to reach the registeredidentity
. Passing acall
message intohandleMessage(Context, Bundle, MessageListener)
will result in aCallInvite
raised in theMessageListener
and returntrue
.A
CancelledCallInvite
will be raised to the providedMessageListener
for the following reasons:- The call is prematurely disconnected by the caller
- The callee does not accept or reject the call within 30 seconds
- The SDK is unable to establish a connection to Twilio
Passing malformed data to
handleMessage(Context, Map, MessageListener)
will returnfalse
and noMessageListener
callback will be raised.Insights :
Insights events Group Name Event Name Description Since version connection incoming Incoming call notification received 3.0.0-preview1 connection listen Raised when an attempt to listen for cancellations is made 5.0.0 connection listening Raised when an attempt to listen for cancellations has succeeded 5.0.0 connection cancel Raised when a cancellation has been reported 5.0.0 connection listening-error Raised when an attempt to listen for cancellation has failed 5.0.0 registration unsupported-cancel-message-error Raised when a "cancel" push notification is processed by the SDK. This version of the SDK does not support "cancel" push notifications 5.0.0 - Parameters:
context
- An Android context.data
- Push notification payload.listener
- AMessageListener
to receive incoming push notification callbacks.- Returns:
- A boolean value that indicates whether the payload is a valid notification sent by Twilio.
- Usage example:
boolean valid = Voice.handleMessage(dataMap, new MessageListener() { @Override public void onCallInvite(@NonNull CallInvite callInvite) { Log.d(TAG, "Received CallInvite"); } @Override public void onCancelledCallInvite(@NonNull CancelledCallInvite cancelledCallInvite) { Log.d(TAG, "Received CancelledCallInvite"); } });
-
handleMessage
public static boolean handleMessage(@NonNull android.content.Context context, @NonNull android.os.Bundle data, @NonNull MessageListener listener)
Handle messages from GCM.Twilio sends
call
notification messages via GCM/FCM. The message type is encoded in the dictionary with the keytwi_message_type
with the valuetwilio.voice.call
.A
call
message is sent when someone wants to reach the registeredidentity
. Passing acall
message intohandleMessage(Context, Bundle, MessageListener)
will result in aCallInvite
raised in theMessageListener
and returntrue
.A
CancelledCallInvite
will be raised to the providedMessageListener
for the following reasons:- The call is prematurely disconnected by the caller
- The callee does not accept or reject the call within 30 seconds
- The SDK is unable to establish a connection to Twilio
Passing malformed data to
handleMessage(Context, Map, MessageListener)
will returnfalse
and noMessageListener
callback will be raised.Insights :
Insights events Group Name Event Name Description Since version connection incoming Incoming call notification received 3.0.0-preview1 connection listen Raised when an attempt to listen for cancellations is made 5.0.0 connection listening Raised when an attempt to listen for cancellations has succeeded 5.0.0 connection cancel Raised when a cancellation has been reported 5.0.0 connection listening-error Raised when an attempt to listen for cancellation has failed 5.0.0 registration unsupported-cancel-message-error Raised when a "cancel" push notification is processed by the SDK. This version of the SDK does not support "cancel" push notifications 5.0.0 - Parameters:
context
- An Android context.data
- Push notification payload.listener
- AMessageListener
to receive incoming push notification callbacks.- Returns:
- A boolean value that indicates whether the payload is a valid notification sent by Twilio.
- Usage example:
boolean valid = Voice.handleMessage(dataMap, new MessageListener() { @Override public void onCallInvite(@NonNull CallInvite callInvite) { Log.d(TAG, "Received CallInvite"); } @Override public void onCancelledCallInvite(@NonNull CancelledCallInvite cancelledCallInvite) { Log.d(TAG, "Received CancelledCallInvite"); } });
-
getVersion
@NonNull public static java.lang.String getVersion()
Returns the version of the Voice SDK.- Returns:
- The version of the SDK.
-
getLogLevel
@NonNull public static LogLevel getLogLevel()
Returns the logging level for messages logged by the Voice SDK. The default level isLogLevel.ERROR
.- Returns:
- the logging level
-
getModuleLogLevel
@NonNull public static LogLevel getModuleLogLevel(LogModule module)
Returns the logging level for messages logged by the specified LogModule. The default log level for each module isLogLevel.ERROR
.- Returns:
- the logging level
-
isInsightsEnabled
public static boolean isInsightsEnabled()
Returns if reporting statistics to Insights is enabled. Sending stats data to Insights is enabled by default. The setting is specified inenableInsights
and can be updated viaenableInsights(boolean)
-
getRegion
@Deprecated @NonNull public static java.lang.String getRegion()
Deprecated.As of release 5.3.0, usegetEdge()
instead.Returns the region specifiedregion
. The default region uses Global Low Latency routing, which establishes a connection with the closest region to the user. This value can be updated viasetRegion(String)
-
getEdge
@NonNull public static java.lang.String getEdge()
Returns the edge specified byedge
. The default edge uses Global Low Latency (roaming edge location)routing, which establishes a connection with the closest data center to the user. This value can be updated viasetRegion(String)
-
getAudioDevice
@NonNull public static AudioDevice getAudioDevice()
Returns the AudioDevice.
-
setLogLevel
public static void setLogLevel(@NonNull LogLevel level)
Sets the logging level for messages logged by the Voice SDK.- Parameters:
level
- The logging level
-
setModuleLogLevel
public static void setModuleLogLevel(@NonNull LogModule module, @NonNull LogLevel level)
Sets the logging level for messages logged by a specific module.- Parameters:
module
- The module for this log level.level
- The logging level.
-
enableInsights
public static void enableInsights(boolean enable)
Specify reporting statistics to Insights. Sending stats data to Insights is enabled by default.NOTE: Setting the flag during a call will not be applied to ongoing calls. The flag will be applied to subsequent
connect(Context, String, Call.Listener)
orhandleMessage(Context, Bundle, MessageListener)
API calls.
-
setRegion
@Deprecated public static void setRegion(@NonNull java.lang.String region)
Deprecated.As of release 5.3.0, usesetEdge(String)
instead.Sets the region (Twilio data center) for the SDK. The default region uses Global Low Latency routing, which establishes a connection with the closest region to the user.NOTE: Setting the region during a call will not be applied to ongoing calls. The region will be applied to subsequent
connect(Context, String, Call.Listener)
orhandleMessage(Context, Bundle, MessageListener)
API calls.- Parameters:
region
- The region.
-
setEdge
public static void setEdge(@NonNull java.lang.String edge)
Sets the edge (Twilio data center) for the SDK. The edge value is a Twilio Edge name that corresponds to a geographic location of Twilio infrastructure that the client will connect to. The default value `roaming` automatically selects an edge based on the latency between client and available edges. `roaming` requires the upstream DNS to support [RFC7871](https://tools.ietf.org/html/rfc7871). See [Global Low Latency requirements](https://www.twilio.com/docs/voice/client/javascript/voice-client-js-and-mobile-sdks-network-connectivity-requirements#global-low-latency-requirements) for more information.NOTE: Setting the edge during a call will not be applied to ongoing calls. The edge will be applied to subsequent
connect(Context, String, Call.Listener)
orhandleMessage(Context, Bundle, MessageListener)
API calls. The SDK will throw theIllegalArgumentException
if bothedge
and `region
` values are specified.- Parameters:
edge
- The edge.
-
setAudioDevice
public static void setAudioDevice(@NonNull AudioDevice audioDevice) throws java.lang.UnsupportedOperationException
Sets the custom audio device. TheaudioDevice
can be updated when there is no call in progress and will be applied to subsequentconnect(Context, String, Call.Listener)
orhandleMessage(Context, Bundle,MessageListener)
API calls. Setting theaudioDevice
during a call will result inUnsupportedOperationException
.- Parameters:
audioDevice
- The audio device.- Throws:
java.lang.UnsupportedOperationException
-
-