Voice AI

Live Support Coach Room: Supervise, Coach, and Escalate AI Phone Calls in Real Time

Your AI support agent handles its hundredth call of the week. Somewhere in there, it mishears an account number and reads back the wrong balance. The customer corrects it, the call ends, and the transcript sits in a database nobody opens until a ticket arrives three days later.

That's the gap most voice AI deployments live in: the calls happen, the transcripts exist, and no human sees any of it until it's already a problem. Post-mortems are autopsies.

Live Support Coach Room is a Telnyx Edge Agent sample that closes that gap. It streams live AI support calls to a supervisor dashboard, injects coaching nudges mid-call, and escalates to a human agent over WebRTC — all while the caller is still on the line.

In this post we'll walk through what it does, how the pieces fit together, and how to deploy your own in about ten minutes.

Repo: https://github.com/team-telnyx/telnyx-code-examples/tree/main/live-support-coach-room

What the App Does

Three capabilities, all live:

  1. Live supervision. Every AI conversation streams to a supervisor dashboard — transcript, events, and flags — over a per-conversation WebSocket. The dashboard renders a snapshot on load, then applies live patches, so a supervisor who joins mid-call sees full context immediately.
  1. Mid-call coaching. A policy watcher inside the conversation's actor injects a nudge back into the assistant's context via conversation.item.create. The assistant pivots mid-call — no hang-up, no re-dial, no "please hold while I transfer you."
  1. Human escalation. One click dials the supervisor's device via Call Control and joins that leg into the live AI conversation with ai_assistant_join. The supervisor answers on a WebRTC softphone built with the Telnyx JS SDK — muted by default, unmuted only once they're actually in the room.

The repo ships with a two-tab demo: a caller simulator and the supervisor dashboard. Type an account number twice in the caller tab and watch the room inject a "verify date of birth" nudge that appears in both tabs — then hit Escalate to supervisor and take the call yourself.

How It Works

The event stream is a side channel

The whole design hangs on one decision: the conversation event stream is decoupled from call media.

You point your AI assistant's websocket_settings at a single static URL on your Edge Function:

curl -X POST https://api.telnyx.com/v2/ai/assistants/{assistant_id} \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "websocket_settings": {
      "enabled": true,
      "url": "wss://live-support-coach-room-<id>.telnyxcompute.com/agents/assist",
      "auth_ref": "<your COACH_AUTH integration secret>"
    }
  }'

One URL, one socket per conversation. The AssistRelay actor owns socket auth and routing: on session.created, it derives a room from the conversation id and forwards everything for that conversation to the right place. From there, the room receives conversation.item.created, response.text.delta, telnyx.call.*, and session.ended events per conversation. Illustratively:

// AssistRelay: one static URL, one socket per conversation
on("session.created", (evt) => {
  // route everything for this conversation to its durable room
  const room = COACHROOMS.idFromName(evt.conversation_id);
  // ...forward conversation.item.created, response.text.delta,
  //    telnyx.call.* to that room
});

Because this is a side channel, dropping it never affects the call. If your dashboard process dies, the caller hears nothing. That's the property that makes it safe to build observability tooling directly against live traffic.

One durable actor per conversation

Each live conversation gets its own CoachRoom actor — stateful and durable, surviving platform restarts so a supervisor's view never loses context mid-call. The room owns everything conversation-scoped:

  • an AgentSocketServer desk that the supervisor dashboard connects to at wss://…/agents/coach-room/{conversation_id} (snapshot + live patches),
  • a policy watcher that decides when to inject nudges,
  • a silence watcher on a durable schedule (cancelled on session.ended),
  • an @rpc joinCall handler that performs the escalation dial,
  • and a coach_log row written via per-actor SQL when the session ends.

A CoachRegistry actor keeps the list of live and ended rooms so the dashboard's room picker always reflects reality.

Injecting a nudge mid-call

Coaching is just a frame written back over the same stream the events arrive on. When the policy watcher fires — say, the caller has stated their account number twice without any identity verification — the room injects a conversation.item.create frame. The assistant treats it as part of the conversation and pivots to verifying the caller's date of birth before sharing account details.

Two knobs keep this honest:

  • NUDGE_MAX_PER_CALL (default 3) caps how many nudges a single conversation can receive.
  • SILENCE_SECS (default 90) triggers a check-in nudge if the conversation goes quiet — and because the watcher runs on a durable schedule, it survives restarts and is cancelled cleanly when the call ends.

Bringing in the human

Escalation is two API calls and one browser:

  1. POST /v2/calls dials the supervisor's device using your Call Control connection and caller ID (API reference).
  2. POST /calls/{call_control_id}/actions/ai_assistant_join joins that leg into the live AI conversation (API reference).
  3. The supervisor's softphone — a browser tab running the Telnyx WebRTC JS SDK — answers the call muted, and unmutes once the join completes, so the caller never hears a fumble.

The human joins as a first-class participant in the AI conversation, not a cold transfer. The AI keeps running; the supervisor takes over whenever they choose.

Setup

Prereqs: a Telnyx account, the telnyx-edge CLI, and a provisioned number + Call Control connection for the escalation dial (telnyx number-orders create, telnyx voice-applications create).

# 1. Clone and install
git clone https://github.com/team-telnyx/telnyx-code-examples.git
cd telnyx-code-examples/live-support-coach-room
npm install

# 2. Configure and authenticate
cp .env.example .env              # set TELNYX_API_KEY
telnyx-edge auth api-key set <your_telnyx_api_key>

# 3. Create the edge function from this directory
telnyx-edge new-func -l ts -n live-support-coach-room --from-dir .

# 4. Register secrets
telnyx-edge secrets add TELNYX_API_KEY "<your_key>"
telnyx-edge secrets add COACH_AUTH "<integration-secret-value>"
telnyx-edge secrets add CALL_CONTROL_CONNECTION_ID "<conn-id>"
telnyx-edge secrets add TELNYX_NUMBER "+1555XXXXXXXX"
telnyx-edge secrets add SUPERVISOR_DEVICE "+1555XXXXXXXX"
# optional knobs
telnyx-edge secrets add NUDGE_MAX_PER_CALL 3
telnyx-edge secrets add SILENCE_SECS 90

# 5. Generate type bindings, smoke test, ship
telnyx-edge types
npx tsx smoke_test.ts
telnyx-edge ship

ship prints a URL like live-support-coach-room-<id>.telnyxcompute.com. Point your assistant's websocket_settings at <fn-host>/agents/assist with COACH_AUTH as the auth_ref, and you're live.

COACH_AUTH does double duty: Telnyx sends it as Authorization: Bearer on the event stream, and it's the ?token= your dashboard uses to connect. It's an integration secret you create in the Telnyx portal.

For the two-tab demo, open <fn-url>/caller and <fn-url>/dashboard. You can also hit GET /rooms and GET /health/liveness at any time.

Where to Take It Next

The nudge policy is deliberately simple — a DOB-verification nudge and a silence check-in — because the interesting part is the plumbing. The policy watcher lives inside the CoachRoom actor, so new policies (compliance flags, objection handling, escalation triggers) are new code in one place, not a new pipeline.

That's the bet behind Telnyx's AI Communications Infrastructure: programmable voice, real-time event streaming, and edge compute as composable primitives, so the coaching surface is a few hundred lines of TypeScript living next to the call — not a separate system bolted on after the fact.

Build it, break the policy watcher, ship your own. The repo and the full walkthrough in GUIDE.md:

https://github.com/team-telnyx/telnyx-code-examples/tree/main/live-support-coach-room

Ready to build with low-latency voice AI?

Join developers building the future of real-time conversations