> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# SWML inbound call webhook

POST 

Payload sent by SignalWire to a SWML calling webhook URL when SWML is fetched for a call. This includes inbound calls arriving on a phone number configured with a SWML calling handler, and outbound REST-initiated calls that point at a SWML URL. The same payload shape is also used when the SWML calling `transfer` or `execute` method targets an external URL — in those cases, the `params` object carries the values supplied to that step.

The webhook URL is expected to respond with the SWML document to execute for the call.

Reference: https://signalwire.com/docs/apis/rest/webhooks/inbound-call-webhook

## Request

### Payload

- `call` (object, required) — The call that triggered this fetch.
  - `call_id` (string, required) — A unique identifier for the call.
  - `node_id` (string, required) — A unique identifier for the node handling the call.
  - `segment_id` (string, required) — A unique identifier for the current call segment.
  - `call_state` (string, required) — The current state of the call.
  - `direction` (enum, required) — The direction of the call.
    - Allowed values: `inbound`, `outbound`
  - `type` (enum, required) — The type of call.
    - Allowed values: `sip`, `phone`, `webrtc`
  - `from` (string, required) — The number/URI that initiated this call.
  - `to` (string, required) — The number/URI of the destination of this call.
  - `headers` (list of object, required) — The headers associated with this call.
    - `name` (string, required) — The name of the header.
    - `value` (string, required) — The value of the header.
  - `project_id` (string, required) — The Project ID this call belongs to.
  - `space_id` (string, required) — The Space ID this call belongs to.
  - `tag` (string, optional) — The tag you assigned to this call when it was created, if any.
  - `from_number` (string, optional) — The phone number that initiated this call. Present for phone calls (`type` is `phone`); SIP and WebRTC calls expose the originator through `from` instead.
  - `to_number` (string, optional) — The destination phone number of this call. Present for phone calls (`type` is `phone`); SIP and WebRTC calls expose the destination through `to` instead.
  - `dial_winner` (enum, optional) — Set to `"true"` when this call won a parallel dial. Omitted otherwise.
    - Allowed values: `true`
  - `parent` (object, optional) — The call that created this call. Present only when this call has a parent.
    - `device_type` (enum, required) — The device type of the parent call.
      - Allowed values: `sip`, `phone`, `webrtc`
    - `call_id` (string, required) — A unique identifier for the parent call.
    - `node_id` (string, required) — A unique identifier for the node handling the parent call.
  - `peer` (object, optional) — The call this call is bridged to. Present only when this call has a peer.
    - `call_id` (string, required) — A unique identifier for the peer call.
    - `node_id` (string, required) — A unique identifier for the node handling the peer call.
  - `sip_data` (object, optional) — SIP-specific data. Present only when `type` is `sip`.
    - `sip_req_host` (string, required) — The host portion of the SIP request URI.
    - `sip_req_uri` (string, required) — The full SIP request URI.
    - `sip_req_user` (string, required) — The user portion of the SIP request URI.
    - `sip_from_host` (string, required) — The host portion of the SIP From header.
    - `sip_from_uri` (string, required) — The full URI from the SIP From header.
    - `sip_from_user` (string, required) — The user portion of the SIP From header.
    - `sip_to_host` (string, required) — The host portion of the SIP To header.
    - `sip_to_uri` (string, required) — The full URI from the SIP To header.
    - `sip_to_user` (string, required) — The user portion of the SIP To header.
    - `sip_contact_user` (string, required) — The user portion of the SIP Contact header.
    - `sip_contact_port` (string, required) — The port from the SIP Contact header.
    - `sip_contact_uri` (string, required) — The full URI from the SIP Contact header.
    - `sip_contact_host` (string, required) — The host portion of the SIP Contact header.
    - `sip_contact_params` (object, required) — Additional parameters from the SIP Contact header.
- `vars` (object, required) — Script-scope variables for this call session. Empty on the initial document fetch.
- `envs` (object, required) — Environment variables available to this call's SWML document, which you can reference as `${envs.<key>}`. Combines the variables you've configured at the account or project level with any `custom_variables` you passed on the outbound [Call commands](/docs/apis/rest/calls/call-commands) request. Keys are case-sensitive. When a `custom_variables` key exactly matches an account- or project-level variable, including case, the value from the request wins; if they differ only in case, both are kept as separate variables.
- `params` (object, required) — Parameters passed via a SWML calling `execute` or `transfer` step. An empty object on the initial document fetch.