> 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.

# calling.collect

GET /

Collect digits and/or speech from a call

Reference: https://signalwire.com/docs/apis/relay/server/calling/calling-collect

## AsyncAPI Specification

```yaml
asyncapi: 2.6.0
info:
  title: calling.collect
  version: subpackage_callingCollect.calling.collect
  description: Collect digits and/or speech from a call
channels:
  /:
    description: Collect digits and/or speech from a call
    publish:
      operationId: subpackage_callingCollect.calling.collect-publish
      summary: Server messages
      message:
        oneOf:
          - $ref: >-
              #/components/messages/subpackage_callingCollect.calling.collect-server-0-onCallingCollectCallCollectEvent
          - $ref: >-
              #/components/messages/subpackage_callingCollect.calling.collect-server-1-onCallingCollectResponse
    subscribe:
      operationId: subpackage_callingCollect.calling.collect-subscribe
      summary: calling.collect
      message:
        name: callingCollect
        title: calling.collect
        payload:
          $ref: '#/components/schemas/calling.collect_callingCollectRequest'
servers:
  production:
    url: wss://relay.signalwire.com/
    protocol: wss
    x-default: true
components:
  messages:
    subpackage_callingCollect.calling.collect-server-0-onCallingCollectCallCollectEvent:
      name: onCallingCollectCallCollectEvent
      title: calling.call.collect
      payload:
        $ref: '#/components/schemas/calling.collect_callCollectEvent'
    subpackage_callingCollect.calling.collect-server-1-onCallingCollectResponse:
      name: onCallingCollectResponse
      title: calling.collect response
      payload:
        $ref: '#/components/schemas/calling.collect_callingCollectResponse'
  schemas:
    ChannelsCallingCollectMessagesCallCollectEventJsonrpc:
      type: string
      enum:
        - '2.0'
      description: JSON-RPC version. Always `2.0`.
      title: ChannelsCallingCollectMessagesCallCollectEventJsonrpc
    ChannelsCallingCollectMessagesCallCollectEventMethod:
      type: string
      enum:
        - signalwire.event
      description: Always `signalwire.event`.
      title: ChannelsCallingCollectMessagesCallCollectEventMethod
    ChannelsCallingCollectMessagesCallCollectEventParamsEventType:
      type: string
      enum:
        - calling.call.collect
      description: The event type — identifies which event this is.
      title: ChannelsCallingCollectMessagesCallCollectEventParamsEventType
    Calling.CallCollectState:
      type: string
      enum:
        - collecting
        - error
        - finished
      title: Calling.CallCollectState
    CallingCallCollectResultType:
      type: string
      enum:
        - digit
        - error
        - finished
        - no_input
        - no_match
        - speech
        - start_of_input
      title: CallingCallCollectResultType
    Calling.CallCollectResult:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CallingCallCollectResultType'
      required:
        - type
      description: >-
        What the caller gave you. Read `type` to know which kind of result this
        is. The

        `error`, `no_input`, `no_match`, `start_of_input`, and `finished` types
        are markers

        with no extra data, while `digit` and `speech` include a `params` object
        with the

        collected input.
      title: Calling.CallCollectResult
    Calling.CallCollectParams:
      type: object
      properties:
        node_id:
          type: string
          description: >-
            Opaque identifier that, paired with `call_id`, addresses this call.
            Echo back the value you received; treat it as opaque.
        call_id:
          type: string
          description: Unique identifier of the call.
        control_id:
          type: string
          description: >-
            The `control_id` of the collection this event refers to, returned
            when you started it with `calling.collect`.
        state:
          $ref: '#/components/schemas/Calling.CallCollectState'
          description: >-
            Where the collection currently stands. `error` means it stopped
            because something went wrong. Present only when the collect was
            started with `continuous: true`; otherwise the event reports its
            `result` without a `state`.
        result:
          $ref: '#/components/schemas/Calling.CallCollectResult'
          description: >-
            What the caller gave you. Check its `type` to handle digits, speech,
            or a no-input/no-match marker.
        final:
          type: boolean
          description: >-
            Relevant when you requested partial or continuous results: `true`
            once the

            recognizer has finished the current utterance. With `continuous:
            true`, the

            collector then restarts to listen for the next one.
      required:
        - node_id
        - call_id
        - control_id
        - result
      title: Calling.CallCollectParams
    ChannelsCallingCollectMessagesCallCollectEventParams:
      type: object
      properties:
        event_type:
          $ref: >-
            #/components/schemas/ChannelsCallingCollectMessagesCallCollectEventParamsEventType
          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/Calling.CallCollectParams'
          description: The event-specific payload.
      required:
        - event_type
        - event_channel
        - timestamp
        - params
      description: The event envelope.
      title: ChannelsCallingCollectMessagesCallCollectEventParams
    calling.collect_callCollectEvent:
      type: object
      properties:
        jsonrpc:
          $ref: >-
            #/components/schemas/ChannelsCallingCollectMessagesCallCollectEventJsonrpc
          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/ChannelsCallingCollectMessagesCallCollectEventMethod
          description: Always `signalwire.event`.
        params:
          $ref: >-
            #/components/schemas/ChannelsCallingCollectMessagesCallCollectEventParams
          description: The event envelope.
      required:
        - jsonrpc
        - id
        - method
        - params
      description: >-
        Fires as you collect input from a caller — DTMF digits or speech —
        reporting partial and final results so you can react to what they said
        or pressed.
      title: calling.collect_callCollectEvent
    ChannelsCallingCollectMessagesCallingCollectResponseJsonrpc:
      type: string
      enum:
        - '2.0'
      description: JSON-RPC version. Always `2.0`.
      title: ChannelsCallingCollectMessagesCallingCollectResponseJsonrpc
    Calling.CollectResult:
      type: object
      properties:
        code:
          type: string
          description: >-
            Result code as a string. `"200"` means success. Failures use an
            HTTP-style code

            such as `"400"` (bad request), `"403"`, `"404"` (call not found),
            `"405"`, `"409"`

            (conflict, for example another operation is still running), `"410"`
            (call gone),

            or `"500"`. If the call could not be reached in time, `code` is a
            lowercase error

            identifier instead, such as `response_timeout`, `not_available`, or

            `internal_error`.
        message:
          type: string
          description: >-
            Human-readable description of the result. On failure, it explains
            what went wrong. Always check `code`; `message` may be omitted when
            there is nothing extra to report.
        call_id:
          type: string
          description: The call this result is for, echoed from your request.
        control_id:
          type: string
          description: >-
            Your control identifier for the started action, echoed from your
            request.
      required:
        - code
      title: Calling.CollectResult
    JsonRpcErrorCode0:
      type: string
      enum:
        - '-32000'
      title: JsonRpcErrorCode0
    JsonRpcErrorCode1:
      type: string
      enum:
        - '-32001'
      title: JsonRpcErrorCode1
    JsonRpcErrorCode2:
      type: string
      enum:
        - '-32002'
      title: JsonRpcErrorCode2
    JsonRpcErrorCode3:
      type: string
      enum:
        - '-32003'
      title: JsonRpcErrorCode3
    JsonRpcErrorCode4:
      type: string
      enum:
        - '-32004'
      title: JsonRpcErrorCode4
    JsonRpcErrorCode5:
      type: string
      enum:
        - '-32005'
      title: JsonRpcErrorCode5
    JsonRpcErrorCode6:
      type: string
      enum:
        - '-32600'
      title: JsonRpcErrorCode6
    JsonRpcErrorCode7:
      type: string
      enum:
        - '-32601'
      title: JsonRpcErrorCode7
    JsonRpcErrorCode8:
      type: string
      enum:
        - '-32602'
      title: JsonRpcErrorCode8
    JsonRpcErrorCode9:
      type: string
      enum:
        - '-32603'
      title: JsonRpcErrorCode9
    JsonRpcErrorCode10:
      type: string
      enum:
        - '-32700'
      title: JsonRpcErrorCode10
    JsonRpcErrorCode:
      oneOf:
        - $ref: '#/components/schemas/JsonRpcErrorCode0'
        - $ref: '#/components/schemas/JsonRpcErrorCode1'
        - $ref: '#/components/schemas/JsonRpcErrorCode2'
        - $ref: '#/components/schemas/JsonRpcErrorCode3'
        - $ref: '#/components/schemas/JsonRpcErrorCode4'
        - $ref: '#/components/schemas/JsonRpcErrorCode5'
        - $ref: '#/components/schemas/JsonRpcErrorCode6'
        - $ref: '#/components/schemas/JsonRpcErrorCode7'
        - $ref: '#/components/schemas/JsonRpcErrorCode8'
        - $ref: '#/components/schemas/JsonRpcErrorCode9'
        - $ref: '#/components/schemas/JsonRpcErrorCode10'
      title: JsonRpcErrorCode
    JsonRpcError:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/JsonRpcErrorCode'
          description: >-
            The error code — a negative integer identifying the failure. See
            `JsonRpcErrorCode` for the full list of values and meanings.
        message:
          type: string
          description: A human-readable description of what went wrong.
        original_request:
          type: object
          additionalProperties:
            description: Any type
          description: >-
            An echo of the request that failed — the full JSON-RPC frame you
            sent

            (`jsonrpc`, `id`, `method`, `params`). Always present.
        requester_nodeid:
          type: string
          description: >-
            The node that sent the failed request. Present only on some routing
            errors.
        requester_identity:
          type: string
          description: >-
            The identity of the requester. Present only on some routing errors;
            same value as `requester_nodeid`.
        responder_nodeid:
          type: string
          description: >-
            The node that was handling the request. Present only on some routing
            errors.
        responder_identity:
          type: string
          description: >-
            The identity of the responder. Present only on some routing errors;
            same value as `responder_nodeid`.
        last_hop_timeout:
          type: boolean
          description: >-
            `true` when the request timed out on its final hop inside
            SignalWire. Present only on some timeout errors.
      required:
        - code
        - message
        - original_request
      description: >-
        A JSON-RPC 2.0 error object, delivered on the `error` field of a
        `JsonRpcResponse` when

        a request fails at the protocol level (bad version, authentication,
        scope, params, or

        your project's connection limit). It replaces `result` — a frame carries
        one or the other, never both.
      title: JsonRpcError
    calling.collect_callingCollectResponse:
      type: object
      properties:
        jsonrpc:
          $ref: >-
            #/components/schemas/ChannelsCallingCollectMessagesCallingCollectResponseJsonrpc
          description: JSON-RPC version. Always `2.0`.
        id:
          type: string
          description: The id of the request this responds to.
        result:
          $ref: '#/components/schemas/Calling.CollectResult'
          description: The method result. Present when the request succeeded.
        error:
          $ref: '#/components/schemas/JsonRpcError'
          description: >-
            Present instead of `result` when the request failed at the protocol
            level.
      required:
        - jsonrpc
        - id
      description: >-
        A JSON-RPC response frame correlated to a request by `id`. On success
        the frame carries

        `result` (the method result). If the request fails at the protocol level
        — an

        incompatible version, failed authentication, insufficient scope, invalid
        params, or your

        project's connection limit — the frame carries `error` instead of
        `result`. Many

        method-level failures (for example most Calling failures) are reported
        the other way: a

        normal `result` whose own `code` is not `"200"`. Each method documents
        which form its

        failures take.


        An `error` returned for `signalwire.connect` is followed by the service
        closing the

        WebSocket; open a new connection to try again. The same happens when

        `signalwire.reauthenticate` sends credentials that are rejected, except
        for a

        Subscriber Access Token. Errors on any other request leave the
        connection open.
      title: calling.collect_callingCollectResponse
    ChannelsCallingCollectMessagesCallingCollectRequestJsonrpc:
      type: string
      enum:
        - '2.0'
      description: JSON-RPC version. Always `2.0`.
      title: ChannelsCallingCollectMessagesCallingCollectRequestJsonrpc
    ChannelsCallingCollectMessagesCallingCollectRequestMethod:
      type: string
      enum:
        - calling.collect
      description: The name of the JSON-RPC method being invoked.
      title: ChannelsCallingCollectMessagesCallingCollectRequestMethod
    Calling.CollectDigits:
      type: object
      properties:
        max:
          type: integer
          minimum: 1
          description: >-
            Maximum number of digits to collect before collection finishes. Must
            be a positive integer.
        terminators:
          type: string
          description: >-
            Keys that end collection early when pressed, such as `"#*"`. Not set
            by default.
        digit_timeout:
          type: number
          format: double
          minimum: 1
          default: 5
          description: >-
            How long to wait, in seconds, for the next key press after one is
            received

            before giving up. Must be at least `1`. Defaults to `5.0`.
      required:
        - max
      description: >-
        Settings that control how the caller's DTMF (touch-tone) key presses are
        collected.
      title: Calling.CollectDigits
    Calling.CollectSpeech:
      type: object
      properties:
        end_silence_timeout:
          type: number
          format: double
          minimum: 1
          default: 0.5
          description: >-
            How much silence, in seconds, to wait for before treating the caller
            as

            finished speaking. Defaults to `0.5`. A value you send must be at
            least `1`,

            so leave it unset to keep the sub-second default.
        speech_timeout:
          type: number
          format: double
          minimum: 1
          default: 60
          description: >-
            Maximum time, in seconds, to spend collecting speech. Must be at
            least `1`. Defaults to `60`.
        language:
          type: string
          default: en-US
          description: >-
            Language to recognize, as a BCP-47 tag such as `en-US`. To pin the
            engine for

            this language, use the form `<engine>:<tag>`, where `<engine>` is
            `Google`,

            `Google.V2`, or `Deepgram` (for example `Deepgram:en-US`). Defaults
            to `en-US`.
        hints:
          type: array
          items:
            type: string
          description: >-
            Words or phrases you expect to hear, used to bias recognition toward
            them. Not set by default.
        model:
          type: string
          description: >-
            Recognition model to use, such as `default`, `enhanced`,
            `enhanced.phone_call`,

            or `enhanced.video`. Not set by default.
      description: >-
        Settings that control how the caller's speech is recognized and
        collected.
      title: Calling.CollectSpeech
    Calling.CollectParams:
      type: object
      properties:
        node_id:
          type: string
          description: >-
            Opaque identifier that, paired with `call_id`, addresses this call.
            Echo back the value you received; treat it as opaque.
        call_id:
          type: string
          description: Unique identifier of the call.
        control_id:
          type: string
          description: >-
            Your own identifier for this collect. It is attached to every event
            the collect produces so you can match events back to this request.
        initial_timeout:
          type: number
          format: double
          minimum: 1
          default: 4
          description: >-
            How long to wait, in seconds, for the caller to start giving input.
            This

            timer only runs once it has been started — either at the outset when

            `start_input_timers` is `true`, or later via
            `calling.collect.start_input_timers`.

            Must be at least `1`. Defaults to `4.0`.
        digits:
          $ref: '#/components/schemas/Calling.CollectDigits'
          description: >-
            How to collect DTMF key presses. Provide this, `speech`, or both; at
            least one is required.
        speech:
          $ref: '#/components/schemas/Calling.CollectSpeech'
          description: >-
            How to collect spoken input. Provide this, `digits`, or both; at
            least one is required.
        partial_results:
          type: boolean
          default: false
          description: >-
            When `true`, emit partial-result events as input comes in rather
            than only a final result. Defaults to `false`.
        continuous:
          type: boolean
          default: false
          description: >-
            Keep the collect running and return a result as each complete input
            (speech

            or digits) is recognized, instead of ending after the first. Enables

            continuous collection. Defaults to `false`.
        continue:
          type: boolean
          default: false
          description: >-
            Deprecated alias of `continuous` — use `continuous` instead. If both
            are set,

            `continuous` takes precedence. Defaults to `false`.
          deprecated: true
        send_start_of_input:
          type: boolean
          default: false
          description: >-
            When `true`, fire a `start_of_input` event the moment the caller
            begins giving input. Defaults to `false`.
        start_input_timers:
          type: boolean
          default: false
          description: >-
            When `true`, start the `initial_timeout` timer immediately. Set
            `false` to start it later with `calling.collect.start_input_timers`.
            Defaults to `false`.
      required:
        - node_id
        - call_id
        - control_id
      title: Calling.CollectParams
    calling.collect_callingCollectRequest:
      type: object
      properties:
        jsonrpc:
          $ref: >-
            #/components/schemas/ChannelsCallingCollectMessagesCallingCollectRequestJsonrpc
          description: JSON-RPC version. Always `2.0`.
        id:
          type: string
          description: Request id, echoed on the correlated response.
        method:
          $ref: >-
            #/components/schemas/ChannelsCallingCollectMessagesCallingCollectRequestMethod
          description: The name of the JSON-RPC method being invoked.
        params:
          $ref: '#/components/schemas/Calling.CollectParams'
          description: The method's input parameters.
      required:
        - jsonrpc
        - id
        - method
        - params
      description: >-
        A JSON-RPC request frame. `Method` is the method name; `Params` is the
        method's input.
      title: calling.collect_callingCollectRequest

```