Skip to main content
~ audio streaming carrier-grade telephony · websocket transport

Audio Streaming for voice AI agents

Live call audio in, synthesized speech back, over one WebSocket. You own the AI pipeline; Plivo handles the phone network. Works best with Pipecat.

edge → your server
~50ms
countries
190+
uptime
99.99%
wss://your-server.com/streambidirectional

A visualization of Plivo audio streaming. Caller audio arrives over a WebSocket as 20 millisecond mu-law frames on the caller trace, and the agent's reply streams back as playAudio on the agent trace. Responses land in under a second.

~ customers trusted by teams at
Meta Decker Brands Adobe Trip.com Uber Laz Parking Discord Atlassian GoDaddy DocuSign Yahoo Equifax
~ how it works caller → plivo → your server → ai

One WebSocket between your call and your AI

Audio streaming exposes the raw audio of a live call over a WebSocket, in both directions, so your agent can listen and respond in the same moment.

PSTN / SIP

Caller

A caller dials your Plivo number, or you place an outbound call through the Voice API.

[01]
edge routing

Plivo Voice

Plivo answers, fetches your Stream XML from your Answer URL, and opens a secure WebSocket to your server.

[02]
WebSocket

Your server

You receive 20 ms audio frames, run your logic, and stream synthesized audio back.

[03]
STT · LLM · TTS

AI services

Any provider you choose transcribes, reasons, and speaks, with barge-in support.

[04]
~ quickstart one server · two endpoints

From dial tone to dialogue in two steps

One server, two endpoints. The Stream SDK takes care of the framing, encoding, and events.

  • 01 /answer returns your <Stream> XML when Plivo picks up.
  • 02 /stream receives caller audio and streams your agent's reply back.
View the full quickstart
from fastapi import FastAPI, WebSocket
from fastapi.responses import Response
from plivo_stream import PlivoFastAPIStreamingHandler

app = FastAPI()

ANSWER_XML = """<Response><Stream bidirectional="true" keepCallAlive="true"
  contentType="audio/x-mulaw;rate=8000">wss://your-server.com/stream</Stream></Response>"""

@app.get("/answer")
def answer():                              # Plivo requests this on pickup
    return Response(ANSWER_XML, media_type="application/xml")

@app.websocket("/stream")
async def stream(websocket: WebSocket):    # Plivo opens the socket here
    handler = PlivoFastAPIStreamingHandler(websocket)

    @handler.on_media
    async def on_media(event):
        audio = event.get_raw_media()          # caller audio (mu-law)
        reply = await run_ai_pipeline(audio)   # your STT -> LLM -> TTS
        await handler.send_media(reply)        # speak back to the caller

    await handler.start()
~ framework pipecat · websocket
Pipecat

Ship faster on Pipecat

Plivo streams live call audio straight into your Pipecat pipeline over WebSocket. Start from a working voice agent, not telephony plumbing.

Phone call Plivo WebSocket Pipecat AI services
  • Native PlivoFrameSerializer in Pipecat core
  • Bring any STT, LLM, and TTS, or go speech-to-speech
  • Scaffold in one command with the Pipecat CLI
pipecat cli
# scaffold a phone agent on Plivo telephony
uv tool install "pipecat-ai[cli]"

pipecat init call-bot --bot-type telephony --transport plivo \
    --mode cascade --stt deepgram_stt --llm openai_llm --tts cartesia_tts

cd call-bot && uv sync
uv run bot.py    # expose with: ngrok http 7860
~ ready-made recipes built on plivo github + docs
on livekit? LiveKit agents connect over SIP Trunking. Same telephony, different transport.
~ capabilities 9 built in · 3 groups

Everything a production voice agent needs from its carrier

The platform handles the hard telephony work: codecs, interruption, security, and the full stream lifecycle. You focus on the conversation.

live conversation how the agent listens and talks
duplex

Bidirectional WebSocket

Receive caller audio and send synthesized speech back over a single connection, so your agent can listen and talk at the same time.

[01]
barge-in

Barge-in and interruption

Clear the playback queue the instant a caller speaks with clearAudio, and track exactly what finished playing with checkpoints.

[02]
dtmf

In-stream DTMF, both ways

Receive keypad presses as dtmf events mid-stream, and send digits out when your agent has to drive an IVR or answering machine.

[03]
voice quality · latency what the caller hears
latency

Edge-routed by design

Plivo answers calls at the edge location closest to the caller, so co-locating your server keeps the network hop short and the conversation snappy.

[04]
clarity

Noise cancellation & BVC

Filter background noise and background voices on the wire, tunable per stream, so your speech-to-text hears only the caller.

[05]
codec

Native telephony codec

Stream μ-law 8 kHz, the phone network's own format, or switch to 16-bit Linear PCM at 8 or 16 kHz when your STT model wants wideband audio.

[06]
operations · security what production demands
callbacks

Lifecycle callbacks

Subscribe to started, stopped, and failed webhooks with duration and status reason to power monitoring, billing, and retries.

[07]
metadata

Session metadata

Pass user, session, or tenant context into the start event with extraHeaders, so every stream lands on your server already identified.

[08]
security

Signed connections

Every WebSocket upgrade carries a V3 HMAC-SHA256 signature you can validate with the SDK, over wss and TLS, so only Plivo traffic reaches your server.

[09]
~ stream directions 2 modes · what teams build

Stream one way to listen, both ways to converse

One XML attribute sets the direction. Each direction unlocks a different class of product.

Both ways to converse

bidirectional
  • Voice assistants

    Agents that answer, qualify, and resolve on their own.

  • Voice bots & smart IVR

    Replace press-one menus with intent-aware routing.

  • Outbound conversations

    Reminders and follow-ups that handle questions live.

params bidirectional=truekeepCallAliveclearAudio

One way to listen

listen-only
  • Real-time transcription

    Live captions and searchable transcripts as words are spoken.

  • Sentiment & QA

    Score tone, intent, and compliance while the call happens.

  • Agent assist & co-pilot

    Surface answers to human agents mid-call.

params audioTrack=both
~ your ai stack stt · llm · tts

Bring your own AI. Plivo moves the audio.

Audio streaming is model-agnostic on purpose. Swap any provider without touching the call layer, so you are never locked into one vendor's voices or models.

speech-to-text [01]

Transcribe

Forward caller audio to any streaming STT model to turn speech into text as it is spoken.

  • Deepgram
  • AssemblyAI
  • Sarvam
reasoning [02]

Think

Send the transcript to any LLM to decide what to say next, call tools, or look up your knowledge base.

  • OpenAI
  • Anthropic
  • Google Gemini
text-to-speech [03]

Speak

Synthesize the reply with any TTS voice and stream it back to the caller for a natural response.

  • ElevenLabs
  • Cartesia
  • Inworld
works with your favorites and any api-based provider
~ latency target < 1000 ms

Engineered for the sub-second budget

Wherever you build, Plivo has a point of presence close to your callers. Calls enter the network at the nearest edge and reach your server in about 50 ms, so the sub-second budget is yours to spend on AI.

end-to-end response < 1000 ms
Speech-to-text
< 200 ms your stack
LLM
< 500 ms your stack
Text-to-speech
< 200 ms your stack
Network
< 50 ms plivo

A point of presence near every caller

Plivo answers at the edge closest to the caller, wherever that is. Run your WebSocket server and model endpoints in the matching region and the whole turn stays inside the sub-second budget.

  • US traffic US East (Virginia) or US West (Oregon)
  • Europe Frankfurt or London
  • Asia-Pacific Singapore or Mumbai
  • Global Multi-region with geographic routing
~ security & compliance hipaa · gdpr · soc 2 · pci dss

Enterprise-grade security
& compliance

HIPAA
HIPAA
GDPR
GDPR
AICPA SOC 2
SOC 2
PCI DSS
PCI DSS
STAR
STAR
  • Encryption everywhere

    TLS in transit. AES-256 at rest. No exceptions.

    tls · aes-256
  • Data residency

    Choose US, EU, or APAC. Your data stays where you need it.

    us · eu · apac
  • Audit-ready

    Full access logs, RBAC, and compliance reports on demand.

    logs · rbac · reports
~ship itone command · production-ready

Put your agent on the phone network

Start streaming live call audio in minutes. Free credits, no credit card required.

› no credit card› free credits› cancel anytime
~/plivo12:14:24
> build a phone agent that books appointments
agent deployed · 5 stepsquickstart →