I connected a LiveKit agent with a sip trunk to a ...
# ask-ai
d
I connected a LiveKit agent with a sip trunk to a telephony system. I am facing random "media timeout" issues and I can't figure them out
t
Thanks for reaching out, Abdallah. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To address the random "media timeout" issues you're experiencing with your SIP trunk integration, here are some systematic troubleshooting steps: 1. Network Connectivity Diagnostics • Ensure UDP ports 10000-20000 are open for RTP media. • Verify SIP signaling ports (5060/5061) are accessible. • Check for firewall or NAT issues, such as blocked UDP traffic or improper NAT traversal settings. • Ensure DTLS traffic is not being filtered by firewalls. 2. Configuration Review • Review and adjust media timeout settings in your configuration: • Enable jitter buffer for audio stability in networks with variable latency. • Ensure media encryption settings are compatible between LiveKit and your SIP trunk. 3. SIP Trunk Specific Diagnostics • Verify SIP trunk credentials and authentication methods. • Check for proper SIP response codes and call flow completion. • Monitor for any SIP protocol failures that might affect media setup. 4. Monitoring and Logging • Monitor RTP packet flow and timing to check for packet loss or irregular intervals. • Track media timeout occurrences in relation to call states (e.g., dialing, ringing, active). • Enable detailed logging for media and SIP components to identify patterns. 5. Environmental Factors • Test during different times of day to identify network congestion patterns. • Evaluate network stability and consistency. • Check server resource utilization during timeout events and monitor concurrent call volumes. Immediate Actions • Temporarily increase timeout values to determine if timing is the primary issue. • Enable detailed logging for media and SIP components. • Test with a simplified configuration (e.g., disable encryption). • Use LiveKit's connection tester tools to validate connectivity. These steps should help identify and resolve the root cause of the media timeout issues. If the problem persists after following these recommendations, further investigation may be required. Sources: livekit/livekit_models.pb.go | pkg/sip/outbound.go | SIP Integration | livekit/livekit_composite | DeepWiki | Firewall Tips
d
I can't do most of the things here since I used LiveKit Cloud
t
Hey there! Having trouble with media timeouts on LiveKit Cloud? No worries, I've got some friendly tips to help you troubleshoot. 1. Network Connectivity • Let's make sure your network is playing nice. If you're behind a firewall, you might want to set up TURN relay mode to keep things smooth. • Do a quick check and whitelist
*.turn.livekit.cloud
on TCP/443 so your TURN servers can do their job. • Take a peek at any firewalls that might be blocking UDP or DTLS traffic - these are super important for sending media. 2. Media Timeout Configuration • Sometimes the default timeout settings can be a bit too quick. Try extending the initial timeout (usually 30 seconds) and ongoing timeout (usually 15 seconds) to give your network some breathing room. 3. Diagnostic Tools • The LiveKit Connection Tester is your friend here - it'll help you spot any UDP or DTLS hiccups. • Keep an eye on those call logs for
MEDIA_FAILURE
disconnect reasons to figure out what's causing the timeouts. 4. SIP Trunk Configuration • Double-check that your SIP trunk dispatch rules are set up correctly for media traffic. • Make sure your codecs are speaking the same language between the SIP trunk and LiveKit. 5. Environmental Adjustments • Turning on jitter buffering can help smooth out any packet loss or network speed bumps. • If UDP is giving you trouble, switching to TCP might be your best bet. These tips are specifically for LiveKit Cloud and should help you tackle those media timeout issues. If you're still scratching your head, we might need to dig a bit deeper into your specific setup. But don't worry, we'll get it sorted! Sources: pkg/sip/outbound.go | Firewall Tips | SIP Integration | livekit/livekit_composite | DeepWiki | protobufs/livekit_models.proto