Audio Streaming

Stream raw PCM call audio to your WebSocket server in real time.

Fork one-way audio for live analytics or run full-duplex bidirectional streams for custom Voice AI bots, live translation, and TTS β€” from outbound REST API calls or inbound Call Flow webhooks.
PCM 16-bit little-endian binary frames
8,000 Hz (G.711) & 16,000 Hz wideband
Outbound REST API & Inbound JCA flows
Barge-in clear control via killAudio
WebSocket Wire Protocol
WSS Binary
wss://your-server.example.com/stream?call_id=call_abc123&stream_type=firetell_stream
Firetell β†’ Your Server
Binary
PCM 16-bit little-endian at 8000 or 16000 Hz (stereo left=caller, right=callee when track=both)
Your Server β†’ Firetell
Binary
Mono PCM 16-bit little-endian at sample_rate Hz, played to the caller (bidirectional: true)
Your Server β†’ Firetell
Text JSON
{"type":"killAudio"} stops queued playback audio immediately for natural barge-in
Auto-appended query params
call_idworkspace_idcaller_numbercaller_namedestination_numberstream_type=firetell_stream
Two streaming modes

Consume passively or talk back in full duplex.

Control directionality per action with a single boolean flag.
bidirectional: false

One-way audio fork

Mirror caller, agent, or stereo mixed audio directly to your backend while the call connects to a team, operator, or IVR as usual.
Receive stereo (left=caller, right=callee) or single-track PCM
Zero impact on call routing or audio quality
Ideal for custom ASR, keyword spotting, and compliance monitoring
bidirectional: true

Two-way custom Voice AI & audio injection

Receive caller audio and stream synthesized speech back in real time. Build your own Voice Agent using any STT, LLM, and TTS stack.
Inject mono 16-bit LE PCM frames into the live call
Interrupt playback on caller speech with {"type":"killAudio"}
Requires answered call (ACTIVE state, answer_call defaults to true)
Outbound & Inbound

One action for outbound API calls and inbound Call Flows.

Start streaming when placing a call from your backend, or dynamically when an inbound call reaches a JSON Call Action webhook node in your visual Call Flow.
Outbound β€’ REST API

POST /calls/make

Include an object with action: "stream" inside the actions array when creating an outbound call. Note that POST /calls/make accepts either actions or call_flow_id, not both.
Inbound β€’ Call Flow JCA

JSON Call Action (json_call_action) webhook

Add a JSON Call Action node to any inbound Call Flow. Firetell POSTs the caller context to your endpoint and executes the returned actions array β€” including play notices followed by stream.
bash
curl -X POST "https://{workspace_id}.firetell.app/api/v1/calls/make" \
-H "Authorization: ApiKey YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": { "number": "+14155550100", "name": "VoiceBot Support" },
"to": { "number": "+12125550123", "name": "John Doe" },
"actions": [
{
"action": "stream",
"params": {
"ws_url": "wss://bot.example.com/call-stream",
"track": "both",
"sample_rate": 8000,
"bidirectional": true,
"headers": {
"Authorization": "Bearer YOUR_BOT_TOKEN"
}
}
}
]
}'
Action & WebSocket spec

Stream parameters and wire format.

Configure tracks, sample rate, handshake headers, and answer behavior cleanly in JSON.
ParameterType / DefaultBehavior
ws_urlstring (required)Publicly routable wss:// or ws:// URL. RFC 1918 private IPs, loopback, link-local, and cloud metadata addresses are blocked.
trackstring β€’ bothWhich legs to stream: both (stereo β€” caller on left, callee on right), inbound (caller only), or outbound (callee only).
sample_ratenumber β€’ 8000PCM 16-bit little-endian sample rate in Hz: 8000 (G.711-compatible) or 16000 (wideband).
bidirectionalboolean β€’ falseSet true to send mono PCM audio back into the caller channel. Requires an answered (ACTIVE) call.
answer_callboolean β€’ trueAnswer the call before opening the stream. Only set false if a preceding action already answered the channel.
headersobject β€’ optionalCustom HTTP headers included on the WebSocket upgrade handshake (e.g. Authorization tokens). Maximum 10 entries.
When to use Audio Streaming

Full audio control when built-in pipelines aren't enough.

Voice AI

Bring your own STT, LLM & TTS

Keep proprietary prompts, fine-tuned speech models, or specialized voices entirely on your own infrastructure.
Compare with managed AI Voice Agent
Transcription & Analytics

Real-time sentiment & custom ASR

Pipe raw 16-bit PCM frames into your own speech recognition or live QA scoring worker as words are spoken.
See turnkey Live Transcription
Dynamic Routing

Conditional streaming from Call Flows

Trigger recording consent playback first, then conditionally fork selected inbound calls via JSON Call Action.
Explore Visual Call Flow Builder
Open-source starters

Run a working WebSocket server in minutes.

Clone Firetell's official starter servers on GitHub to inspect PCM binary framing, query parameters, and bidirectional playback.

Node.js Audio Stream Example

WebSocket server handling 16-bit little-endian PCM binary frames, query metadata, and echo/TTS writeback.
View Node.js repo

Python Audio Stream Example

Async WebSocket receiver for raw PCM streams, audio inspection, and custom AI pipeline integration.
View Python repo

Call Flows JCA Guide

Step-by-step webhook schema for returning play + stream or full-duplex voice bot actions from inbound Call Flows.
Read JCA guide
FAQ

Frequently asked questions

Firetell sends raw PCM 16-bit little-endian (signed 16-bit integer) audio inside binary WebSocket frames at either 8,000 Hz (default) or 16,000 Hz. When track is both (default), frames are stereo interleaved with the caller on the left channel and callee on the right channel.
Yes. For outbound calls, pass action: "stream" in POST /calls/make. For inbound calls, place a JSON Call Action (json_call_action) webhook node inside a visual Call Flow and return { "actions": [{ "action": "stream", "params": { ... } }] } from your server.
Audio injection requires the call channel to be in the ACTIVE (answered) state. Leave answer_call at its default value of true, or make sure an earlier action in your sequence answered the call before opening the stream. Also confirm you send mono PCM 16-bit little-endian binary frames matching the configured sample_rate.
Firetell automatically appends call_id, workspace_id, caller_number, caller_name, destination_number, and stream_type=firetell_stream as query parameters on your ws_url, and you can also pass up to 10 custom HTTP headers (such as Authorization).
No. For SSRF protection, ws_url must point to a publicly routable server over wss:// or ws://. Private RFC 1918 networks, loopback, link-local, and cloud metadata IPs are rejected.

Stream live call audio directly into your stack.

Start building with $3 free API credit and our Node.js & Python WebSocket examples.