Debug Twilio Voice Flows Without Parsing Logs
Twilio sends between 5 and 12 webhooks for a single phone call.
The call comes in: voice.incoming. Your TwiML responds: voice.response. The call is answered: call.answered. Recording starts: recording.in-progress. The IVR plays the menu: another status webhook. The caller presses 1: a digit input event. The call routes to an agent: call.forwarded. The recording completes: recording.completed. The call ends: call.completed. The transcription is ready: transcription.completed.
These events do not arrive in one clean batch. They arrive across a span of seconds to minutes, interleaved with events from other simultaneous calls. When you have twenty concurrent calls — a normal load for any customer support team — your event log has two hundred interleaved Twilio events, sorted only by timestamp, with no grouping by call.
Debugging one specific call means filtering your entire log by a single CallSid value, sorting chronologically, and then mentally assembling the sequence yourself. You count events. You look for gaps. You check whether the recording status event arrived before or after the transcription event. You do this in your head, or in a spreadsheet, or in a text editor with the events copy-pasted out of your log viewer.
That process takes 15-25 minutes for a single call when you know what you are looking for. When you are not sure what step failed, it takes longer — because you are not only reconstructing the sequence, you are also diagnosing which step is missing or malformed.
HookTunnel's Twilio call trace view does the reconstruction for you automatically.
How call traces work
When HookTunnel detects a X-Twilio-Signature header on an incoming webhook, it identifies the event as a Twilio event and extracts the CallSid from the payload.
Every event that shares a CallSid is grouped into a single call trace. The trace displays in chronological order — not sorted by insertion time, but by the Timestamp field in the Twilio payload. HookTunnel normalizes the ordering even if events arrive slightly out of sequence due to network conditions.
The call trace shows:
- The CallSid as the trace identifier
- From/To numbers, partially redacted (last 4 digits visible, rest masked for privacy)
- Call status at trace-close time
- Total call duration (when the completed event has arrived)
- Each event in sequence with: event type, timestamp, HTTP response status from your handler, response latency
- Expected events that have not yet arrived, shown as pending slots
- Events that are missing relative to the expected sequence for the call type, shown as visible gaps
Detection is automatic — no configuration required
You do not configure anything for call trace detection. If the header X-Twilio-Signature is present on inbound events to your HookTunnel hook URL, call trace grouping activates automatically. If you are routing Twilio events through HookTunnel, you get call traces.
Visible gaps: the feature that changes debugging
Most log-based debugging tools show you what arrived. They do not show you what should have arrived but did not.
For Twilio voice flows, the absence of an event is often more important than the presence of events. If your IVR flow has five expected steps and step three is missing, the events for steps one, two, four, and five tell you very little about the problem. The gap at step three tells you everything.
HookTunnel knows the expected event sequence for common Twilio call types: inbound voice, outbound voice, conference calls, SMS, and recording flows. When a call trace has events for steps one, two, four, and five but not step three, step three appears as a named gap in the timeline. You see it immediately without counting, without comparing to documentation, without building the mental model of what the sequence should be.
For custom TwiML flows — flows that deviate from the standard sequence — the gap detection uses the sequence you have observed across previous successful calls as the baseline. After HookTunnel has seen 20 successful traces for a given call pattern, it knows what the complete trace looks like and can identify deviations.
The developer who was losing an hour every IVR incident
Marcus builds the voice product at a healthcare scheduling company. Their IVR handles appointment reminders, patient callback requests, and voicemail drops for providers. Each call type has a distinct TwiML flow with 6-9 events.
When an IVR flow breaks — a TwiML redirect fails, a recording-status event does not arrive, a digit-input event gets dropped — Marcus would start with a full event log and filter by CallSid. He would copy the filtered events into a text file, sort by timestamp, and compare against the expected sequence for that call type. The process was reliable but slow. One incident diagnosis: 20 minutes minimum. Three incidents in a morning: 60 minutes of log archaeology before he could write a single line of fix.
The failures that took longest were the ones where the sequence looked complete but was subtly wrong — a recording-completed event arriving before the recording-in-progress event due to a Twilio edge case, or a digit-input event with a malformed Digits field that his handler silently discarded. Those were not gaps; they were present-but-wrong events. Finding them required reading field values, not just checking sequence.
With call trace view, Marcus opens the failing CallSid in HookTunnel. The trace is assembled. He sees the sequence. The gap at step 5 is immediately visible — the TwiML redirect event that should fire when the patient presses 2 is missing. The prior step, the menu-play event, shows HTTP 200 from his handler with a 340ms response latency. Normal. The step that never fired.
He checks the TwiML response his handler generated for the menu-play event — visible in the event detail in the trace. The <Gather> verb timeout is set to 5 seconds. The recording shows the menu audio runs 4.9 seconds. The caller was pressing 2 at 4.7 seconds. Twilio accepted the digit but the gather had already timed out. Edge case: gather timeout fires before digit input completes.
That diagnosis took 6 minutes in the call trace view. It took 40 minutes the last time it happened, before call traces existed, because finding the timing relationship between the menu duration and the gather timeout required manually correlating two event payloads by timestamp.
What call trace view shows for each event
Each event in a call trace shows:
- Event type: the Twilio event name (e.g.,
voice.incoming,recording.completed) - Timestamp: when Twilio sent the webhook
- Received at: when HookTunnel captured it (usually within milliseconds of the timestamp)
- Handler status: the HTTP status code your handler returned
- Handler latency: how long your handler took to respond
- Payload summary: key fields from the payload (CallSid, CallStatus, Direction, Duration, Digits) without the full body, to keep the trace readable
- Full detail: click any event to expand and see the complete payload, headers, and your handler's response body
The status codes that matter
Twilio retries failed webhook deliveries. If your handler returns a non-2xx status, Twilio will retry the event. In the call trace view, retried events appear as retry entries on the same step — the step shows the original delivery (failed) and the retry attempts, so you can see whether your handler eventually accepted the event and how many retries it took.
This retry visualization is something you cannot easily construct from raw logs. In a log view, retried events look like separate events at different timestamps. In the call trace, they are grouped as attempts on the same logical step.
SMS and multi-message flows
Call traces work for SMS flows as well. For SMS campaigns or multi-message conversation flows, HookTunnel groups events by the SmsSid or ConversationSid field instead of CallSid. The grouping logic is the same. Multi-message flows where a customer sends several replies over a conversation are grouped into a single conversation trace.
For SMS, the expected sequence is simpler — typically message.sent, message.delivered, optionally message.undelivered — but the trace view is still useful for finding the delivery failures that are intermittent and hard to spot in a flat log.
How call traces work with investigations
When you create a HookTunnel investigation and attach events, call traces that contain attached events are displayed in trace view within the investigation panel — not as flat events, but as the full grouped trace. If the failing event is step 3 of a 7-step call, you see all 7 steps with the failing step highlighted.
This integration is useful for incidents affecting multiple calls. If a TwiML error caused 15 calls to fail at the same step, the investigation shows 15 traces, all with the same gap at the same position. The pattern is visually obvious in a way it is not when you are looking at 15 individual failing events in a flat list.
Comparison with alternatives
| Capability | HookTunnel Call Traces | ngrok | Webhook.site | Twilio Debugger | |---|---|---|---|---| | Group events by CallSid automatically | Yes | No | No | Yes | | Show missing events as visible gaps | Yes | No | No | Partial | | Retry attempts grouped with original event | Yes | No | No | Yes | | Available after tunnel/session ends | Yes (full retention) | No (session-scoped) | 7 days max | 30 days | | Integrates with incident investigations | Yes | No | No | No | | Outcome receipt state per event | Yes | No | No | No | | Works for all providers, not just Twilio | Yes | Yes | Yes | No |
The Twilio Debugger (in the Twilio console) does provide call trace functionality, but it shows you Twilio's view — what Twilio sent and what response code your endpoint returned. HookTunnel shows you both Twilio's view and your handler's view: the full captured payload, your response body, the latency, and whether the event was applied by your application via receipt confirmation. For complex debugging, that additional layer matters.
Frequently asked questions
Do I need to configure anything to get call traces?
No. Call trace grouping activates automatically when HookTunnel detects a X-Twilio-Signature header on incoming events. Point your Twilio webhook URL at your HookTunnel hook URL and call traces appear.
What if my Twilio events are arriving out of order?
HookTunnel reorders events in a call trace by the Timestamp field from the Twilio payload, not by capture time. Out-of-order delivery due to network variance is normalized automatically.
How long do call traces persist?
Call traces follow the same retention rules as all events: 24 hours (Free), 30 days (Pro), 90 days (Team), 1 year (Enterprise). An active call trace is available for the duration of the call plus the full retention window from the final event.
Does call trace view work for Twilio Conversations or only basic calls?
Call traces work for voice calls (grouped by CallSid), SMS flows (grouped by SmsSid), and Conversations (grouped by ConversationSid). The expected-sequence gap detection is calibrated for each flow type separately.
Can I use call trace view for providers other than Twilio?
Call trace view is specific to Twilio — it uses the X-Twilio-Signature header for detection and the Twilio payload schema for event grouping and gap detection. For other providers, HookTunnel's investigation feature provides similar correlation capabilities by letting you manually group events with shared identifiers.
What does the partial number redaction look like?
From/To numbers are displayed as +1 (555) ***-**89 — the country code, area code, and last two digits are visible. The remaining digits are masked. This provides enough information to identify the call (you can match the last two digits to a known number) without logging full phone numbers in the call trace view.
Debug your Twilio call flow in minutes, not hours
Connect your Twilio webhook URL to HookTunnel. Call traces are generated automatically.
Get started free →