Home / Companies / AssemblyAI / Blog / Post Details
Content Deep Dive

Detect scam calls using Go with the LLM Gateway and Twilio

Blog post from AssemblyAI

Post Details
Company
Date Published
Author
Marcus Olsson
Word Count
6,101
Company Posts That Month
25
Language
English
Hacker News Points
-
Post removed?
No
Summary

A tutorial demonstrates how to build a roughly 250-line Go service that uses Twilio Media Streams to fork live phone-call audio, AssemblyAI’s streaming speech-to-text API to transcribe it in real time, and the AssemblyAI LLM Gateway to classify the completed transcript as a scam, suspicious, or legitimate call. It explains configuring a public ngrok endpoint and Twilio webhook, preserving Twilio’s native 8 kHz mu-law audio format, and batching five 20-millisecond audio frames into 100-millisecond chunks because the transcription API rejects shorter messages. The application maintains a separate transcript buffer and WebSocket session for each call, stores only finalized formatted speech turns, flushes remaining audio and waits for transcription termination so the final utterance is not lost, then sends the transcript to a configurable LLM with a prompt designed to identify fraud indicators such as urgency, impersonation, requests for codes or payments, and secrecy. It also includes JSON-output fallback handling for models without structured-response support, troubleshooting guidance for common WebSocket, audio-format, and tunnel failures, and suggestions for extending the prototype with mid-call alerts, speaker labels, persistent audit records, or automated intervention.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Real-time 39 649 155 80 -85%
LLM 23 747 162 79 -85%
Voice AI 7 324 41 16 -89%
AI Guardrails 1 35 22 12 -94%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.