real-time-transcription
Skill2 starsChanged 8 months agoMITView on GitHub
Twilio development skill: real-time-transcription
In this repository66 other files it gives its agents.
- adversarial-reviewSkill
- agent-connectSkill
- agent-teams-guideSkill
- agent-testingSkill
- android-sdkSkill
- brainstormSkill
- branded-callingSkill
- callbacksSkill
- compliance-regulatorySkill
- conferenceSkill
- context-engineeringSkill
- context-hubSkill
- conversational-intelligenceSkill
- conversation-relay-referenceSkill
- conversation-relaySkill
- conversationrelaySkill
- conversations-v2Skill
- customer-memorySkill
- deepgramSkill
- deep-validationSkill
- elastic-sip-trunkingSkill
- env-doctorSkill
- event-streamsSkill
- getting-startedSkill
- hooks-referenceSkill
- iamSkill
- ios-sdkSkill
- ivr-crawlerSkill
- ivr-migratorSkill
- lookupSkill
- media-streamsSkill
- memory-systemsSkill
- messaging-services-referenceSkill
- messaging-servicesSkill
- messagingSkill
- multi-agent-patternsSkill
- operational-gotchasSkill
- paymentsSkill
- paySkill
- phone-numbersSkill
- proxySkill
- recordingsSkill
- segmentSkill
- sendgrid-emailSkill
- sip-byocSkill
- sipSkill
- sync-referenceSkill
- syncSkill
- taskrouter-referenceSkill
- taskrouterSkill
- tdd-workflowSkill
- tool-boundariesSkill
- twilio-cliSkill
- twilio-invariantsSkill
- verify-referenceSkill
- verifySkill
- video-patternsSkill
- videoSkill
- voice-insightsSkill
- voice-referenceSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
All claims backed by live testing (2026-03-24, account ACxx...xx).
- Distinctive: line 25
Use Google or Deepgram as the STT engine
- Very specific: line 27
Run concurrently with <Recording> on the same call
- Very specific: line 73
REST API error: If the call is not in-progress, the API returns error 21220 ("Call is not in the expected state").
- Very specific: line 103
Use inboundTrackLabel='customer' and outboundTrackLabel='agent'
- Very specific: line 186
Error 21220: If the call is not in-progress (still ringing, already completed), the API returns this error.
- Very specific: line 269
No callbacks without
statusCallbackUrl: If omitted, transcription runs silently with no way to receive results (unless using … - Very specific: line 273
Default engine is Google, default model is
telephony: If you omit both transcriptionEngine and speechModel, you get Google's telephony … - Distinctive: line 326
After the call: transcript is persisted to Voice Intelligence
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
name: real-time-transcription
description: Twilio Real-Time Transcription development guide. Use when adding live transcription to voice calls via <Start><Transcription> or the Transcriptions REST API — covers engine selection, callback format, track behavior, and Voice Intelligence integration.
Real-Time Transcription Skill
Decision-making guide for Twilio Real-Time Transcription (RTT). Load this skill when adding live transcription to voice calls, choosing between transcription approaches, configuring callback handlers, or integrating with Voice Intelligence.
All claims backed by live testing (2026-03-24, account ACxx...xx). See references/test-results.md for the evidence matrix with call SIDs.
Scope
What RTT CAN Do
- Transcribe live voice calls in near real-time (1-2s latency)
- Transcribe both sides of a call independently (
inbound_track,outbound_track, orboth_tracks) - Use Google or Deepgram as the STT engine
- Deliver partial (interim) and final transcription results via webhooks
- Run concurrently with
<Recording>on the same call - Integrate with Voice Intelligence for post-call analysis via
intelligenceServiceattribute - Be started via TwiML (
<Start><Transcription>) or REST API mid-call - Be stopped via TwiML (
<Stop><Transcription>) or REST API - Label tracks with custom names (
inboundTrackLabel,outboundTrackLabel) - Filter profanity, add punctuation, and provide recognition hints
What RTT CANNOT Do
- Cannot do TTS — RTT is speech-to-text only. Use Google, Amazon Polly, or ElevenLabs for text-to-speech.
- Cannot run Language Operators in real-time — Voice Intelligence operators (summarization, PII detection, sentiment) execute post-call on the persisted transcript, not during the call.
- Cannot transcribe encrypted recordings — Voice Intelligence batch transcription fails on encrypted recordings.
- Cannot create Intelligence Services via API — Services must be created in the Twilio Console (Console → Voice → Voice Intelligence).
- Cannot provide speaker diarization in callbacks — Track labels identify call legs (inbound/outbound), not individual speakers. For multi-speaker diarization, use Voice Intelligence post-call.
- Cannot guarantee callback ordering — SequenceId is monotonically increasing, but callbacks can arrive out of order at your webhook. Use SequenceId to reorder.
- Cannot share an STT session with
<Gather>—<Gather>and RTT can run on the same call simultaneously (tested), but each uses an independent STT engine and produces independent results. RTT continues through and after Gather timeouts.
Quick Decision: When to Use RTT
| Need | Use | Why |
| Live captioning / monitoring | RTT | Near real-time webhooks with 1-2s latency |
| Compliance recording with transcript | RTT + Recording | Both run simultaneously; RTT gives live text, recording gives audio archive |
| AI agent conversation | ConversationRelay | Built-in STT as part of WebSocket AI flow, sub-second latency |
| Post-call analysis at scale | Voice Intelligence batch | Process recordings after call ends, minutes latency, full operator support |
| Custom STT engine | <Start><Stream> | Raw audio WebSocket, bring your own STT |
| IVR speech input | <Gather input="speech"> | Purpose-built for collecting spoken responses with action URL |
| Live + post-call analysis | RTT with intelligenceService | Real-time webhooks during call, operators run after |
Decision Frameworks
TwiML vs REST API
| Scenario | Use | Why |
| Transcription starts at call beginning | TwiML <Start><Transcription> | Natural fit — part of the call flow |
| Transcription starts mid-call | REST API POST /Calls/{sid}/Transcriptions | Can start on any in-progress call without TwiML change |
| Transcription needs to stop before call ends | REST API POST .../Transcriptions/{sid} with Status=stopped | TwiML <Stop> requires a TwiML transition; API is immediate |
| Supervisor starts monitoring live call | REST API | No TwiML change needed on the active call |
REST API response returns sid (GT-prefixed), status (in-progress or stopped), name, call_sid.
REST API error: If the call is not in-progress, the API returns error 21220 ("Call is not in the expected state").
Engine Selection: Google vs Deepgram
| Factor | Google (default) | Deepgram |
| Default engine | Yes — used when transcriptionEngine is omitted | Must specify transcriptionEngine="deepgram" |
| Default model | telephony | Account-dependent |
| Partial result extras | No Stability field | Includes Stability field (0-1 float) |
| Multi-language detection | Not available | languageCode="multi" with Nova-3 (beta) |
| Model naming | telephony, short | nova-3, nova-2, nova-3-general, nova-2-general |
| Case sensitivity | N/A | transcriptionEngine is case-insensitive (deepgram or Deepgram) |
| HIPAA eligibility | Yes (with persisted transcripts) | Yes (with persisted transcripts, GA since Oct 2025) |
For full Deepgram model compatibility across products (ConversationRelay, Gather, RTT), load the Deepgram skill.
Track Selection
| Track | What it captures | Use case |
inbound_track | Audio from the party who received the call | Monitor what the customer says |
outbound_track | Audio from the party who initiated the call | Monitor what the agent/system says |
both_tracks (default) | Both sides, as separate callbacks per track | Full conversation transcript |
How both_tracks works: Callbacks arrive with Track: "inbound_track" or Track: "outbound_track" on each transcription-content event. They are NOT interleaved into a single stream — each utterance is labeled with its source track. Use SequenceId for global ordering across tracks.
Speaker Diarization via Dual-Track
For compliance use cases requiring WHO said WHAT:
- Set
track='both_tracks'on<Start><Transcription> - Use
inboundTrackLabel='customer'andoutboundTrackLabel='agent' - Callbacks include the track label, enabling per-speaker analysis
- Combined with Voice Intelligence, this enables automated speaker-attributed compliance checks
TwiML Integration
Starting Transcription
const twiml = new Twilio.twiml.VoiceResponse();
const start = twiml.start();
start.transcription({
statusCallbackUrl: `https://${context.DOMAIN_NAME}/callbacks/transcription-status`,
transcriptionEngine: 'deepgram', // 'google' (default) or 'deepgram'
speechModel: 'nova-3', // engine-specific model name
languageCode: 'en-US', // BCP-47 code (default: en-US)
track: 'both_tracks', // inbound_track, outbound_track, both_tracks
inboundTrackLabel: 'customer', // custom label for inbound track
outboundTrackLabel: 'agent', // custom label for outbound track
partialResults: 'false', // 'true' for interim results (high webhook volume)
profanityFilter: 'true', // replaces profanity with asterisks (default: true)
enableAutomaticPunctuation: 'true', // adds punctuation (default: true)
hints: 'Twilio, ConversationRelay', // recognition hints
// intelligenceService: 'GAxxxxxxxx', // Voice Intelligence Service SID for post-call analysis
// enableProviderData: 'false', // include raw engine metadata in callbacks
// name: 'my-transcription', // identifier for API-based stop
});
// Call continues — transcription runs in the background
twiml.say('Your call is being transcribed for quality assurance.');Stopping Transcription
const twiml = new Twilio.twiml.VoiceResponse();
twiml.stop().transcription({
// Omit to stop all active transcriptions on the call
// Or specify: sid: 'GTxxxxxxxx'
});Transcription also stops automatically when the call ends.
RTT + Recording (Both Work Simultaneously)
const start = twiml.start();
start.transcription({
statusCallbackUrl: `https://${context.DOMAIN_NAME}/callbacks/transcription-status`,
transcriptionEngine: 'deepgram',
speechModel: 'nova-3',
});
start.recording({
statusCallbackUrl: `https://${context.DOMAIN_NAME}/callbacks/call-status`,
});
// Both run concurrently — no conflictREST API Integration
Start Transcription on In-Progress Call
const transcription = await client.calls(callSid)
.transcriptions
.create({
statusCallbackUrl: `https://${context.DOMAIN_NAME}/callbacks/transcription-status`,
transcriptionEngine: 'deepgram',
speechModel: 'nova-3',
name: 'supervisor-monitor', // optional, for referencing later
track: 'both_tracks',
});
console.log(transcription.sid); // GTxxxxxxxx
console.log(transcription.status); // 'in-progress'
console.log(transcription.name); // 'supervisor-monitor'Error 21220: If the call is not in-progress (still ringing, already completed), the API returns this error. Poll call status before starting.
Stop Transcription
await client.calls(callSid)
.transcriptions(transcriptionSid)
.update({ status: 'stopped' });TwiML Attribute Reference
| Attribute | Values | Default | Notes |
statusCallbackUrl | Absolute URL | none | Where transcription events are sent. Without this, no callbacks are delivered. |
transcriptionEngine | google, deepgram | google | Case-insensitive |
speechModel | Engine-specific | telephony (Google) | Deepgram: nova-3, nova-2, nova-3-general, nova-2-general. Google: telephony, short |
languageCode | BCP-47 code, or multi | en-US | multi = Deepgram Nova-3 multi-language detection (beta) |
track | inbound_track, outbound_track, both_tracks | both_tracks | Which call leg(s) to transcribe |
inboundTrackLabel | Alphanumeric string | none | Custom label for inbound track in callbacks |
outboundTrackLabel | Alphanumeric string | none | Custom label for outbound track in callbacks |
partialResults | true, false | false | Interim results. Dramatically increases webhook volume. |
profanityFilter | true, false | true | Replaces profanity with asterisks |
enableAutomaticPunctuation | true, false | true | Adds punctuation to transcript text |
hints | Comma-separated phrases | none | Recognition hints for domain-specific terms |
intelligenceService | Service SID or name | none | Voice Intelligence integration for post-call analysis |
enableProviderData | true, false | false | Include raw engine metadata in callbacks |
name | Alphanumeric string | none | Identifier for referencing via REST API |
Callback Format
Callbacks arrive as form-encoded POST (application/x-www-form-urlencoded), NOT JSON. See references/callback-reference.md for the complete field reference.
Parsing Transcript Content
// In your callback handler (Twilio Function):
exports.handler = async function (context, event, callback) {
const { TranscriptionEvent, TranscriptionData, Final, Track, SequenceId } = event;
if (TranscriptionEvent === 'transcription-content') {
const data = JSON.parse(TranscriptionData); // JSON string, not object
const text = data.transcript; // "Hello, how can I help?"
const confidence = data.confidence; // 0.99 (only on Final=true)
const isFinal = Final === 'true'; // String, not boolean
const track = Track; // 'inbound_track' or 'outbound_track'
}
};Event Lifecycle
transcription-started → transcription-content (repeated) → transcription-stopped
↑ ↑
Partial and/or final utterances Auto on call end,
or via API/TwiML stopGotchas
Callback Format
- Callbacks are form-encoded, not JSON: Transcription callbacks arrive as
application/x-www-form-urlencoded. Do notJSON.parse(event.body). In Twilio Functions, access fields directly:event.TranscriptionData,event.Final, etc. - Transcript text is in
TranscriptionData, notTranscriptionText:TranscriptionDatais a JSON string containing{"transcript":"...","confidence":0.99}. The fieldTranscriptionTextis used by Video transcription, not voice RTT. Parsingevent.TranscriptionTextyieldsundefined. Finalis a string, not a boolean: The value is"true"or"false"(string). Checkingif (event.Final)is always truthy. Checkevent.Final === 'true'instead.confidenceis only present on final results: Partial results (Final="false") includetranscriptbut notconfidence. Only final results (Final="true") include both fields.- Callbacks can arrive out of order: SequenceId is monotonically increasing, but network conditions can deliver seq 5 before seq 4. Use SequenceId to reorder if ordering matters.
Configuration
statusCallbackUrlmust be an absolute URL: The docs specify "absolute URL." Always usehttps://domain/path, not/path.- No callbacks without
statusCallbackUrl: If omitted, transcription runs silently with no way to receive results (unless usingintelligenceServicefor post-call persistence). partialResults=truegenerates high webhook volume: A 13-second call produced 22 callbacks with partials vs 5 without. Budget callback handler capacity accordingly. Consider async queuing for high-volume deployments.- Default engine is Google, default model is
telephony: If you omit bothtranscriptionEngineandspeechModel, you get Google's telephony model. Thetranscription-startedcallback confirms the engine and model inProviderConfiguration. - Deepgram model names differ from
<Gather>: RTT uses bare names (nova-3).<Gather>requires thedeepgram_prefix (deepgram_nova-3-general). ConversationRelay usesnova-3-general. Using the wrong format for the wrong product causes silent failures. See the Deepgram skill for the cross-product attribute map.
Runtime
- Invalid engine produces error 32650, call continues: An invalid
transcriptionEnginevalue generates debugger error 32650 but does NOT terminate the call. The transcription silently fails and no callbacks are delivered. - REST API requires
in-progresscall: Starting transcription via REST API on a call that isn't in-progress returns error 21220 ("Call is not in the expected state"). Poll call status before attempting. transcription-stoppedfires automatically on call end: You do not need to explicitly stop transcription before hangup. The stopped event fires with the same TranscriptionSid.- RTT and
<Recording>coexist without conflict: Both<Transcription>and<Recording>can run inside the same<Start>block. They operate independently — each sends callbacks to its ownstatusCallbackUrl.
Observability
transcription-startedincludes engine confirmation: TheProviderConfigurationfield (JSON string) shows{"profanityFilter":"true","speechModel":"telephony","enableAutomaticPunctuation":"true"}. Use this to verify the correct engine and model were selected.- Deepgram partials include
Stabilityfield: Deepgram partial results include aStabilityfield (0-1 float) indicating how likely the partial will change. Google does not include this field. LanguageCodeis present on all content callbacks: Bothtranscription-startedandtranscription-contentevents include theLanguageCodefield.enableAutomaticPunctuation=falsemay not remove punctuation with Deepgram: Testing with Deepgram Nova-3 showed punctuation (periods, commas) still appearing in transcripts even withenableAutomaticPunctuation="false". The flag is confirmed inProviderConfigurationbut Deepgram's model may emit punctuation regardless. Test with your specific engine before relying on this flag.- Transcription has the same consent requirements as recording: Real-time transcription captures call content. The same one-party/two-party consent laws that apply to call recording apply to transcription. Always notify callers when transcription is active.
- RTT and
<Gather>run independently:<Start><Transcription>and<Gather input="speech">can coexist on the same call. RTT continues transcribing through and after a Gather timeout. Gather's STT session is separate from RTT's — they use independent engines and produce independent results. No errors or interference observed.
Voice Intelligence Concurrent Processing
- Two Intelligence Services on the same recording produce undefined behavior: If two
<Start><Transcription>blocks target the same call with differentintelligenceServiceSIDs, or if a recording is submitted to multiple Intelligence Services via REST API, the result is unpredictable. Twilio does not enforce idempotency — you may get duplicate transcripts, conflicting operator results, or race conditions on transcript storage. Pattern: Use exactly one Intelligence Service per call. If you need multiple operator pipelines, configure multiple Language Operators on a single service rather than running multiple services. - No idempotency on
source_sid: Submitting the same recording SID to an Intelligence Service twice creates two separate transcripts. There is no deduplication. Pattern: Track processed recording SIDs in a Sync Map (key = recording SID, value = transcript SID). Before submitting, check the map. This prevents duplicate processing from webhook retries or concurrent handlers. - Intelligence Service creation is Console-only: There is no REST API to create Intelligence Services (GA-prefixed SIDs). If your credential rotation process involves recreating resources programmatically, Intelligence Services are a manual step that can be missed.
Voice Intelligence Integration
RTT integrates with Voice Intelligence via the intelligenceService attribute. This is the bridge between real-time and post-call analysis.
start.transcription({
transcriptionEngine: 'deepgram',
speechModel: 'nova-3',
intelligenceService: context.TWILIO_INTELLIGENCE_SERVICE_SID, // GA-prefixed SID
statusCallbackUrl: callbackUrl,
});What happens:
- During the call: webhooks deliver real-time transcript to your
statusCallbackUrl - After the call: transcript is persisted to Voice Intelligence
- Language Operators run on the persisted transcript (summarization, PII detection, sentiment, custom extraction)
- Results available via
list_operator_resultsMCP tool or REST API
Intelligence Services (v2) must be created in the Twilio Console — there is no creation API. For the v3 Conversational Intelligence API (Language Operators, real-time analysis, cross-channel), see Conversational Intelligence v3 Skill.
Compliance Detection via Language Operators
For automated compliance monitoring (UDAAP violations, unauthorized commitments, disclosure omission):
- Real-time (in-call): Pattern match in transcription callback handler against keyword lists. Limited to text matching — no semantic analysis.
- Post-call (batch): Use Voice Intelligence with Language Operators:
text-generationoperator: Summarize calls for compliance reviewclassificationoperator: Flag calls by compliance risk categoryextractionoperator: Pull specific regulatory phrases (disclosures, commitments)
- Hybrid: Real-time flags trigger immediate alerts; post-call operators produce structured compliance reports.
Language Operators require an Intelligence Service SID (created in Console — no API for creation).
Related Resources
- Deepgram STT Skill — Cross-product model naming, Deepgram-specific config, tested model matrix
- Voice Skill — Transcription Method Selection framework, broader voice context
- Voice Use Case Map — Per-use-case product recommendations
- Media Streams Skill — Alternative: raw audio WebSocket with custom STT
- Voice CLAUDE.md — TwiML control model, background operations
- MCP Tools:
validate_transcript,get_transcript,list_transcripts,delete_transcript,create_transcript,list_sentences,list_operator_results,get_transcript_media,list_recording_transcriptions,get_transcription - Conversational Intelligence v3 Skill — v3 API: Language Operators, real-time/post-call analysis, cross-channel
- Codebase:
transcription-status.protected.js— RTT callback handler with Sync logging
Reference Files
| Topic | File | When to read |
| Callback fields | references/callback-reference.md | Parsing callbacks, building handlers, field-level details per event type |
| Test evidence | references/test-results.md | Full test matrix with call SIDs, callback payloads, and discovery narratives |
| Conference + RTT | /skills/conference/references/rtt-interaction.md | Track semantics in conference, hold behavior, speaker labeling limits |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

