This article was drafted with AI help and reviewed by the author.
"The agent feels slow" is the most common complaint about a voice agent, and the least useful one. Slow where? The model might be taking its time. Speech recognition might be waiting too long for the caller to finish. Or the audio might simply be travelling a long way, with jitter on top.
From the agent's server logs you can see your own processing time. What you can't see well is the network between the person and Twilio.
This post describes a small internal Next.js page that calls your agent from a browser with Twilio's Voice JavaScript SDK, records the SDK's per-second network samples, and saves a summary for each test call in Supabase. It won't measure everything, and the limits are spelled out at the end. But it gives your team a repeatable way to answer "is it the network?" before anyone rewrites prompts.
Event names and thresholds below match Twilio's Voice JavaScript SDK and Voice Insights reference pages as of 27 November 2026. All sample values are made up.
What the page does
- A tester opens the page, picks an edge setting and a test script, and clicks Call.
- The page asks a Next.js route handler for a short-lived Twilio access token. The route checks the tester is signed in.
- The SDK places a call to a TwiML app that connects to your voice agent, the same way a phone call would after it reaches Twilio.
- During the call, the page collects the SDK's sample and warning events.
- When the call ends, the page sends a summary to another route handler, which writes one row to Supabase.
Nothing about your agent changes. The page is just another caller, one that keeps notes.
Tokens stay on the server
The browser never sees your Twilio auth token or API secret. The route handler creates an access token with a voice grant for your TwiML app, a short lifetime, and an identity tied to the tester, for example tester-ayesha. The page only receives that token.
Treat the page as internal. Put it behind your normal auth, and don't deploy it to the public site. Anyone who can load it can place calls on your account.
Choosing the edge on purpose
The SDK connects to a Twilio edge location, and Twilio's docs say that choice directly affects media latency and call quality for SDK and SIP connections. The default is roaming, which uses Twilio's Global Low Latency routing to pick a nearby edge.
You can also pass a single edge, or a list in priority order. With a list, the SDK falls back to the next edge if the first one fails to connect.
For testing, that gives you a simple comparison. Run the same script three ways:
- roaming
- the edge nearest your agent's servers, for example ashburn if the agent runs in the eastern United States
- the edge nearest your tester, for example singapore or frankfurt for a tester in Lahore, whichever measures better
Record which one was used. The device reports the edge it actually connected to, which matters with roaming.
What the SDK reports every second
During a call, the SDK emits a sample event once per second. Each sample carries WebRTC stats including round-trip time in milliseconds, jitter, packets lost, a MOS estimate, the codec, and input and output audio levels.
It also emits warning events when a metric crosses a threshold several times in a row, and a warning-cleared event when it recovers. From Twilio's Voice Insights reference:
- high-rtt when round-trip time is over 400 ms in 3 of the last 5 samples
- high-jitter when jitter is over 30 ms in 3 of the last 5 samples
- low-mos when MOS is under 3.5 in 3 of the last 5 samples
- high-packet-loss when loss is over 1 percent in 3 of the last 5 samples
On the page, keep the raw samples in memory and show a small live readout. At the end, reduce them to a summary.
The row you store
One Supabase row per test call. Example values, not real results:
- call SID: CA51e0 (shortened example)
- tester: tester-ayesha
- tester location: Lahore, home fibre
- edge requested: roaming
- edge connected: singapore
- script: booking script v3
- duration: 94 seconds
- samples: 93
- RTT median: 210 ms
- RTT highest: 480 ms
- jitter median: 6 ms
- packets lost total: 14
- MOS median: 4.2
- warnings raised: high-rtt once, cleared after 6 seconds
- tester's felt delay, 1 to 5: 3
- notes: agent paused before quoting a price
Store the call SID so you can line the row up with the agent's own logs for the same call. That join is the whole point.
Turn on row level security for the table and let only signed-in team members insert and read. Testers' locations and notes are still personal data.
Reading the results
Two invented test calls, to show the reasoning.
Call A. RTT median 190 ms, no warnings, MOS 4.3. Tester still rates the delay 4 out of 5, very slow. The agent's logs for the same call SID show long gaps between the end of speech and the first audio sent. The network is fine. Look at endpointing, model time to first token, and speech synthesis.
Call B. RTT median 420 ms, high-rtt raised three times, jitter warnings during the second half. The agent's own processing looks the same as in call A. Here the path between the tester and Twilio is the problem. Try a different edge, a different network, or check whether the tester was on a VPN.
The page doesn't tell you how to fix the agent. It tells you which team should look first.
Mobile, briefly
The same idea works in a mobile app. Twilio's native Voice SDKs for iOS and Android also connect to edges and report call quality. Packages that wrap them for Flutter exist, but check which SDK versions they wrap and whether they expose the stats you need before planning a Flutter version of this page.
Limitations
- A browser call is a WebRTC call over the internet. The SDK's codec preference list defaults to PCMU first, then Opus, and you can change it. A phone call instead goes through a carrier network before it reaches Twilio. That carrier leg can add delay this page never sees, so treat browser numbers as a best case.
- RTT here is the round trip between the browser and Twilio's edge. It says nothing about the hop from Twilio to your agent's servers, or about processing time.
- Audio levels arrive once a second. That is too coarse to measure the exact pause between the tester's last word and the agent's first word. Use recordings of both sides for that.
- Signaling reconnection and edge fallback can change the edge mid-test. Twilio documents that a lost signaling connection can only be resumed on the original edge, and that the call drops if the device reconnects elsewhere. Check the SDK's signaling timeout option and log edge changes.
Takeaways
- Separate "the network is slow" from "the agent is slow" before tuning anything.
- A small internal Next.js page with the Voice JavaScript SDK makes that repeatable.
- Choose the edge deliberately and record both the requested and connected edge.
- Store a per-call summary with the call SID so it joins against agent logs.
- Treat browser results as a lower bound for real phone calls.
Network is one slice of the delay budget. For the rest, including streaming, endpointing and where each service runs, this Twilio voice latency guide is worth a read alongside your test results.


