public interface Connection
extends android.os.Parcelable
Device
and Twilio's services.
A Connection is either incoming or outgoing.
You do not create a Connection directly; an outgoing connection is created by calling the
Device.connect(Map, ConnectionListener)
method. Incoming connections are created
internally by a Device
and handed to the registered incoming
android.content.PendingIntent
registered via
Device.setIncomingIntent(PendingIntent)
.Modifier and Type | Interface and Description |
---|---|
static class |
Connection.State
An enum describing the current state of the Connection.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
IncomingParameterAccountSIDKey
String representing the account id making the incoming call.
|
static java.lang.String |
IncomingParameterAPIVersionKey
String representing the version of the Twilio API used in the server application.
|
static java.lang.String |
IncomingParameterCallSIDKey
String representing a unique identifier for the incoming call.
|
static java.lang.String |
IncomingParameterFromKey
String representing the calling party.
|
static java.lang.String |
IncomingParameterToKey
String representing the client name of the called party.
|
Modifier and Type | Method and Description |
---|---|
void |
accept()
Accepts an incoming connection request.
|
void |
disconnect()
Disconnect the connection.
|
java.util.Map<java.lang.String,java.lang.String> |
getParameters()
Retrieves the set of application parameters associated with this connection.
|
Connection.State |
getState()
Retrieves the current state of the connection.
|
void |
ignore()
Ignores an incoming connection request.
|
boolean |
isIncoming()
A
boolean representing if the Connection is an incoming or outgoing connection. |
boolean |
isMuted()
Reports whether the microphone's audio for the connection is muted.
|
void |
reject()
Rejects an incoming connection request.
|
void |
sendDigits(java.lang.String inDigitsString)
Send a string of digits over the connection.
|
void |
setConnectionListener(ConnectionListener inListener)
Sets the
ConnectionListener to receive connection state events. |
void |
setMuted(boolean muted)
Mutes or unmutes the microphone's audio for the connection.
|
static final java.lang.String IncomingParameterFromKey
static final java.lang.String IncomingParameterToKey
static final java.lang.String IncomingParameterAccountSIDKey
static final java.lang.String IncomingParameterAPIVersionKey
static final java.lang.String IncomingParameterCallSIDKey
Connection.State getState()
Connection.State
enum valueConnection.State
java.util.Map<java.lang.String,java.lang.String> getParameters()
IncomingParameter
.
Outgoing connection parameters are defined by the union of optional application parameters
specified in the Capability Token and any additional parameters specified when the
Device.connect(Map, ConnectionListener)
method is called.Map
of key/value pairs for the Connection, or null
if no parameters were set.boolean isIncoming()
boolean
representing if the Connection is an incoming or outgoing connection.true
if the connection is an incoming connection, false
if outgoingvoid accept()
android.content.PendingIntent
is activated, calling this method will accept the incoming connection.
Calling this method on a Connection that is not in the Connection.State.PENDING
state will have no effect.isIncoming()
void ignore()
android.content.PendingIntent
is activated, calling ignore will close the incoming connection request and the connection may not be accepted.
Calling this method on a Connection that is not in the Connection.State.PENDING
state will have no effect.
The ConnectionListener
will eventually receive a ConnectionListener.onDisconnected(Connection)
callback
once the connection is terminated.isIncoming()
void reject()
android.content.PendingIntent
is activated, calling reject will terminate the request, notifying the caller that the call was rejected.
Calling this method on a Connection that is not in the Connection.State.PENDING
state will have no effect.
The ConnectionListener
will eventually receive a ConnectionListener.onDisconnected(Connection)
callback
once the connection is terminated.isIncoming()
void disconnect()
Connection.State.DISCONNECTED
state will have no effect.
The ConnectionListener
will eventually receive a ConnectionListener.onDisconnected(Connection)
callback
once the connection is terminated.void setMuted(boolean muted)
muted
- true
to mute, false
to unmuteisMuted()
boolean isMuted()
true
if the audio is muted, false otherwise.setMuted(boolean)
void sendDigits(java.lang.String inDigitsString)
Connection.State.CONNECTED
state will have no effect.inDigitsString
- a String of one or more valid digits and optional 'w' chars.void setConnectionListener(ConnectionListener inListener)
ConnectionListener
to receive connection state events.inListener
- The ConnectionListener objectConnectionListener