Events

onTwilioInitialization

Called after twilio.initialize() has resolved.

Properties

event.name

String. "twilioEvent"

event.type

String. "onTwilioInitialization"

event.isError

Boolean. Value indicating whether an error occurred.

event.error

String. If event.isError is true, this is a string value stating the reason.

onCreateDeviceError

Called if there is an error after twilio.createDevice() is called.

Properties

event.name

String. "twilioEvent"

event.type

String. "onCreateDeviceError"

event.isError

Boolean. Value indicating whether an error occurred.

event.error

String. If event.isError is true, this is a string value stating the reason.

onStartListening

Called when the Device has started listening for incoming connections.

Properties

event.name

String. "twilioEvent"

event.type

String. "onStartListening"

onStopListening

Called when the Device has stopped listening for incoming connections.

Properties

event.name

String. "twilioEvent"

event.type

String. "onStopListening"

event.isError

Boolean. Value indicating whether an error occurred.

event.error

String. If event.isError is true, this is a string value stating the reason.

event.errorCode

Number. If event.isError is true, this is the error code that pinpoints the reason. For a list of error codes and their meanings, see Twilio Errors.

onPresenceChanged

Called when the presence status for one or more other clients has changed.

When the device is ready, it is invoked as clients become available or unavailable.

A client is considered available even if another call is in progress.

When your client disconnects the onStopListening event will be invoked, and when the device reconnects this method will be called again for every available online client.

Properties

event.name

String. "twilioEvent"

event.type

String. "onPresenceChanged"

event.clientName

String. The client name for which the event applies.

event.isAvailable

Boolean. Whether or not the client specified by name is currently connected to Twilio services for the account.

onConnecting

Called for a newly-created Connection when it is connecting to your Twilio application.

When this occurs, Connection is in the CONNECTING state.

Properties

event.name

String. "twilioEvent"

event.type

String. "onConnecting"

onConnected

Called after the Connection has successfully connected to your Twilio application.

Note that this does not necessarily mean your application has executed successfully; it only indicates that the connection has been established.

When this occurs the Connection will be in the CONNECTED state.

Properties

event.name

String. "twilioEvent"

event.type

String. "onConnected"

onDisconnected

Called after the Connection has been disconnected, ignored, or rejected by either party or when an error occurs.

After this callback has been called, it is safe to assume that the connection is no longer connected.

When this occurs the Connection will be in the DISCONNECTED state.

Properties

event.name

String. "twilioEvent"

event.type

String. "Properties"

event.isError

Boolean. Value indicating whether an error occurred.

event.error

String. If event.isError is true, this is a string value stating the reason.

event.errorCode

Number. If event.isError is true, this is the error code that pinpoints the reason. For a list of error codes and their meanings, see Twilio Errors.

onIncomingConnection

Properties

event.name

String. "twilioEvent"

event.type

String. "onIncomingConnection"

event.params

Table. Table indicating the connection parameters of an incoming connection.