millions-dog-30135
12/09/2025, 8:06 PMtall-airline-16756
12/09/2025, 8:06 PMtall-airline-16756
12/09/2025, 8:06 PMlead_id, first_name, last_name, etc.
◦ If you control the dispatch code or CLI, verify the metadata payload actually contains those fields before the request is sent.
1. Ensure the agent reads metadata on start
◦ In the agent entrypoint, parse the job metadata (for example json.loads(ctx.job.metadata)) and map the fields into the CALL_START payload so they appear in logs.
1. Prevent early disconnects (15s)
◦ Check whether silence detection is active. If so, raise the SILENCE_THRESHOLD or play an immediate greeting prompt on connect so the session isn’t treated as silent.
◦ Confirm the agent successfully connects and publishes an audio track right after join. If media is not published, the system may treat the call as inactive.
◦ Review disconnect logs for a STATE_MISMATCH or timeout reason which indicates media/connection sync problems.
Questions to narrow this down
• How are you dispatching the job (API code, CLI, or another system)? Share the dispatch snippet that sets metadata (redact secrets).
• Does your agent entrypoint currently parse ctx.job.metadata and forward those fields into the call payload?
• Do server logs show a disconnect reason (e.g., STATE_MISMATCH, silence timeout, or ICE failure)?
If you send the dispatch metadata snippet and the agent entrypoint code that handles ctx.job.metadata, I’ll point out the exact place to fix so lead fields appear and advise the best setting to prevent 15s disconnects.
Sources: Job lifecycle | LiveKit docs | Agents telephony integration | LiveKit docs | examples/frontdesk | livekit/livekit_composite | DeepWiki | Understanding the STATE_MISMATCH Disconnect Reasonmillions-dog-30135
12/09/2025, 8:08 PMtall-airline-16756
12/09/2025, 8:08 PMlead_id or first_name) do not automatically cause the agent to ignore user input or force a 15‑second disconnect.
What is likely happening
• The 15s disconnect is usually caused by silence detection or the media/connection not being established (no published audio track, ICE/keep‑alive failures, or a configured silence threshold that closes inactive calls).
• Lead metadata is optional. If it's empty, the agent may simply have no caller info to log/display, but it should still accept audio and continue the call.
What to check now
• Confirm the client actually publishes an audio track immediately after join.
• Check disconnect logs for a reason (e.g., silence timeout, STATE_MISMATCH, ICE failure).
• If silence detection is enabled, either increase SILENCE_THRESHOLD or play an immediate greeting prompt when the call connects so the session isn't treated as silent.
If you want, paste:
• the dispatch metadata snippet you send (redact secrets), and
• the agent entrypoint code that reads ctx.job.metadata and handles publishing audio —
and I’ll point out any specific fixes.millions-dog-30135
12/09/2025, 8:10 PMtall-airline-16756
12/09/2025, 8:11 PM--log-level=debug or LOG_LEVEL=debug) so message flows and silence detection details appear.
• Look for:
◦ Incoming audio frames or VAD events (e.g., "voice activity detected", "audio buffer").
◦ Transcription or NLU logs (e.g., "transcript: ...", "intent: ...").
◦ Outgoing agent responses (e.g., "sending_tts", "play_prompt", "publish_audio").
3) Confirm media publish/subscription events
• In logs, check for publish/subscribe events:
◦ "track_published" or "audio_published" (agent published audio)
◦ "track_subscribed" or "audio_subscribed" (agent receiving caller audio)
• If you see publish without any "transcript" or "vad" events, the agent speaks but isn't detecting user input.
4) Watch silence-detection and disconnect reasons
• Look for messages like "silence_threshold_exceeded", "disconnecting due to silence", or "disconnect reason: STATE_MISMATCH/ICE_FAILURE".
• These explain the 15s disconnect if no user speech is detected.
5) Quick terminal test commands (example)
• Tail logs and filter useful keywords:
◦ Unix: tail -f /path/to/log | grep --line-buffered -E "transcript|voice_activity|sending_tts|play_prompt|silence|disconnect|track_published|track_subscribed"
• This shows user transcripts, VAD, agent TTS, silence, and disconnect lines in one stream.
If you paste a short snippet of the recent log output around the call start and disconnect (redact any secrets), I’ll point to the exact lines that show whether user audio was received and whether the agent replied. Would you like that?millions-dog-30135
12/09/2025, 8:23 PMtall-airline-16756
12/09/2025, 8:24 PMset_audio_enabled(False) or any "pause"/"scheduling paused" messages.
• Re-enable speech scheduling / audio:
◦ Ensure your code calls set_audio_enabled(True) (or the equivalent resume) after any manual pause.
• Confirm session start completed before handling input:
◦ Verify session.start() finished without errors and that the agent is not mid-TTS when user speaks.
• Watch these log keywords in real time:
◦ grep -E "scheduling paused|set_audio_enabled|sending_tts|play_prompt|received user transcript|track_subscribed|input stream detached|disconnect"
◦ Example: tail -f /path/to/log | grep --line-buffered -E "scheduling paused|set_audio_enabled|sending_tts|received user transcript|input stream detached|disconnect"
• Look for exceptions or long-running TTS generation that might block scheduling.
If you want, paste the small code snippet where you manage audio/scheduling (or the part around session.start() and any set_audio_enabled calls) and I’ll point out exactly where to change it.
Sources: Text and transcriptions | LiveKit docs | Turn detection and interruptions | LiveKit Docs | Agents and handoffs | LiveKit docs | Job lifecycle | LiveKit docs | Agent speech and audio | LiveKit docsmillions-dog-30135
12/09/2025, 8:30 PMtall-airline-16756
12/09/2025, 8:31 PMmillions-dog-30135
12/09/2025, 8:50 PMmillions-dog-30135
12/09/2025, 8:50 PMtall-airline-16756
12/09/2025, 8:51 PMmillions-dog-30135
12/09/2025, 8:53 PMtall-airline-16756
12/09/2025, 8:53 PM