> 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. # tap > Stream call audio to an external endpoint via WebSocket or RTP. [functionresult]: /docs/server-sdks/reference/typescript/agents/function-result Start a media tap that streams call audio to an external endpoint. Supports WebSocket (`wss://`, `ws://`) and RTP (`rtp://`) destinations. ## **Parameters** **`opts`** `object` — required Tap configuration object. --- **`opts.uri`** `string` — required 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"` — default: both Audio direction to tap. * `"speak"` -- what the party says * `"hear"` -- what the party hears * `"both"` -- both directions --- **`opts.codec`** `"PCMU" | "PCMA"` — default: PCMU Audio codec for the stream. * `"PCMU"` -- G.711 mu-law * `"PCMA"` -- G.711 A-law --- **`opts.rtpPtime`** `number` — default: 20 Packetization time in milliseconds for RTP streams. --- **`opts.statusUrl`** `string` URL to receive tap status change webhooks. --- ## **Returns** [`FunctionResult`][functionresult] -- `this`, for chaining. ## **Example** ```typescript {4} import { FunctionResult } from '@signalwire/sdk'; const result = new FunctionResult() .tap({ uri: 'wss://example.com/tap', direction: 'both' }); ``` > Stream call audio to an external endpoint via WebSocket or RTP.