tap

View as MarkdownOpen in Claude

Start a media tap that streams call audio to an external endpoint. Supports WebSocket (wss://, ws://) and RTP (rtp://) destinations.

Parameters

opts
objectRequired

Tap configuration object.

opts.uri
stringRequired

Destination URI for the media stream. Supported formats:

  • "rtp://IP:port" — RTP stream
  • "ws://example.com" — WebSocket stream
  • "wss://example.com" — Secure WebSocket stream
opts.controlId
string

Identifier for this tap. Pass the same ID to stopTap() to end this specific tap. If omitted, a default ID is generated.

opts.direction
"speak" | "hear" | "both"

Audio direction to tap.

  • "speak" — what the party says
  • "hear" — what the party hears
  • "both" — both directions
opts.codec
"PCMU" | "PCMA"

Audio codec for the stream.

  • "PCMU" — G.711 mu-law
  • "PCMA" — G.711 A-law
opts.rtpPtime
number

Packetization time in milliseconds for RTP streams.

opts.statusUrl
string

URL to receive tap status change webhooks.

Returns

FunctionResultthis, for chaining.

Example

1import { FunctionResult } from '@signalwire/sdk';
2
3const result = new FunctionResult()
4 .tap({ uri: 'wss://example.com/tap', direction: 'both' });