why telephony (outbound call SIP) agent has more l...
# ask-ai
f
why telephony (outbound call SIP) agent has more latency then web call agent? In my experience telephony (outbound call SIP) agent has ~2-3 seconds latency where web call agent has ~1-2 seconds latency? Is it because of us number from twilio?
t
Thanks for reaching out, Snehal. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about why outbound telephony (SIP/PSTN) agents show ~2–3 s latency vs. ~1–2 s for web calls, and whether a US Twilio number is the cause. Short answer • The higher latency for SIP/PSTN calls is not just because the phone number is US-based. It’s caused by extra network and gateway processing when bridging WebRTC to the PSTN. Those additional hops and conversions commonly add 1+ seconds of delay, so 2–3 seconds for SIP outbound is expected compared to web calls. Why SIP/PSTN calls are slower (key causes) • Extra network hops: WebRTC calls can travel directly over LiveKit’s optimized paths. SIP/PSTN calls go LiveKit → SIP provider (e.g., Twilio) → PSTN → endpoint, and each hop adds round-trip time and potential jitter. • Gateway processing & transcoding: SIP/PSTN bridges often transcode audio and translate signaling (SIP ↔️ PSTN protocols). That processing adds latency. • Provider geography and routing: The SIP provider’s carrier endpoints or PSTN routing may be in different regions or take less direct physical routes, increasing propagation time. • Provider queuing/load: The SIP provider can introduce variable queuing or processing delays during high load. • Legacy network characteristics: PSTN paths (landlines, some mobile carriers) can have longer physical and switching delays than IP-native streams. Why the US number itself isn’t the primary cause • The problem is the bridging architecture and extra intermediary (the SIP/PSTN provider), not inherently that the number is US-based. Even a US number can be low-latency if the whole media path is optimized and minimal hops exist; conversely, a nearby number won’t avoid gateway/transcoding overhead. Practical ways to reduce latency • Use LiveKit Phone Numbers where possible — they remove an extra third-party SIP trunk hop and can reduce end-to-end latency. • Co-locate services: Ensure STT, TTS, agent logic, and LiveKit components are in the same region to minimize internal network latency. • Provision capacity for inference/processing: Use provisioned inference or fixed-capacity setups so model invocation and TTS are predictable and avoid public endpoint throttling. • Evaluate SIP provider/region: If you must use a third-party SIP trunk, test providers and POP locations to find lower-latency routes. • Measure and compare: Capture end-to-end timing (timestamps at key points: capture, send to LiveKit, handoff to SIP provider, PSTN ring/answer) to pinpoint where the extra seconds occur. If you want, I can help next with: • A short checklist and commands to measure where the extra latency is introduced in your current calls. • Comparing latency using a LiveKit Phone Number vs. your Twilio SIP route (if you can share test call results or regions used). • Guidance on how to co-locate your STT/LLM/TTS and LiveKit deployment. Which of those would be most helpful to you next? Sources: Introducing LiveKit Phone Numbers: zero to ringing in 60 seconds | sip | livekit/livekit_composite | DeepWiki | Introducing LiveKit Inference: A unified model interface for voice AI | Building Performant Voice Agents in India | LiveKit
f
What can i do to decrease latency in telephony agent? I am doing outbound call from twilio (US number) to india?
t
Thanks — I’m responding to your question about lowering latency for outbound telephony (Twilio US number → India). Below are targeted, practical steps you can take and a couple of quick diagnostics to pinpoint where latency is coming from. Quick summary • The biggest contributors are extra network hops (LiveKit → Twilio → PSTN → India endpoint), carrier routing, and gateway/transcoding by the SIP/PSTN provider. • You can reduce latency by removing intermediaries, co-locating services, choosing lower-latency carrier routes, and measuring where delays occur. Actionable steps to reduce latency 1. Reduce intermediary hops • Use LiveKit Phone Numbers (if available to you) instead of routing through Twilio SIP trunks. This removes a third-party SIP trunk hop and often lowers end-to-end delay. 1. Co-locate services and agents • Host your STT, TTS, and agent logic in the same region as your LiveKit deployment. For calls to India, consider using a region geographically closer to India (if LiveKit offers a South Asia region) or the region that minimizes round-trips to Twilio’s media egress. • Ensure your application server and media processing are in the same cloud region to avoid cross-region network hops. 1. Optimize the SIP provider path • Ask Twilio (or review their docs/console) for the media egress POPs used for calls to India and choose a provider or configuration that uses POPs closer to India. • If Twilio offers direct media anchoring or control over media region, select the region closest to the destination to shorten the PSTN leg. 1. Minimize transcoding and codec negotiation • Use a single high-quality codec end-to-end where possible (e.g., Opus) to avoid extra transcoding steps. • Configure your SIP trunk and Twilio settings to favor codecs that avoid server-side transcoding. 1. Provision capacity and prefer low-latency endpoints • Use provisioned inference or dedicated capacity for STT/TTS/LLM so model and TTS latency is stable and predictable. • Avoid routing audio through public SaaS endpoints that can add variable processing delay. 1. Tune RTP and network settings • Enable and tune jitter buffers conservatively (too large buffers add latency; too small cause packet loss). • Use QoS tagging on your network to prioritize real-time media if you control the network path to the media gateway. 1. Select better carrier routes for PSTN • Some carriers and routes into India are lower-latency than others. Compare carriers (or Twilio’s carrier choices) and test routes to find the fastest path. • If you regularly call the same destinations, provision direct SIP trunks or carrier interconnects that target lower-latency routes into India. 1. Reduce application-side processing • Batch or streamline any server-side audio processing before sending audio to the SIP gateway. • Keep voice activity detection (VAD), noise suppression, and any server-side audio transforms as lightweight as possible. Diagnostics to identify where latency is introduced 1. Timestamp checkpoints • Add timestamps at these points and compare: a. Audio capture at caller b. Arrival at LiveKit (or your app server) c. Handoff to Twilio SIP trunk (SIP INVITE/ACK times) d. Twilio media egress / PSTN answer e. Audio arrival at callee in India • This isolates whether the bulk of delay is before/after handing off to Twilio. 1. Run controlled tests • Place test calls from the same Twilio number to: ◦ A local US mobile number ◦ A phone in India ◦ A web (WebRTC) participant in the same region as your agent • Compare end-to-end latencies to see how much the PSTN leg to India adds. 1. Measure round-trip times and packet loss • Capture RTP stats (RTT, jitter, packet loss) on both sides if possible. High RTT/jitter on the Twilio → PSTN leg will point to carrier/PSTN issues. What I can help with next • If you share: the LiveKit region you’re using, whether you can switch to LiveKit Phone Numbers, and any STT/TTS providers/regions, I can give a prioritized checklist specific to your setup. • I can also provide a simple timestamping test plan you can run and the exact places to capture timing data. Which would you like to try first — a test checklist to measure where time is lost, or recommendations prioritized for your current region/setup?