can you tell me what is causing this media timeout...
# ask-ai
b
can you tell me what is causing this media timeout and status error
t
Thanks for reaching out, Hemanth. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The media timeout and status error in your call log can occur due to several reasons: • Media Stream Failures: This happens when the media stream fails or times out during the call. It is classified under the 'MEDIA_FAILURE' disconnect reason (code 15). • Connection Timeouts: The server may time out a participant session, leading to a 'CONNECTION_TIMEOUT' (code 14). • Firewall and NAT Issues: Firewalls or NAT devices might block UDP packets or DTLS traffic, causing media connectivity issues. • UDP Connectivity Problems: If UDP traffic or unknown ports are blocked, media timeouts can occur even if the initial connection succeeds. • API-Level Timeouts: Timeouts at the API level can also contribute to these errors, especially if requests take too long to process. To resolve this issue, you can: 1. Check your network configuration to ensure that UDP traffic and DTLS+SRTP processes are not being blocked by firewalls or NAT devices. 2. Verify that the server handling the media is operational and not experiencing high traffic or downtime. 3. Review the application or service configuration to ensure it is set up correctly. 4. Ensure that the devices and browsers being used are compatible with the media format and protocols. If the issue persists after these checks, further investigation into the specific call session details may be required. Sources: Firewall Tips | livekit-plugins/livekit-plugins-inworld/livekit/plugins/inworld/tts.py | Sources/LiveKit/Protos/livekit_models.pb.swift | livekit/livekit_sip.pb.go | pkg/sip/outbound.go
b
2025-07-31 104530,467 - DEBUG livekit.agents - start reading stream {"participant": "sip_+9xxxxx2", "source": "SOURCE_MICROPHONE", "pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104530,489 - DEBUG livekit.agents - using audio io:
RoomIO
->
AgentSession
->
TranscriptSynchronizer
->
RoomIO
{"pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104530,489 - DEBUG livekit.agents - using transcript io:
AgentSession
->
TranscriptSynchronizer
->
RoomIO
{"pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104532,288 - WARNING livekit.plugins.silero - inference is slower than realtime {"delay": 0.4427050259776879, "pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104600,784 - INFO livekit.agents - closing agent session due to participant disconnect (disable via
RoomInputOptions.close_on_disconnect=False
) {"participant": "sip_+97xxxxxx2", "reason": "CLIENT_INITIATED", "pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104600,798 - DEBUG livekit.agents - stream closed {"participant": "sip_+97xxxxx2", "source": "SOURCE_MICROPHONE", "pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104600,820 - DEBUG livekit.agents - session closed {"reason": "participant_disconnected", "error": null, "pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} Traceback (most recent call last): File "/hyperai/venv/lib/python3.12/site-packages/awscrt/http.py", line 242, in _on_body self._on_body_cb(http_stream=self, chunk=chunk) File "/hyperai/venv/lib/python3.12/site-packages/amazon_transcribe/httpsession.py", line 100, in _on_body future.set_result(chunk) File "/usr/lib/python3.12/concurrent/futures/_base.py", line 544, in set_result raise InvalidStateError('{}: {!r}'.format(self._state, self)) concurrent.futures._base.InvalidStateError: CANCELLED: <Future at 0x7f70696f8fe0 state=cancelled> Treating Python exception as error 3(AWS_ERROR_UNKNOWN) 2025-07-31 104610,800 - DEBUG livekit.agents - http_session(): creating a new httpclient ctx {"pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104611,048 - INFO livekit.agents - process exiting {"reason": "", "pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104611,048 - DEBUG livekit.agents - shutting down job task {"reason": "", "user_initiated": false, "pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104611,056 - DEBUG livekit.agents - http_session(): closing the httpclient ctx {"pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 104611,057 - ERROR asyncio - Task exception was never retrieved future: <Task finished name='Task-230' coro=<RoomService.delete_room() done, defined at /hyperai/venv/lib/python3.12/site-packages/livekit/api/room_service.py:98> exception=ServerDisconnectedError('Server disconnected')> Traceback (most recent call last): File "/hyperai/venv/lib/python3.12/site-packages/livekit/api/room_service.py", line 108, in delete_room return await self._client.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/hyperai/venv/lib/python3.12/site-packages/livekit/api/twirp_client.py", line 121, in request async with self._session.post( File "/hyperai/venv/lib/python3.12/site-packages/aiohttp/client.py", line 1488, in aenter self._resp: _RetType = await self._coro ^^^^^^^^^^^^^^^^ File "/hyperai/venv/lib/python3.12/site-packages/aiohttp/client.py", line 770, in _request resp = await handler(req) ^^^^^^^^^^^^^^^^^^ File "/hyperai/venv/lib/python3.12/site-packages/aiohttp/client.py", line 748, in _connect_and_send_request await resp.start(conn) File "/hyperai/venv/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 532, in start message, payload = await protocol.read() # type: ignore[union-attr] ^^^^^^^^^^^^^^^^^^^^^ File "/hyperai/venv/lib/python3.12/site-packages/aiohttp/streams.py", line 672, in read await self._waiter aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected {"pid": 19338, "job_id": "AJ_DvLdw3BKk9wR"} 2025-07-31 105148,165 - INFO livekit.agents - received job request {"job_id": "AJ_VKoct8XzDQU7", "dispatch_id": "", "room_name": "call-_+9xxxxxx2_ZMQGxaG8GVVR", "agent_name": "test-connect", "resuming": false}" these are the logs
t
Thanks for sharing the logs! They show a mix of media timeout and server disconnection errors. Let’s break down the main points and some steps you can try to get things running smoothly: • Media Timeout: This usually happens when the media stream drops or times out during the call. It might be due to network hiccups, firewall blocks, or NAT settings. • Server Disconnected Error: This means the server unexpectedly cut off the connection, which could be from high latency, too much server load, or network interruptions. • Inference Delay: The warning about inference being slower than real-time points to possible performance slowdowns on the processing side. Here are some troubleshooting tips to try out: 1. Check Your Network Setup: Make sure UDP traffic and DTLS+SRTP aren’t getting blocked by firewalls or NAT devices. If needed, whitelist
*.turn.livekit.cloud
. 2. Force TURN Usage: To work around firewall issues, you can set the client to use TURN servers only by adding:
connectOpts.rtcConfig = { iceTransportPolicy: 'relay' };
3. Keep an Eye on Server Performance: Check that the media server isn’t overloaded or running low on resources. 4. Check Connection Stages: Use the LiveKit Connection Tester to spot where ICE or DTLS might be failing. 5. Boost Device Performance: Look into any performance slowdowns on your device or app, especially if you’re seeing those inference delays. If you’re still running into issues, it might help to dig deeper into the specific call session and server logs to find the exact cause. I’m here if you want to chat more about it! Sources: protobufs/livekit_models.proto | livekit-rtc/livekit/rtc/_proto/participant_pb2.pyi | Firewall Tips | Connecting to LiveKit | LiveKit Docs