public abstract class Voice
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Voice.RegistrationChannel |
| Constructor and Description |
|---|
Voice() |
| Modifier and Type | Method and Description |
|---|---|
static Call |
call(android.content.Context context,
java.lang.String accessToken,
java.util.Map<java.lang.String,java.lang.String> twiMLParams,
Call.Listener listener)
Creates a new OutgoingCall.
|
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()
Returns the region set for the Voice SDK.
|
static java.lang.String |
getVersion()
Returns the version of the Voice SDK.
|
static void |
handleMessage(android.content.Context context,
android.os.Bundle data,
MessageListener listener)
Handle messages from GCM
|
static void |
handleMessage(android.content.Context context,
java.util.Map<java.lang.String,java.lang.String> data,
MessageListener listener)
Handle messages from FCM.
|
static void |
register(android.content.Context context,
java.lang.String accessToken,
Voice.RegistrationChannel registrationChannel,
java.lang.String registrationToken,
RegistrationListener listener)
Register for incoming call messages
|
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)
Sets the region (Twilio data center) for the SDK.
|
static void |
unregister(android.content.Context context,
java.lang.String accessToken,
Voice.RegistrationChannel registrationChannel,
java.lang.String registrationToken,
UnregistrationListener listener)
Unregisters with FCM token from receiving further incoming call messages.
|
public static void register(android.content.Context context,
java.lang.String accessToken,
Voice.RegistrationChannel registrationChannel,
java.lang.String registrationToken,
RegistrationListener listener)
context - The application context of your Android application.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.public static void unregister(android.content.Context context,
java.lang.String accessToken,
Voice.RegistrationChannel registrationChannel,
java.lang.String registrationToken,
UnregistrationListener listener)
context - The application context of your Android applicationaccessToken - An access token.registrationChannel - An enumeration of registration channels.registrationToken - An FCM or GCM device token.listener - A listener that receives unregistration request status.public static Call call(android.content.Context context, java.lang.String accessToken, java.util.Map<java.lang.String,java.lang.String> twiMLParams, Call.Listener listener)
A SecurityException will be thrown if RECORD_AUDIO is not granted
context - The application context of your Android application.accessToken - An access token.twiMLParams - An optional Map of parameters that are passed to your TwiML Application.listener - A listener that receives call status.Call objectpublic static void handleMessage(android.content.Context context,
java.util.Map<java.lang.String,java.lang.String> data,
MessageListener listener)
Twilio sends 2 types of notifications messages via GCM/FCM, `call` and `cancel` messages. The message type is encoded in the dictionary with the key `twi_message_type` and the values `twilio.voice.call` and `twilio.voice.cancel`.
A `call` message is sent when someone wants to reach the registered `identity`. Passing a `call` message into `Voice.handleMessage(...)` will always result in a `CallInvite` in the `PENDING` state.
A `cancel` message is sent when a call made to this `identity` is prematurely `disconnected` by the caller, when the call is `rejected`, when the call is `ignored`, or when the call is `accepted` due to an outstanding infrastructure issue. Passing a `cancel` message into `Voice.handleMessage(...)` will result in a callback from `MessageListener.onCallInvite(...)` in the `CANCELED` state for the following scenarios:
Passing a `cancel` message into `Voice.handleMessage(...)` will not result in any callback from `MessageListener` for the following scenarios:
Providing a message that is malformed, that has not been received from Twilio will likely lead to an `MessageListener.onError(MessageException messageException)`.
public static void handleMessage(android.content.Context context,
android.os.Bundle data,
MessageListener listener)
Twilio sends 2 types of notifications messages via GCM/FCM, `call` and `cancel` messages. The message type is encoded in the dictionary with the key `twi_message_type` and the values `twilio.voice.call` and `twilio.voice.cancel`.
A `call` message is sent when someone wants to reach the registered `identity`. Passing a `call` message into `Voice.handleMessage(...)` will always result in a `CallInvite` in the `PENDING` state.
A `cancel` message is sent when a call made to this `identity` is prematurely `disconnected` by the caller, when the call is `rejected`, when the call is `ignored`, or when the call is `accepted` due to an outstanding infrastructure issue. Passing a `cancel` message into `Voice.handleMessage(...)` will result in a callback from `MessageListener.onCallInvite(...)` in the `CANCELED` state for the following scenarios:
Passing a `cancel` message into `Voice.handleMessage(...)` will not result in any callback from `MessageListener` for the following scenarios:
Providing a message that is malformed, that has not been received from Twilio will likely lead to an `MessageListener.onError(MessageException messageException)`.
public static java.lang.String getVersion()
public static LogLevel getLogLevel()
public static LogLevel getModuleLogLevel(LogModule module)
public static void setLogLevel(LogLevel level)
level - The logging levelpublic static void setModuleLogLevel(LogModule module, LogLevel level)
module - The module for this log level.level - The logging level.public static void setRegion(java.lang.String region)
region - The region.public static java.lang.String getRegion()