public static interface Call.Listener
Call.Listener
callback sequences can occur when making or accepting a Call
:
onConnectFailure(Call, CallException)
This callback sequence occurs when the accessToken provided to make a call is invalid,
a connection error occurs attempting to establish a connection with Twilio, or the data provided
by the CallInvite
is no longer valid.
Sequence: onRinging(Call)
, onConnected(Call)
, onDisconnected(Call, CallException)
This callback sequence occurs when a Call
is successful and eventually is disconnected by the callee, caller, or Twilio due to an error.
Sequence: onRinging(Call)
, onDisconnected(Call, CallException)
This callback sequence occurs when a Call
is disconnected after ringing by the callee, caller, or Twilio due to an error.
Sequence: onDisconnected(Call, CallException)
This callback sequence occurs when a Call
is disconnected by the callee.
Modifier and Type | Method and Description |
---|---|
void |
onConnected(Call call)
The call has connected.
|
void |
onConnectFailure(Call call,
CallException callException)
The call failed to connect.
|
void |
onDisconnected(Call call,
CallException callException)
The call was disconnected.
|
void |
onRinging(Call call)
Emitted once before the
onConnected(Call) callback when the callee is being alerted of a Call . |
void onConnectFailure(Call call, CallException callException)
Calls that fail to connect will result in onConnectFailure(Call, CallException)
and always return a CallException
providing more information about what failure occurred.
call
- An object model representing a call that failed to connect.callException
- CallException that describes why the connect failed.void onRinging(Call call)
onConnected(Call)
callback when the callee is being alerted of a Call
.
The behavior of this callback is determined by the 'answerOnBridge' flag provided in the 'Dial' verb of your
TwiML application associated with this client. If the 'answerOnBridge' flag is 'false', which is the default,
the 'onConnected' callback will be emitted immediately after 'onRinging'. If the 'answerOnBridge' flag is 'true'
this will cause the call to emit the 'onConnected' callback only until the call is answered.
See https://www.twilio.com/docs/voice/twiml/dial#answeronbridge for more details on how to use it with the 'Dial' TwiML verb.
If the twiML response contains a 'Say' verb, then the call will emit the onConnected callback immediately
after onRinging is raised, irrespective of the value of 'answerOnBridge' being set to 'true' or 'false'
The Call.getSid()
is now available.call
- An object model representing a call that failed to connect.void onConnected(Call call)
call
- An object model representing a call.void onDisconnected(Call call, CallException callException)
A call can be disconnected for the following reasons:
If the call ends due to an error the `CallException` is non-null. If the call ends normally `CallException` is null.
call
- An object model representing a call.callException
- CallException that caused the call to disconnect.3.0.0-beta3