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

GET /

Tap call media to an external device

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

## AsyncAPI Specification

```yaml
asyncapi: 2.6.0
info:
  title: calling.tap
  version: subpackage_callingTap.calling.tap
  description: Tap call media to an external device
channels:
  /:
    description: Tap call media to an external device
    publish:
      operationId: subpackage_callingTap.calling.tap-publish
      summary: Server messages
      message:
        oneOf:
          - $ref: >-
              #/components/messages/subpackage_callingTap.calling.tap-server-0-onCallingTapCallTapEvent
          - $ref: >-
              #/components/messages/subpackage_callingTap.calling.tap-server-1-onCallingTapResponse
    subscribe:
      operationId: subpackage_callingTap.calling.tap-subscribe
      summary: calling.tap
      message:
        name: callingTap
        title: calling.tap
        payload:
          $ref: '#/components/schemas/calling.tap_callingTapRequest'
servers:
  production:
    url: wss://relay.signalwire.com/
    protocol: wss
    x-default: true
components:
  messages:
    subpackage_callingTap.calling.tap-server-0-onCallingTapCallTapEvent:
      name: onCallingTapCallTapEvent
      title: calling.call.tap
      payload:
        $ref: '#/components/schemas/calling.tap_callTapEvent'
    subpackage_callingTap.calling.tap-server-1-onCallingTapResponse:
      name: onCallingTapResponse
      title: calling.tap response
      payload:
        $ref: '#/components/schemas/calling.tap_callingTapResponse'
  schemas:
    ChannelsCallingTapMessagesCallTapEventJsonrpc:
      type: string
      enum:
        - '2.0'
      description: JSON-RPC version. Always `2.0`.
      title: ChannelsCallingTapMessagesCallTapEventJsonrpc
    ChannelsCallingTapMessagesCallTapEventMethod:
      type: string
      enum:
        - signalwire.event
      description: Always `signalwire.event`.
      title: ChannelsCallingTapMessagesCallTapEventMethod
    ChannelsCallingTapMessagesCallTapEventParamsEventType:
      type: string
      enum:
        - calling.call.tap
      description: The event type — identifies which event this is.
      title: ChannelsCallingTapMessagesCallTapEventParamsEventType
    Calling.TapState:
      type: string
      enum:
        - tapping
        - finished
      title: Calling.TapState
    CallingCallTapMediaType:
      type: string
      enum:
        - audio
      title: CallingCallTapMediaType
    Calling.CallTapMedia:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CallingCallTapMediaType'
      required:
        - type
      description: Describes the media being tapped. Currently always `audio`.
      title: Calling.CallTapMedia
    CallingCallTapDeviceType:
      type: string
      enum:
        - rtp
        - ws
      title: CallingCallTapDeviceType
    Calling.CallTapDevice:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CallingCallTapDeviceType'
      required:
        - type
      description: 'Describes where the tapped audio is being sent: `rtp` or `ws`.'
      title: Calling.CallTapDevice
    Calling.CallTapParams:
      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.
        segment_id:
          type: string
          description: >-
            Identifier of the call segment this event belongs to, for
            correlating events within the same segment of a call.
        tag:
          type: string
          description: >-
            The `tag` you set when placing the call, echoed back so you can
            match the event to your request.
        control_id:
          type: string
          description: The `control_id` of the tap this event belongs to.
        state:
          $ref: '#/components/schemas/Calling.TapState'
          description: >-
            Whether the tap is still running (`tapping`) or has stopped
            (`finished`).
        tap:
          $ref: '#/components/schemas/Calling.CallTapMedia'
          description: What media is being tapped.
        device:
          $ref: '#/components/schemas/Calling.CallTapDevice'
          description: Where the tapped audio is being sent.
      required:
        - node_id
        - call_id
        - control_id
        - state
        - tap
        - device
      title: Calling.CallTapParams
    ChannelsCallingTapMessagesCallTapEventParams:
      type: object
      properties:
        event_type:
          $ref: >-
            #/components/schemas/ChannelsCallingTapMessagesCallTapEventParamsEventType
          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.CallTapParams'
          description: The event-specific payload.
      required:
        - event_type
        - event_channel
        - timestamp
        - params
      description: The event envelope.
      title: ChannelsCallingTapMessagesCallTapEventParams
    calling.tap_callTapEvent:
      type: object
      properties:
        jsonrpc:
          $ref: '#/components/schemas/ChannelsCallingTapMessagesCallTapEventJsonrpc'
          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/ChannelsCallingTapMessagesCallTapEventMethod'
          description: Always `signalwire.event`.
        params:
          $ref: '#/components/schemas/ChannelsCallingTapMessagesCallTapEventParams'
          description: The event envelope.
      required:
        - jsonrpc
        - id
        - method
        - params
      description: >-
        Fires when a tap starts streaming call audio and again when it stops.
        Check `state` to tell which.
      title: calling.tap_callTapEvent
    ChannelsCallingTapMessagesCallingTapResponseJsonrpc:
      type: string
      enum:
        - '2.0'
      description: JSON-RPC version. Always `2.0`.
      title: ChannelsCallingTapMessagesCallingTapResponseJsonrpc
    CallingTapEchoDeviceType:
      type: string
      enum:
        - rtp
        - ws
      description: Transport of the resolved delivery device.
      title: CallingTapEchoDeviceType
    Calling.TapEchoDeviceParams:
      type: object
      properties:
        addr:
          type: string
          description: >-
            Resolved media IPv4 address. Omitted in the rare case the address
            can't be determined.
        port:
          type: integer
          description: >-
            Resolved media port. Omitted in the rare case the port can't be
            determined.
        codec:
          type: string
          description: >-
            Resolved codec for the tapped audio. May be lowercase (for example
            `opus`).
        ptime:
          type: integer
          description: >-
            Packet interval, in milliseconds — how many milliseconds of audio
            each RTP packet carries.
        rate:
          type: integer
          description: Sample rate in Hz.
      required:
        - codec
        - ptime
        - rate
      description: Fully-resolved delivery-device settings echoed back in the tap result.
      title: Calling.TapEchoDeviceParams
    Calling.TapEchoDevice:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CallingTapEchoDeviceType'
          description: Transport of the resolved delivery device.
        params:
          $ref: '#/components/schemas/Calling.TapEchoDeviceParams'
          description: Resolved delivery-device parameters.
      required:
        - type
        - params
      description: >-
        The delivery device echoed back fully resolved, so the receiving end
        knows

        exactly what audio it will get. Both transports return the same resolved

        `params`; `type` reports which transport (`rtp` or `ws`). Note this
        differs from

        the request device shape — the `ws` echo carries `addr`/`port`, not
        `uri`.
      title: Calling.TapEchoDevice
    Calling.TapResult:
      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.
        source_device:
          $ref: '#/components/schemas/Calling.TapEchoDevice'
          description: >-
            Your requested delivery device echoed back with every parameter
            resolved (address, port, codec, packetization time, and sample
            rate).
      required:
        - code
      title: Calling.TapResult
    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.tap_callingTapResponse:
      type: object
      properties:
        jsonrpc:
          $ref: >-
            #/components/schemas/ChannelsCallingTapMessagesCallingTapResponseJsonrpc
          description: JSON-RPC version. Always `2.0`.
        id:
          type: string
          description: The id of the request this responds to.
        result:
          $ref: '#/components/schemas/Calling.TapResult'
          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.tap_callingTapResponse
    ChannelsCallingTapMessagesCallingTapRequestJsonrpc:
      type: string
      enum:
        - '2.0'
      description: JSON-RPC version. Always `2.0`.
      title: ChannelsCallingTapMessagesCallingTapRequestJsonrpc
    ChannelsCallingTapMessagesCallingTapRequestMethod:
      type: string
      enum:
        - calling.tap
      description: The name of the JSON-RPC method being invoked.
      title: ChannelsCallingTapMessagesCallingTapRequestMethod
    CallingTapConfigType:
      type: string
      enum:
        - audio
      title: CallingTapConfigType
    Calling.TapConfig:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CallingTapConfigType'
      required:
        - type
      description: The media to intercept. Only `audio` is currently supported.
      title: Calling.TapConfig
    CallingTapDeviceType:
      type: string
      enum:
        - rtp
        - ws
      title: CallingTapDeviceType
    Calling.TapDevice:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CallingTapDeviceType'
      required:
        - type
      description: >-
        Where to deliver the tapped media. Choose `rtp` or `ws`. The result
        echoes this back fully resolved as `source_device`.
      title: Calling.TapDevice
    Calling.TapParams:
      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: Identifier used to control the active tap.
        tap:
          $ref: '#/components/schemas/Calling.TapConfig'
          description: Media to intercept.
        device:
          $ref: '#/components/schemas/Calling.TapDevice'
          description: Device to receive the tapped media.
      required:
        - node_id
        - call_id
        - control_id
        - tap
        - device
      title: Calling.TapParams
    calling.tap_callingTapRequest:
      type: object
      properties:
        jsonrpc:
          $ref: >-
            #/components/schemas/ChannelsCallingTapMessagesCallingTapRequestJsonrpc
          description: JSON-RPC version. Always `2.0`.
        id:
          type: string
          description: Request id, echoed on the correlated response.
        method:
          $ref: >-
            #/components/schemas/ChannelsCallingTapMessagesCallingTapRequestMethod
          description: The name of the JSON-RPC method being invoked.
        params:
          $ref: '#/components/schemas/Calling.TapParams'
          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.tap_callingTapRequest

```