# The architecture of a live voice agent call · Vaakyo

> How an outbound voice agent call flows through Vaakyo: queueing, a per-workspace dispatcher, the carrier's answer and audio stream, and one in-process…

Source: https://vaakyo.com/blog/why-a-live-call-lives-in-one-process

[← Blog](https://vaakyo.com/blog)

# Why a live call lives in one process

Most of Vaakyo is stateless, but a live call isn't. How a call travels from an API request to a queue, a dialler, the carrier and back to one long-running session.

The Vaakyo team 19 September 2026 4 min read

-   Engineering
-   Architecture

Most of a SaaS backend can be stateless: any process can serve any request, because the state lives in the database. Vaakyo is mostly built that way. Agents, calls, transcripts, campaigns and billing are all in MongoDB and Redis.

A live call is the exception. For its whole length, one process holds a WebSocket to the phone carrier carrying the caller's audio, a streaming transcriber, a streaming voice, a language model generating replies and the call's timers. That state changes every few milliseconds and can't move between processes mid-sentence. This post follows a call through the system and shows where that boundary sits.

## Placing a call never dials

When you ask for a call, through the API, the console, a campaign or an MCP client, the request handler doesn't dial. It checks your credits and your access to the agent's providers, saves the call as **queued** , records a `call.queued` event, and nudges the dispatcher. Then it returns.

Separating "accept" from "dial" means the request is fast and the call is durable. A queued call survives an API restart, a deploy or a burst of a thousand requests.

## One dispatcher per workspace

A background worker runs the dispatcher, holding a Redis lock per workspace, so only one dispatcher works through a given workspace's queue at a time. For each queued call it:

-   expires calls that waited too long;
-   fails calls the workspace can no longer pay for;
-   leaves calls outside the agent's calling hours waiting;
-   checks there's a free call slot for the workspace and room at the agent's speech providers;
-   moves the call to **ringing** _before_ dialling, so a crash between the two can never book the same slot twice;
-   asks the carrier to place the call.

When any call ends, the dispatcher is nudged again, because a slot just opened.

## The carrier comes back to us

When the person picks up, the carrier calls our answer URL with the call's id, and we reply with instructions to stream the audio to a WebSocket on our API. The carrier opens that socket, and the process that accepts it starts a **session** for the call.

That's the moment the call becomes stateful, and the process that accepted the socket owns it until the call ends.

## Inside the session

The session sets things up side by side: it marks the call answered, loads the knowledge base, connects the transcriber and loads the background sound while the voice connects. The greeting starts as soon as the voice is ready. From then on it loops: the transcriber reports a finished turn, the model streams a reply, and each sentence goes to the voice as soon as it's complete, so the caller hears the first sentence while the model is still writing the second.

Around that loop sit tool calls, interruptions, a watchdog for silence and maximum length, and a cap on the call's length set from the workspace's credit at the start. Every step is a timeline event: saved, logged, counted and sent to webhooks.

When the call ends, the session hangs up, closes its connections, works out usage per provider and model, charges it, saves the recording, and runs post-call analytics.

## What this means for scaling

Everything a call needs mid-flight (its socket, its session and its hang-up) has to reach the one process running it. So we can't put several API processes behind a plain round-robin load balancer: the carrier's hang-up for a call might land on a process that has never heard of it.

What we do instead:

-   **One API process per host** handles live calls. The rest of the system scales independently: workers for dialling, knowledge base ingestion and email.
-   **Each call records the instance** running it, so restarts, deploys and crash recovery can tell whose calls are whose.
-   **Deploys drain** rather than restart: the old process keeps its live calls until they end.

Spreading calls across hosts would take sticky routing by call id, so that the answer URL, the audio stream and the hang-up for one call all reach the same host. The call record already says which instance owns it, which is the piece that routing needs.

Most of the platform stays stateless. Only the call itself, while it's live, belongs to one process.

[Read next Deploying without dropping a call: blue/green with draining](https://vaakyo.com/blog/blue-green-deploys-without-dropping-calls)

## Get started **today**

### Talk to an expert

Tell us about your calls. We'll help you plan the agent, the numbers and the rollout for your team.

[Contact sales](https://vaakyo.com/contact#sales)

### Start building

Build an agent and talk to it in your browser in minutes. New workspaces start with ₹100 of free credits.

[Start free](https://console.vaakyo.com/signup)

---

More for agents: https://vaakyo.com/llms.txt · Docs: https://docs.vaakyo.com · Sitemap: https://vaakyo.com/sitemap-index.xml
