got `media-timeout` on sip call, what does it mean
# ask-ai
b
got
media-timeout
on sip call, what does it mean
t
Thanks for reaching out, Jura. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Let's talk about the
media-timeout
in SIP calls—it happens when no media packets (like audio) are received for a certain period. This is a helpful feature that makes sure calls don’t stay open forever if one side stops sending media, which can sometimes happen due to network hiccups or configuration issues. By default, the timeout durations are set to: • Initial timeout: 30 seconds, which applies right when the call starts. • General timeout: 15 seconds, which kicks in after the first media packet is received. You can customize these settings either in the SIP configuration file or programmatically during the call. If a timeout does happen, the call might disconnect, and you could see a
MEDIA_FAILURE
reason. If you’d like, I’m here to help you adjust these settings or walk you through any troubleshooting steps. Just let me know! Sources: pkg/config/config.go | lib/src/proto/livekit_models.pbenum.dart | livekit/livekit_sip.pb.go | Understanding the STATE_MISMATCH Disconnect Reason
b
i'm using asterisk server and having rtp port open at this amount
Copy code
rtpstart=10000
rtpend=10200
does it related?
t
Thanks for sharing the details about your RTP port range configuration on your Asterisk server (like
rtpstart=10000
and
rtpend=10200
). This setup controls the ports used for your media streams. While it’s not directly tied to the
media-timeout
feature in LiveKit SIP, sometimes blocked ports or mismatched settings can lead to media delivery hiccups, which might cause those timeouts you’re seeing. Could you let me know if you’re facing any media delivery issues, or if you think the port range could be behind the timeout? Understanding this will really help me guide you better and find the right solution together. Sources: Ports and firewall | LiveKit docs | README.md
b
it's like when the agent speaking a long sentence, say 15 seconds, the session got cut out. and i got this error later on on the dashboard
t
I understand how frustrating it can be when your session disconnects during long sentences. This usually happens because of the
media-timeout
mechanism, which kicks in when no RTP packets are received for a certain period—often during extended silence or speech without transmitted audio packets. Here are a few friendly suggestions to help you resolve this: • Enable Comfort Noise (RFC 3389): Try configuring your SIP endpoints to send comfort noise packets during silent moments. This helps keep the media path active even when there’s no audio being transmitted. • Increase Media Timeout: You might want to adjust the
MediaTimeout
and
MediaTimeoutInitial
settings in your LiveKit SIP configuration to allow for longer silent intervals. For instance, increasing the timeout from 15 seconds to 30 seconds can make a big difference. • Application-Level Monitoring: Consider adding silence detection in your application to manage longer pauses smoothly—this could involve injecting artificial audio packets or disconnecting intentionally after a certain threshold. To get you back on track quickly, increasing the media timeout is usually the easiest fix. Please feel free to reach out if you’d like some help configuring these settings or if you have any other questions—I’m here to support you! Sources: test/lktest/sip.go | Knowledge Base Content | livekit/livekit_composite | DeepWiki | Operational Best Practices | livekit/livekit_composite | DeepWiki
b
how to
Increase Media Timeout
?
t
I'm happy to help you with increasing the media timeout in LiveKit SIP! You can easily adjust this by changing the
MediaTimeout
and
MediaTimeoutInitial
values in your SIP configuration file. Here's a quick example:
Copy code
media_timeout: 20s
media_timeout_initial: 40s
These settings determine how long the system waits for media packets before timing out. Specifically,
media_timeout_initial
is used during the call setup phase, while
media_timeout
takes effect afterward. Just update these values in your configuration file and restart the SIP service to apply the changes. If you run into any questions or need a hand with this, please don’t hesitate to reach out—I’m here to support you! Sources: pkg/sip/media_port_test.go
b
i'm using livekit cloud, is there a way to adjust
media_timeout
,
media_timeout_initial
?
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!