> This page is for APIs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# call.state

GET /

Receive Call Fabric call-state changes

Reference: https://signalwire.com/docs/apis/relay/client/fabric/call-state

## AsyncAPI Specification

```yaml
asyncapi: 2.6.0
info:
  title: call.state
  version: subpackage_callState.call.state
  description: Receive Call Fabric call-state changes
channels:
  /:
    description: Receive Call Fabric call-state changes
    publish:
      operationId: subpackage_callState.call.state-publish
      summary: call.state
      message:
        name: onCallStateCallStateEvent
        title: call.state
        payload:
          $ref: '#/components/schemas/call.state_callStateEvent'
servers:
  production:
    url: wss://relay.signalwire.com/
    protocol: wss
    x-default: true
components:
  schemas:
    ChannelsCallStateMessagesCallStateEventJsonrpc:
      type: string
      enum:
        - '2.0'
      description: JSON-RPC version. Always `2.0`.
      title: ChannelsCallStateMessagesCallStateEventJsonrpc
    ChannelsCallStateMessagesCallStateEventMethod:
      type: string
      enum:
        - signalwire.event
      description: Always `signalwire.event`.
      title: ChannelsCallStateMessagesCallStateEventMethod
    ChannelsCallStateMessagesCallStateEventParamsEventType:
      type: string
      enum:
        - call.state
      description: The event type — identifies which event this is.
      title: ChannelsCallStateMessagesCallStateEventParamsEventType
    Fabric.FabricCallState:
      type: string
      enum:
        - created
        - ringing
        - answered
        - ending
        - ended
      title: Fabric.FabricCallState
    FabricCallStateParamsEndSource:
      type: string
      enum:
        - inbound
        - outbound
        - none
      description: >-
        Which side ended the call: `inbound`, `outbound`, or `none` when it
        could not be determined. Present together with `end_reason`.
      title: FabricCallStateParamsEndSource
    FabricCallStateParamsDialWinner:
      type: string
      enum:
        - 'true'
      description: >-
        Set to the string `"true"` on the call leg that won a dial race. Absent
        otherwise. Note the value is the string `"true"`, not a JSON boolean.
      title: FabricCallStateParamsDialWinner
    Fabric.FabricCallDevice:
      type: object
      properties:
        type:
          type: string
          description: The device type, such as `phone`, `sip`, or `webrtc`.
        params:
          type: object
          additionalProperties:
            description: Any type
          description: Device-specific parameters.
      required:
        - type
      description: The device handling a Call Fabric call leg.
      title: Fabric.FabricCallDevice
    Fabric.FabricPeerRef:
      type: object
      properties:
        call_id:
          type: string
          description: The peer call's `call_id`.
        node_id:
          type: string
          description: The node the peer call leg lives on.
      description: The call this leg is directly connected to.
      title: Fabric.FabricPeerRef
    Fabric.FabricParentRef:
      type: object
      properties:
        device_type:
          type: string
          description: The parent's device type, such as `sip`.
        call_id:
          type: string
          description: The parent call's `call_id`.
        node_id:
          type: string
          description: The node the parent call leg lives on.
      description: The call that created this one.
      title: Fabric.FabricParentRef
    Fabric.FabricSipData:
      type: object
      properties:
        sip_req_user:
          type: string
          description: User part of the SIP Request-URI.
        sip_req_uri:
          type: string
          description: The SIP Request-URI.
        sip_req_host:
          type: string
          description: Host part of the SIP Request-URI.
        sip_from_user:
          type: string
          description: User part of the SIP `From` header.
        sip_from_uri:
          type: string
          description: The SIP `From` URI.
        sip_from_host:
          type: string
          description: Host part of the SIP `From` header.
        sip_to_user:
          type: string
          description: User part of the SIP `To` header.
        sip_to_uri:
          type: string
          description: The SIP `To` URI.
        sip_to_host:
          type: string
          description: Host part of the SIP `To` header.
        sip_contact_user:
          type: string
          description: User part of the SIP `Contact` header.
        sip_contact_port:
          type: string
          description: Port of the SIP `Contact` header.
        sip_contact_uri:
          type: string
          description: The SIP `Contact` URI.
        sip_contact_host:
          type: string
          description: Host part of the SIP `Contact` header.
        sip_from_params:
          type: object
          additionalProperties:
            type: string
          description: URI parameters of the `From` header, as name/value pairs.
        sip_to_params:
          type: object
          additionalProperties:
            type: string
          description: URI parameters of the `To` header, as name/value pairs.
        sip_contact_params:
          type: object
          additionalProperties:
            type: string
          description: URI parameters of the `Contact` header, as name/value pairs.
        sip_req_params:
          type: object
          additionalProperties:
            type: string
          description: URI parameters of the Request-URI, as name/value pairs.
        sip_p_asserted_identity:
          type: string
          description: The raw `P-Asserted-Identity` header.
      description: >-
        SIP signaling details for a SIP call leg. Each field is present only
        when the call carried it.
      title: Fabric.FabricSipData
    Fabric.CallStateParams:
      type: object
      properties:
        call_id:
          type: string
          description: The call this event is about.
        node_id:
          type: string
          description: The node the call leg lives on.
        room_session_id:
          type: string
          description: >-
            The room session this call leg belongs to. In a 1:1 call this is the
            call ID.
        segment_id:
          type: string
          description: >-
            Identifier of the call segment this event belongs to, for
            correlating events within the same segment.
        tag:
          type: string
          description: >-
            The `tag` the leg was dialed with, when a server-side application
            set one on the dial. Absent otherwise.
        call_state:
          $ref: '#/components/schemas/Fabric.FabricCallState'
          description: The state the call has just moved into.
        direction:
          type: string
          description: Whether the call is inbound or outbound.
        start_time:
          type: integer
          format: int64
          description: >-
            When the call started, as a Unix timestamp in milliseconds. `0`
            until known.
        answer_time:
          type: integer
          format: int64
          description: >-
            When the call was answered, as a Unix timestamp in milliseconds. `0`
            until the call is answered.
        end_time:
          type: integer
          format: int64
          description: >-
            When the call ended, as a Unix timestamp in milliseconds. `0` until
            the call ends.
        end_reason:
          type: string
          description: >-
            Why the call ended: one of `hangup`, `cancel`, `busy`, `decline`,
            `noAnswer`, `error`, `abandoned`, `maxDuration`, or `notFound`.
            Present once an end reason is known.
        end_source:
          $ref: '#/components/schemas/FabricCallStateParamsEndSource'
          description: >-
            Which side ended the call: `inbound`, `outbound`, or `none` when it
            could not be determined. Present together with `end_reason`.
        dial_winner:
          $ref: '#/components/schemas/FabricCallStateParamsDialWinner'
          description: >-
            Set to the string `"true"` on the call leg that won a dial race.
            Absent otherwise. Note the value is the string `"true"`, not a JSON
            boolean.
        audio_in_mos:
          type: number
          format: double
          description: >-
            Inbound-audio Mean Opinion Score (voice quality), as a decimal such
            as `4.42`. Present when RTP quality stats are available.
        device:
          $ref: '#/components/schemas/Fabric.FabricCallDevice'
          description: The device handling this call leg.
        peer:
          $ref: '#/components/schemas/Fabric.FabricPeerRef'
          description: Present when this leg is directly connected to another call.
        parent:
          $ref: '#/components/schemas/Fabric.FabricParentRef'
          description: Present when this call was created by another call.
        sip_data:
          $ref: '#/components/schemas/Fabric.FabricSipData'
          description: SIP signaling details. Present on SIP call legs.
        address_id:
          type: string
          description: >-
            The Resource address the call is associated with. Present on
            subscriber call legs.
        subscriber_id:
          type: string
          description: The subscriber the call belongs to. Present on subscriber call legs.
        subscriber_name:
          type: string
          description: >-
            The subscriber's display name. Present on subscriber call legs when
            set.
      required:
        - call_id
        - node_id
        - room_session_id
        - call_state
        - direction
        - start_time
        - answer_time
        - end_time
        - device
      description: >-
        Payload of the Call Fabric `call.state` event: a call leg's address,
        state, timing, and connection detail.
      title: Fabric.CallStateParams
    ChannelsCallStateMessagesCallStateEventParams:
      type: object
      properties:
        event_type:
          $ref: >-
            #/components/schemas/ChannelsCallStateMessagesCallStateEventParamsEventType
          description: The event type — identifies which event this is.
        event_channel:
          type: string
          description: >-
            The channel the event was delivered on — for Calling events, the
            `protocol`

            string your connection received from `signalwire.connect`.
        timestamp:
          type: number
          format: double
          description: >-
            When the event was emitted, as a Unix timestamp in seconds. Always
            present.
        project_id:
          type: string
          description: >-
            Your project ID. Present on Calling events and most Call Fabric
            events; absent on `call.joined`, `call.left`, `member.joined`, and
            `member.left`.
        space_id:
          type: string
          description: >-
            Your space ID. Present on Calling events and most Call Fabric
            events; absent on `call.joined`, `call.left`, `member.joined`, and
            `member.left`.
        params:
          $ref: '#/components/schemas/Fabric.CallStateParams'
          description: The event-specific payload.
      required:
        - event_type
        - event_channel
        - timestamp
        - params
      description: The event envelope.
      title: ChannelsCallStateMessagesCallStateEventParams
    call.state_callStateEvent:
      type: object
      properties:
        jsonrpc:
          $ref: '#/components/schemas/ChannelsCallStateMessagesCallStateEventJsonrpc'
          description: JSON-RPC version. Always `2.0`.
        id:
          type: string
          description: >-
            Event id — a unique UUID generated for each event. Events are
            notifications: you do not reply to them.
        method:
          $ref: '#/components/schemas/ChannelsCallStateMessagesCallStateEventMethod'
          description: Always `signalwire.event`.
        params:
          $ref: '#/components/schemas/ChannelsCallStateMessagesCallStateEventParams'
          description: The event envelope.
      required:
        - jsonrpc
        - id
        - method
        - params
      description: >-
        Fires every time a Call Fabric call leg changes state — created,
        ringing, answered,

        ending, ended. Track the call through its lifecycle with `call_state`. A
        leg that a

        server-side application dialed with a `tag` carries it here too.
      title: call.state_callStateEvent

```