If a handler is passed to call-related actions, that handler is called whenever the state of the call changes.
The handler is called with one argument, a call status object with the following fields:
- state - SIP state of the call. One of
"CALLING", "INCOMING", "EARLY", "CONNECTING", "CONFIRMED", "DISCONNECTING", "DISCONNCTD".
- accountSlot - Identifier for the line the call is coming in on.
- callHandle - Identifier for the call. This will match the call handle returned by digium.phone.dial, for example.
- remoteInfo - SIP url for the remote end of the call.
- remoteContact - SIP contact header for the remote end of the call.
- lastStatus - Most recent SIP status code associated with the call, or "0".
- lastStatusText - Most recent text associated with status code.
- mediaStatus - Describes the current audio data flow.
One of "none", "active", "local_hold", "remote_hold", or "error".
- headers - Object mapping SIP headers to their values.
However, if there's an api-level error (e.g., the callHandle is invalid, you are trying to make a call when there's already an active call, etc.), these are available instead:
- state - Has the value "ERROR".
- callHandle - Identifier for the call.
- errorText - Human readable error message (not for display to end users).