CallState
Payload for call state events that are triggered by the change in state of an active RELAY-controlled call.
Obtain instances of this state Callback request by including a call_state_url parameter when starting a call with one of the following methods:
Parameters
event_type
The value will be "calling.call.state".
event_channel
ID for the event channel on which these room session’s events are reported.
timestamp
Time of the event.
space_id
ID for the SignalWire Space associated with the call.
project_id
ID for the project associated with the call.
params
Event-specific parameters. This object contains the following fields.
node_id
ID for the node this call is on.
call_id
ID for the call.
tag
Client data this call is tagged with.
device
Protocol-specific connection information including the device type, from_number, and to_number.
parent
Information on the call that created this call including the parent device_type, node_id, and call_id.
peer
Information on the peer call this call is actively connected with including the peer node_id and call_id.
call_state
The current state that triggered this event. Possible values are "created", "ringing", "answered", "ending", and "ended".
start_time
The start time of the call in milliseconds since epoch.
answer_time
The time the call was answered in milliseconds since epoch.
end_time
The time the call ended in milliseconds since epoch.
created_by
The method associated with this call state change. Possible values are "dial", "connect", and "receive".
Example
To receive call state webhook notifications, specify a callStateUrl when building your device configuration with Voice.DeviceBuilder.Phone:
Your webhook endpoint will receive POST requests with the CallState payload. Example Express.js handler:
For real-time call state changes within your SDK application without webhooks, use the onStateChanged event on the Call object instead.