DEV Community

Sonam
Sonam

Posted on

Build a Live Call Transcription Agent on Telnyx Edge Compute

Call recordings are useful, but they are usually passive.

This example turns a live phone call into something your app can use right away.

The edge-call-transcription-agent example answers an inbound call on Telnyx Edge Compute, starts streaming transcription, stores final transcript segments in an Agent SDK actor, summarizes the call after hangup with Telnyx AI Inference, persists the record, and sends the summary by SMS.

Code: https://github.com/team-telnyx/telnyx-code-examples/tree/main/edge-call-transcription-agent

What it builds

The app is a TypeScript Edge Compute function with two Agent SDK actors:

  • TranscribeAgent - one actor per call
  • TranscriptRegistry - one shared actor for listing stored transcripts

The call flow:

call.initiated
  -> record call state
  -> answer call

call.answered
  -> speak greeting

call.speak.ended
  -> start inbound transcription

call.transcription
  -> append transcript segment

call.hangup
  -> summarize
  -> store
  -> SMS summary
Enter fullscreen mode Exit fullscreen mode

Routes

  • POST /webhooks/voice receives Telnyx Call Control events
  • GET / serves a lightweight dashboard
  • GET /transcripts lists recent stored transcripts
  • GET /transcripts/:call_control_id fetches one transcript
  • GET /debug/state?call_control_id=... shows live actor state
  • GET /health/liveness and GET /health/readiness are health checks

Why actors help

Streaming transcription arrives as many events.

The app needs to remember:

  • which call this is
  • whether it is answering, transcribing, summarizing, sending, or done
  • interim transcript segments
  • final transcript text
  • start and end timestamps
  • summary status

An actor per call makes that state easy to hold.

The source maps each call_control_id to one TranscribeAgent, so the transcript can build up across webhook events.

The AI summary

After hangup, the actor queues a finalize pipeline:

summarize -> store -> notify
Enter fullscreen mode Exit fullscreen mode

The summary uses Telnyx AI Inference through the Edge Compute binding:

this.env.TELNYX.ai.openai.chat.createCompletion({
  model,
  messages: [
    { role: "system", content: SUMMARY_SYSTEM_PROMPT },
    { role: "user", content: transcript },
  ],
  max_tokens: 200,
  temperature: 0.3,
});
Enter fullscreen mode Exit fullscreen mode

The default model is:

zai-org/GLM-5.2
Enter fullscreen mode Exit fullscreen mode

The prompt asks for a concise SMS-friendly summary under 320 characters.

SMS notification

Once the summary is ready, the app sends it over Telnyx Messaging:

this.env.TELNYX.messages.send({
  from: this.env.SMS_FROM,
  to: this.env.SMS_TO,
  text: state.summary,
});
Enter fullscreen mode Exit fullscreen mode

Use placeholders in examples and configure real numbers only as private runtime values:

SMS_FROM=<TELNYX_SMS_FROM>
SMS_TO=<SUMMARY_RECIPIENT>
Enter fullscreen mode Exit fullscreen mode

Try it

git clone https://github.com/team-telnyx/telnyx-code-examples.git
cd telnyx-code-examples/edge-call-transcription-agent
npm install
Enter fullscreen mode Exit fullscreen mode

Set secrets:

telnyx-edge secret set TELNYX_API_KEY <YOUR_TELNYX_API_KEY>
telnyx-edge secret set SMS_FROM <TELNYX_SMS_FROM>
telnyx-edge secret set SMS_TO <SUMMARY_RECIPIENT>
Enter fullscreen mode Exit fullscreen mode

Deploy:

telnyx-edge ship
Enter fullscreen mode Exit fullscreen mode

Point your Call Control app webhook to:

https://edge-call-transcription-agent-<id>.telnyxcompute.com/webhooks/voice
Enter fullscreen mode Exit fullscreen mode

Then call the Telnyx number assigned to the Call Control application.

Production notes

Before using this with real callers, add:

  • webhook signature verification
  • auth on transcript and debug endpoints
  • transcript redaction
  • retention rules
  • SMS opt-out and consent handling
  • idempotency for Call Control and SMS actions
  • monitoring for STT, LLM summary, storage, and SMS delivery

The useful pattern is simple: live call events, durable state, AI summary, and post-call notification in one edge app.

Resources:

Top comments (0)