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 classVoice.RegistrationChannel
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Callconnect(android.content.Context context, ConnectOptions connectOptions, Call.Listener listener)Creates and returns a newCall.static Callconnect(android.content.Context context, java.lang.String accessToken, Call.Listener listener)Creates and returns a newCall.static voidenableInsights(boolean enable)Specify reporting statistics to Insights.static AudioDevicegetAudioDevice()Returns the AudioDevice.static java.lang.StringgetEdge()Returns the edge specified byedge.static LogLevelgetLogLevel()Returns the logging level for messages logged by the Voice SDK.static LogLevelgetModuleLogLevel(LogModule module)Returns the logging level for messages logged by the specified LogModule.static java.lang.StringgetRegion()Deprecated.As of release 5.3.0, usegetEdge()instead.static java.lang.StringgetVersion()Returns the version of the Voice SDK.static booleanhandleMessage(android.content.Context context, android.os.Bundle data, MessageListener listener)Handle messages from GCM.static booleanhandleMessage(android.content.Context context, java.util.Map<java.lang.String,java.lang.String> data, MessageListener listener)Handle messages from FCM.static booleanisInsightsEnabled()Returns if reporting statistics to Insights is enabled.static voidregister(java.lang.String accessToken, Voice.RegistrationChannel registrationChannel, java.lang.String registrationToken, RegistrationListener listener)Register for incoming call messages.static voidsetAudioDevice(AudioDevice audioDevice)Sets the custom audio device.static voidsetEdge(java.lang.String edge)Sets the edge (Twilio data center) for the SDK.static voidsetLogLevel(LogLevel level)Sets the logging level for messages logged by the Voice SDK.static voidsetModuleLogLevel(LogModule module, LogLevel level)Sets the logging level for messages logged by a specific module.static voidsetRegion(java.lang.String region)Deprecated.As of release 5.3.0, usesetEdge(String)instead.static voidunregister(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_TOKEN20101 Twilio was unable to validate your Access Token VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_HEADER20102 Invalid Access Token header VoiceException.EXCEPTION_INVALID_ISSUER_SUBJECT20103 Invalid Access Token issuer or subject VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_EXPIRY20104 Access Token has expired or expiration date is invalid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_NOT_VALID_YET20105 Access Token not yet valid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_GRANT20106 Invalid Access Token grants VoiceException.EXCEPTION_INVALID_TTL20157 Expiration Time in the Access Token Exceeds Maximum Time Allowed VoiceException.EXCEPTION_INVALID_TOKEN20403 Forbidden. The account lacks permission to access the Twilio API VoiceException.EXCEPTION_ACCESS_TOKEN_REJECTED51007 Token authentication is rejected by authentication service RegistrationException.EXCEPTION_REGISTRATION_ERROR31301 Registration failed. Look at RegistrationException.getMessage(...) for details VoiceException.EXCEPTION_BAD_REQUEST31400 Bad Request. The request could not be understood due to malformed syntax VoiceException.EXCEPTION_FORBIDDEN31403 Forbidden. The server understood the request, but is refusing to fulfill it VoiceException.EXCEPTION_NOT_FOUND31404 Not Found. The server has not found anything matching the request VoiceException.EXCEPTION_REQUEST_TIMEOUT31408 Request Timeout. A request timeout occurred RegistrationException.EXCEPTION_CONFLICT31409 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_REQUIRED31426 Upgrade Required. The client should switch to a different protocol RegistrationException.EXCEPTION_TOO_MANY_REQUEST31429 Too Many Requests. Too many requests were sent in a given amount of time VoiceException.EXCEPTION_INTERNAL_SERVER_ERROR31500 Internal Server Error. The server could not fulfill the request due to some unexpected condition VoiceException.EXCEPTION_BAD_GATEWAY31502 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_UNAVAILABLE31503 Service Unavailable. The server is currently unable to handle the request due to a temporary overloading or maintenance of the server VoiceException.EXCEPTION_GATEWAY_TIMEOUT31504 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 :accessTokenmay 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); }To specify a home region where your data is stored, use the `twr` specifier in the access token header as the example below:{ "alg": "HS256", "typ": "JWT", "cty": "twilio-fpa;v=1", "twr": "au1" }
-
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_TOKEN20101 Twilio was unable to validate your Access Token VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_HEADER20102 Invalid Access Token header VoiceException.EXCEPTION_INVALID_ISSUER_SUBJECT20103 Invalid Access Token issuer or subject VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_EXPIRY20104 Access Token has expired or expiration date is invalid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_NOT_VALID_YET20105 Access Token not yet valid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_GRANT20106 Invalid Access Token grants VoiceException.EXCEPTION_INVALID_TTL20157 Expiration Time in the Access Token Exceeds Maximum Time Allowed VoiceException.EXCEPTION_INVALID_TOKEN20403 Forbidden. The account lacks permission to access the Twilio API VoiceException.EXCEPTION_ACCESS_TOKEN_REJECTED51007 Token authentication is rejected by authentication service RegistrationException.EXCEPTION_REGISTRATION_ERROR31301 Registration failed. Look at RegistrationException.getMessage(...) for details VoiceException.EXCEPTION_BAD_REQUEST31400 Bad Request. The request could not be understood due to malformed syntax VoiceException.EXCEPTION_FORBIDDEN31403 Forbidden. The server understood the request, but is refusing to fulfill it VoiceException.EXCEPTION_NOT_FOUND31404 Not Found. The server has not found anything matching the request VoiceException.EXCEPTION_REQUEST_TIMEOUT31408 Request Timeout. A request timeout occurred RegistrationException.EXCEPTION_CONFLICT31409 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_REQUIRED31426 Upgrade Required. The client should switch to a different protocol RegistrationException.EXCEPTION_TOO_MANY_REQUEST31429 Too Many Requests. Too many requests were sent in a given amount of time VoiceException.EXCEPTION_INTERNAL_SERVER_ERROR31500 Internal Server Error. The server could not fulfill the request due to some unexpected condition VoiceException.EXCEPTION_BAD_GATEWAY31502 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_UNAVAILABLE31503 Service Unavailable. The server is currently unable to handle the request due to a temporary overloading or maintenance of the server VoiceException.EXCEPTION_GATEWAY_TIMEOUT31504 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 :accessTokenmay 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);
To specify a home region where your data is stored, use the `twr` specifier in the access token header as the example below:{ "alg": "HS256", "typ": "JWT", "cty": "twilio-fpa;v=1", "twr": "au1" }
-
connect
@NonNull public static Call connect(@NonNull android.content.Context context, @NonNull ConnectOptions connectOptions, @NonNull Call.Listener listener)
Creates and returns a newCall. ASecurityExceptionwill be thrown if RECORD_AUDIO is not granted.Call.Listenerreceives the state of theCall.Call.Listener events Callback Name Description Since version Call.Listener.onConnectFailure(Call, CallException)The call failed to connect. CallExceptionprovides 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
connectfails,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_TOKEN20101 Twilio was unable to validate your Access Token VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_HEADER20102 Invalid Access Token header VoiceException.EXCEPTION_INVALID_ISSUER_SUBJECT20103 Invalid Access Token issuer or subject VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_EXPIRY20104 Access Token has expired or expiration date is invalid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_NOT_VALID_YET20105 Access Token not yet valid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_GRANT20106 Invalid Access Token grants VoiceException.EXCEPTION_AUTH_FAILURE20151 Twilio failed to authenticate the client VoiceException.EXCEPTION_INVALID_TTL20157 Expiration Time in the Access Token Exceeds Maximum Time Allowed VoiceException.EXCEPTION_INVALID_TOKEN20403 Forbidden. The account lacks permission to access the Twilio API CallException.EXCEPTION_INVALID_APPLICATION_SID21218 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.CONNECTINGstate3.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.DISCONNECTED3.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:
To specify a home region where your data is stored, use the `twr` specifier in the access token header as the example below: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"); } } }); }{ "alg": "HS256", "typ": "JWT", "cty": "twilio-fpa;v=1", "twr": "au1" }
-
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. ASecurityExceptionwill be thrown if RECORD_AUDIO is not granted.Call.Listenerreceives the state of theCall.Call.Listener events Callback Name Description Since version Call.Listener.onConnectFailure(Call, CallException)The call failed to connect. CallExceptionprovides 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
connectfails,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_TOKEN20101 Twilio was unable to validate your Access Token VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_HEADER20102 Invalid Access Token header VoiceException.EXCEPTION_INVALID_ISSUER_SUBJECT20103 Invalid Access Token issuer or subject VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_EXPIRY20104 Access Token has expired or expiration date is invalid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_NOT_VALID_YET20105 Access Token not yet valid VoiceException.EXCEPTION_INVALID_ACCESS_TOKEN_GRANT20106 Invalid Access Token grants VoiceException.EXCEPTION_AUTH_FAILURE20151 Twilio failed to authenticate the client VoiceException.EXCEPTION_INVALID_TTL20157 Expiration Time in the Access Token Exceeds Maximum Time Allowed VoiceException.EXCEPTION_INVALID_TOKEN20403 Forbidden. The account lacks permission to access the Twilio API CallException.EXCEPTION_INVALID_APPLICATION_SID21218 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
accessTokenmay 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.CONNECTINGstate3.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.DISCONNECTED3.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:
To specify a home region where your data is stored, use the `twr` specifier in the access token header as the example below: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"); } } }); }{ "alg": "HS256", "typ": "JWT", "cty": "twilio-fpa;v=1", "twr": "au1" }
-
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
callnotification messages via GCM/FCM. The message type is encoded in the dictionary with the keytwi_message_typewith the valuetwilio.voice.call.A
callmessage is sent when someone wants to reach the registeredidentity. Passing acallmessage intohandleMessage(Context, Bundle, MessageListener)will result in aCallInviteraised in theMessageListenerand returntrue.A
CancelledCallInvitewill be raised to the providedMessageListenerfor 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 returnfalseand noMessageListenercallback 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- AMessageListenerto 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
callnotification messages via GCM/FCM. The message type is encoded in the dictionary with the keytwi_message_typewith the valuetwilio.voice.call.A
callmessage is sent when someone wants to reach the registeredidentity. Passing acallmessage intohandleMessage(Context, Bundle, MessageListener)will result in aCallInviteraised in theMessageListenerand returntrue.A
CancelledCallInvitewill be raised to the providedMessageListenerfor 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 returnfalseand noMessageListenercallback 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- AMessageListenerto 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 inenableInsightsand 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 theIllegalArgumentExceptionif bothedgeand `region` values are specified.- Parameters:
edge- The edge.
-
setAudioDevice
public static void setAudioDevice(@NonNull AudioDevice audioDevice) throws java.lang.UnsupportedOperationExceptionSets the custom audio device. TheaudioDevicecan 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 theaudioDeviceduring a call will result inUnsupportedOperationException.- Parameters:
audioDevice- The audio device.- Throws:
java.lang.UnsupportedOperationException
-
-