I am using telnyx SIP with Live kit and having cou...
# ask-ai
b
I am using telnyx SIP with Live kit and having couple of issues. Like the voice is dropping during teh call and caller says I am not able to hear you !
t
Thanks for reaching out, Waleed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m sorry you’re hitting dropped audio and one-way audio with your Telnyx SIP + LiveKit setup. I can help diagnose this, but I need a few details to narrow the cause. Could you share the following? • Which LiveKit client/SDK and platform (Web, iOS, Android, or server) are you using and versions. • LiveKit server version (or whether you’re using LiveKit Cloud). • Telnyx SIP setup details: SIP trunk vs SIP registration, codec(s) configured (e.g., opus, PCMU), and RTP/RTCP transport (UDP/TCP/TLS). • Are calls routed through a TURN server? If so, TURN provider and whether clients are successfully allocating relays. • Symptoms timing: Does audio drop after a consistent time (e.g., 30s), immediately, or intermittently? • Is the “I can’t hear you” problem one-way (only caller can’t hear) or both directions sometimes? • Any console logs, LiveKit server logs, or Telnyx call logs/errors you can paste (redact sensitive tokens). • Network conditions: client network types (Wi‑Fi, cellular), NAT types, packet loss/latency stats if known. • Reproduction steps and whether the issue happens between specific endpoints (e.g., all callers, only Telnyx PSTN callers, or only when both sides are on certain networks). With those details I’ll suggest targeted checks and fixes (codec negotiation, TURN, NAT keepalives, SRTP/RTP settings, and relevant log diagnostics). If you prefer, paste a short sample log and I’ll highlight the likely cause. , with interactive elements
b
I have everything I need. Here are the answers: Stack & Setup 1. LiveKit client/SDK and platform/versions Server-side Python agent (no browser/mobile clients — calls are PSTN-bound through SIP): PackageVersion`livekit` (core SDK)*1.1.5*`livekit-agents`*1.5.6*`livekit-api`*1.1.0*`livekit-plugins-cartesia`1.5.6`livekit-plugins-deepgram`1.5.6`livekit-plugins-inworld`1.5.6`livekit-plugins-openai`1.5.6 The agent runs in a Docker container (
evolv-livekit-agent
) and dispatches SIP participants. There is no end-user browser client — only PSTN call legs via Telnyx/Twilio. 2. LiveKit server version / Cloud LiveKit Cloud —
<wss://sdr.livekit.cloud>
(managed, no self-hosted server version to report). 3. Telnyx SIP setup SettingValue*Architecture*SIP trunk (outbound from LiveKit → Telnyx → PSTN). Not registration.*Auth model*Telnyx Credential Connection (username/password, configurable IP allow-list)*TransportTLS* (SIP over TLS —
<http://sip.telnyx.com:5061|sip.telnyx.com:5061>
for 913 trunk,
:5062
for 512 trunk)*EncryptionSRTP* (media encryption set to
required
on both outbound trunks)*DTMF*RFC 2833*CodecsNot explicitly negotiated by us* — relies on default Telnyx ↔️ LiveKit Cloud negotiation. Typical: G.711 μ-law (PCMU) for PSTN leg, Opus on the LiveKit room side. We don't pin a codec list.*Connection ID*`2852164282819282926`*Telnyx trunks active*`Telnyx - LiveKit`,
Telnyx 913-Kansas
, `Telnyx 512-Texas`*RTCP*Enabled with
port: rtp+1
,
report_frequency_secs: 5
4. TURN server No application-layer TURN. Audio flows:
Copy code
Telnyx (PSTN gateway) ←SIP/TLS+SRTP→ LiveKit Cloud SIP service ←WebRTC→ LiveKit room (server-side agent)
The agent process is server-side, not behind NAT. There is no browser/mobile client allocating ICE/TURN relays. LiveKit Cloud handles its own internal TURN/relay if needed. 5. Symptoms timing We've not been actively diagnosing audio drops on this stack — recent issues we've worked were: • *Bot-talks-past-interruption*(Pipecat path, race condition between LLM streaming and user barge-in) — fixed • *VAD bouncing within single utterance*— fixed • *Cartesia speed/emotion silently dropped*unless model is`sonic-2-2025-03-07`— fixed • *AMD false-positive voicemails*on Pipecat — disabled AMD entirely • *TimeoutError webhooks*intermittent on LiveKit-agent — pending If you're seeing audio drops on a particular call, give me the call_id or to_number and I can pull SIP logs from Telnyx + LiveKit-agent's frame-level debug output for that session. 6. One-way vs both-way audio Not currently a known issue in our system. We haven't received "I can't hear you" reports recently. The symptom we DID see (in the Bentley/Tiffany call and the +14795537076 callback you just looked at) was the bot cutting itself off mid-sentence and ending the call — that's an LLM/race-condition issue, not an RTP audio-path issue. 7. Logs to paste Most useful logs by symptom: SymptomLog sourceFilterSIP connect fail`docker logs evolv-livekit-agent``grep -E 'SIP\Audio one-wayLiveKit Cloud dashboard → SIP → Outbound Trunk → call detail(LiveKit Cloud only — SIP frame stats)Codec issueTelnyx portal → Calls → SIP → SDP details(Telnyx side)Bot misbehavior`docker logs evolv-livekit-agent``grep -E 'AJ_ I've redacted secrets above. Live keys are in
/root/evolv-ai-sdr-platform/.env
if you need them. 8. Network conditions • Server side: AWS EC2 Virginia (100.51.116.55) — wired, no NAT issues, stable. Server-to-LiveKit-Cloud is the only "client" connection and it's all server-side. • PSTN side: Whatever the contact's carrier provides (residential/business landlines, mobile carriers). We have no visibility into NAT type or packet loss on the contact's network — only what Telnyx reports back via SIP. 9. Reproduction We haven't seen consistent reproducible audio failures. Failures we DO see are: • *Bot prematurely ending calls*(logged as`outcome=not_interested`after partial sentences) —`+13167961799`(Bentley) and`+14795537076`(Botanical) examples • *No-answer / busy*— normal PSTN behavior, varies per contact • *Voicemail false-positives on instant hangup*— was a problem in older Twilio AMD config; addressed
t
Thanks — this is very helpful detail. I’ll walk through targeted checks based on what you shared and request the minimal logs I need to pinpoint the problem. Quick acknowledgement: you’re using a server-side Python agent (no browser clients) with LiveKit Cloud + Telnyx SIP trunks (TLS + SRTP required), no TURN on your side, and symptoms are intermittent audio drops and the bot cutting off mid-sentence. I’ll focus on RTP/SRTP, codec negotiation, and keepalive/NAT timing since those are the likely culprits for drops/one-way audio in this topology. Please provide this next item for a single impacted call (pick one recent call_id or to_number and timestamp): • LiveKit Cloud SIP frame stats for that call (LiveKit Cloud SIP → Outbound Trunk → call detail). If you can’t pull the UI, paste the SIP SDP and RTP stats Telnyx shows for that call. • The Telnyx call detail / SIP INVITE/200OK/ACK SDP exchange for that call (redact credentials). • The livekit-agent debug segment for that session (the agent logs around the call start, SDP negotiation, and when audio drops). A ~30–60 second slice is ideal. With those I’ll check: • Codec mismatch or mid-call codec renegotiation (Opus ↔️ PCMU fallback issues). • SRTP setup/crypto-suite mismatch (Telnyx requires SRTP required; confirm LiveKit Cloud offered SRTP suite matches Telnyx). • RTP/RTCP packet counters and sequence/timestamp gaps indicating packet loss or pause. • RTCP interval and report feedback (you set report_frequency_secs: 5 — verify RTCP reports continue after drop). • Any SIP BYE/487/408 or session-timers that could be terminating the call prematurely. If you prefer, paste the call_id and I’ll list the exact log lines to copy from each system. Otherwise, send the three items above and I’ll analyze them and return concrete next steps (config changes or specific fixes). , with interactive elements
b
OK — same Twilio account, the call should be findable. But before I keep digging, you want to know what to safely paste in a public AI chat for this support diagnosis. Let me prioritize that. 📋 What to share in the public chat (safe, redacted) Here's the package — copy/paste this. All credentials redacted. Stack • *LiveKit Cloud*(managed) — agents SDK Python`1.5.6`, livekit core`1.1.5` • *Server-side Python agent*only (no browser/mobile clients) • *Telnyx + Twilio SIP trunks*outbound (TLS transport, SRTP`required`) • *No TURN on our side*— server-to-LiveKit-Cloud server-to-server • For this call:*Twilio*trunk was used (
sip:<http://vsdr3.pstn.twilio.com|vsdr3.pstn.twilio.com>
), not Telnyx One impacted call • Internal call ID:`0779fbbb-930f-46a9-9dcc-c9aa61d4df76` • LiveKit room:`RM_aR2UzQSy68QK` • LiveKit SIP participant ID:`SCL_Hz7wdimea5xj` • Twilio CallSid: not yet pulled (LiveKit Cloud doesn't expose it directly to the agent) • Time: 2026-05-06 002408 UTC • Duration: 96s • Outbound trunk LiveKit ID:`ST_Fdf8RSMim3D3` • Symptom: bot cut itself off mid-sentence ("What time works best for...") then said "Thanks for your time, have a great day!" and hung up — user explicitly asked for a callback. Audio was bidirectional (no one-way), the issue is application-level, not RTP. LiveKit-agent debug slice (anomalies)
Copy code
00:24:09.347  [plugin-hybrid] TTS=inworld model=inworld-tts-1.5-mini
00:24:09.823  TRACK SUBSCRIBED from SIP
00:24:10.442  Recording started
00:24:12.824  [plugin-hybrid] TTS=inworld           ← second init for SAME call
00:24:13.236  TRACK SUBSCRIBED from SIP             ← second track
00:24:13.845  Recording started                     ← second recording
00:24:16.492  [plugin-hybrid] TTS=inworld           ← third init
00:24:16.958  TRACK SUBSCRIBED from SIP             ← third track
00:24:17.635  Recording started                     ← third recording
00:24:17.686  Room disconnected: 10                 ← DUPLICATE_IDENTITY (reason 10)
00:24:29.664  Room disconnected: 10                 ← again

[mid-call - LLM and TTS turns]

00:25:30.356  WARNING entrypoint did not exit in time
00:25:30.361  process exiting
00:25:32.828  using preemptive generation
00:25:32.956  Turn #31: 180ms | "is there..."
00:25:33.300  WARNING Webhook error (TimeoutError):       ← backend webhook timeout
00:25:34.325  Turn #35: 500ms | "is there..."
00:25:34.326  WARNING _SegmentSynchronizerImpl.on_play... ← TTS segment desync
00:25:36.157  Turn #36: 1326ms | "is there..."
00:25:39.410  Participant disconnected
00:25:39.752  Turn #38: 940ms | "Alright. Thank..."  ← bot says final farewell
Observed issues (likely root causes — NOT codec/SRTP) 1. *Multiple agent processes attaching to the same room*in the first 8s. Three`TRACK SUBSCRIBED from SIP`+ three`Recording started`events for one SIP leg. This explains the`Room disconnected: 10`(DUPLICATE_IDENTITY) events — agents are ejecting each other. 2. *Backend webhook `TimeoutError`*at 002533 — agent's status webhook to backend timed out, possibly causing partial LLM context. 3. *`_SegmentSynchronizerImpl.on_play...`*warning indicates*TTS segment timing drift*in livekit-agents — the agent's TTS scheduler couldn't sync the next audio segment. Likely related to a race between Inworld TTS WebSocket and the agent's interruption handling. 4. *`using preemptive generation`*— pipeline started a new LLM completion before the previous one fully completed, which is the proximate cause of the bot's "What time works best for..." being cut off by "Thanks for your time" — two competing LLM responses. What we'd ask experts to weigh in on 1. Should we be running with`enable_recording: false`AND we're seeing 3x recording-started — is this a`livekit-agents 1.5.6`known issue? 2. Why is`Room disconnected: 10`(DUPLICATE_IDENTITY) firing 2x mid-call when only one agent should be dispatched per room? Is`agent_name="Drew-38b"`colliding due to non-unique participant identity? 3. The`_SegmentSynchronizerImpl.on_play`+`using preemptive generation`warnings — can these cause the bot to overlap two LLM responses, with the second one truncating the first mid-TTS? 4. Inworld plugin (
livekit-plugins-inworld 1.5.6
) — known issue:`Context not found during streaming`errors mid-TTS that cause partial-segment cutoffs? SDP / RTP / SRTP Not pulled yet — happy to pull them but the symptom doesn't match an RTP/SRTP issue. Audio was bidirectional throughout (transcript shows back-and-forth). The bot's premature ending is application-layer (LLM + TTS plugin scheduler), not media-plane. If you still want SDP and RTP counters anyway: • LiveKit Cloud SIP detail UI: navigate to project`sdr-evolv-3iql8wce`→ SIP → Outbound Trunks → trunk`ST_Fdf8RSMim3D3`→ call`SCL_Hz7wdimea5xj`(I can't pull this via API; it's dashboard-only) • Twilio SIP traces:https://console.twilio.com→ Voice → Logs → Calls → filter by`+19134041274`→`+14795537076`between 0024 0026 UTC May 6
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!