brief-evening-79958
12/01/2025, 2:28 PMtall-airline-16756
12/01/2025, 2:29 PMtall-airline-16756
12/01/2025, 2:29 PMsofia/external/...) is acting as a SIP gateway/trunk that dials LiveKit on behalf of the caller. That call comes from a configured trunk/gateway and matches LiveKit’s routing, so it succeeds.
What you can do
• Route calls through a SIP trunk or PBX (FreeSWITCH, Twilio, Telnyx, etc.) that is configured to send calls to your LiveKit SIP endpoint.
• Ensure you have an inbound trunk and appropriate dispatch rules in LiveKit that match the called number so LiveKit knows how to route the call (e.g., to a room or flow).
• If you want MicroSIP to reach LiveKit, have MicroSIP register to or send calls through a PBX/trunk that is authorized to call your LiveKit SIP gateway — not directly to the LiveKit SIP URI.
If you’d like, tell me:
• which SIP trunk or provider you’re using (or if you control FreeSWITCH), and
• the LiveKit routing you expect (direct to room, IVR, etc.),
and I’ll suggest the exact trunk/dispatch configuration steps.
Sources: SIP APIs | LiveKit docs | Accepting inbound calls | LiveKit docs | SIP inbound trunk | LiveKit docs | Make outbound calls | LiveKit docsbrief-evening-79958
12/01/2025, 3:07 PMtall-airline-16756
12/01/2025, 3:07 PMJobContext between phone and MicroSIP calls.
• SIP signaling / headers differences: MicroSIP INVITE headers or Caller ID format may differ and cause trunk/dispatch evaluation to pick a different route. Capture and compare SIP INVITES for phone vs MicroSIP.
• Media/SDP negotiation: MicroSIP’s SDP or codecs might prevent proper media setup so the agent can’t detect audio. Check SDP in the INVITE/200 OK and confirm supported codecs match the agent/LiveKit.
• Agent-side errors: Look for errors in the AI agent process (failed media, no job received, or rejected job).
Next diagnostic steps I can guide you through (pick one):
• How to check agent logs and JobContext for MicroSIP vs phone calls.
• How to capture and compare SIP INVITE/SDP for both call types.
• How to verify and update your dispatch rule to force dispatch to the agent.
Which of the above would you like to try first? If you share:
• a snippet of the dispatch rule (redact secrets) and
• a SIP INVITE log for the MicroSIP call (or confirm you can capture it),
I’ll point to exactly what to change or look for.
Sources: SIP dispatch rule | LiveKit docs | Agents telephony integration | LiveKit docs | Voice AI quickstart | LiveKit docs | Agent dispatch | LiveKit docs | SIP participant | LiveKit docsbrief-evening-79958
12/01/2025, 3:24 PMtall-airline-16756
12/01/2025, 3:25 PMcall- and an agent named AgnoX-AI-Agent — name must exactly match the agent registration.
Short checklist and next diagnostics to run (pick one or more)
1. Confirm agent registration
◦ Is the AI agent process connected to LiveKit with agentName exactly AgnoX-AI-Agent? Check the agent logs for a successful registration event.
1. Verify the call lands in the expected room
◦ When MicroSIP dials 8888, capture the created room name (should start with call-). Compare the room created for a phone call vs MicroSIP. If MicroSIP lands in a different room, the agent won’t get dispatched.
1. Check JobContext arrival
◦ When MicroSIP calls, does the agent log show a JobContext or incoming job? If not, dispatch rule matching may be failing. If yes, inspect why the agent isn’t answering that job.
1. Compare SIP INVITE headers and Caller ID
◦ Capture INVITEs for MicroSIP and phone calls. Compare To/From/Request-URI and any P-Asserted-Identity or Diversion headers. Differences can cause dispatch mismatches or trunk routing differences.
1. Inspect SDP / media negotiation
◦ Confirm MicroSIP and phone calls negotiate compatible codecs and that media is flowing. If SDP from MicroSIP lacks supported codecs or uses direct media that blocks media relaying, the agent may receive no audio and appear unresponsive.
1. Confirm dispatch rule association with your phone number
◦ Ensure the number +15183171307 is associated with the dispatch rule in LiveKit so inbound from that number triggers the rule.
If you prefer, I can guide you through capturing logs. Please provide one of these:
• The agent log snippet around an attempted MicroSIP call (redact secrets), or
• SIP INVITE/200OK SDP snippets for both MicroSIP and phone calls, or
• The room name created for a MicroSIP call and for a phone call.
Which would you like to share?brief-evening-79958
12/02/2025, 5:00 AMtall-airline-16756
12/02/2025, 5:01 AMbrief-evening-79958
12/02/2025, 7:20 AMRoomInputOptions.close_on_disconnect=False)tall-airline-16756
12/02/2025, 7:21 AMcall-_+15183171307_9RMYGzfCGUG4), so fixing the voice value should allow the agent to proceed.
• If you want, tell me where the voice is configured (config file, env var, or code) and I’ll point to exactly what to change.brief-evening-79958
12/02/2025, 7:25 AMtall-airline-16756
12/02/2025, 7:26 AMcall-_+15183171307_*.
• Session ends immediately (0s) and publishers show 0 tracks — the agent had no audio to process.
• Earlier you had an OpenAI voice error ("Nova") which you should have fixed; current logs show no OpenAI error, so the remaining problem is likely media (audio) not reaching LiveKit from MicroSIP.
Please check these, in order:
1) MicroSIP local audio
• Confirm MicroSIP has microphone enabled and is sending audio (unmuted).
• Verify MicroSIP is using a supported codec (preferably Opus or PCMU/PCMA).
2) SDP / codec negotiation
• Capture the SIP INVITE and 200 OK for a MicroSIP call and compare the SDP to a working phone call. Look for missing codecs or a=sendrecv vs a=sendonly/recvonly differences.
3) RTP/media path (NAT / firewall)
• Ensure RTP ports are open/forwarded and not blocked by NAT. MicroSIP behind strict NAT may fail to send media to LiveKit.
• If using UDP RTP, check that RTP packets are received by LiveKit (packet counts in session analytics or by capturing on your PBX).
4) LiveKit session analytics & participant tracks
• In the Session view, confirm the SIP participant shows a published audio track when you call from MicroSIP. If it shows 0 tracks, media isn’t negotiated or being published.
• If a track appears for phone calls but not MicroSIP, that confirms client-side/SDP differences.
5) Trunk / proxy behavior
• If MicroSIP calls are routed through a PBX (FreeSWITCH) ensure the PBX is bridging media correctly (not switching to direct media or dropping RTP). Try letting the PBX proxy RTP rather than direct endpoint-to-endpoint.
What to capture and share (pick one)
• SIP INVITE + 200 OK SDP for MicroSIP and for a working phone call (redact auth tokens).
OR
• A screenshot/snippet from Session analytics showing the SIP participant’s tracks for both MicroSIP and phone calls.
OR
• A short packet capture (RTP) showing whether audio packets arrive at LiveKit/your PBX.
Next step I can guide: once you share one of the above, I’ll pinpoint whether the issue is codec mismatch, NAT/RTP blocking, or PBX media handling and give exact changes to make. Which would you like to provide?brief-evening-79958
12/02/2025, 7:39 AMtall-airline-16756
12/02/2025, 7:39 AMcall-_+15183171307_*).
• Sessions start then immediately complete (0–1s) with no published tracks visible.
• Earlier OpenAI error for voice ("Nova") was present; later runs show no OpenAI error, so that specific failure appears resolved.
What to check/fix (prioritize in this order)
1. Ensure the agent publishes audio output and subscribes to caller audio
◦ Confirm your agent code explicitly publishes an output audio track (TTS) to the room after job start, and subscribes/consumes the SIP participant’s published audio track. If no output track is published, callers hear nothing and session may immediately finish.
1. Verify initial prompt / conversation flow
◦ Add a short initial greeting or prompt the agent speaks on job start (e.g., “Hello, how can I help today?”). If your flow immediately considers the job completed without sending audio or waiting for user audio, it will exit fast.
1. Confirm OpenAI Realtime audio config
◦ Make sure the OpenAI RealtimeModel audio output voice is set to a supported value (one of: alloy, ash, ballad, coral, echo, sage, shimmer, verse, marin, cedar). Use that exact string in your agent config.
◦ Ensure the model is actually invoked to synthesize audio (check for successful TTS events in logs).
Additional improvements
• Replace deprecated RoomInputOptions/RoomOutputOptions with RoomOptions to avoid unexpected behavior in future releases (log shows a deprecation warning).
• Verify codec/SDP: agent and caller must agree on codecs (Opus/PCMU/PCMA). If LiveKit shows 0 tracks for the SIP participant in Session analytics, the media negotiation failed.
• Keep agent lifecycle open while waiting for audio: don’t auto-complete the job until you confirm audio exchanged or a silence timeout has elapsed.
What to share if you want me to review code line-by-line
• The agent startup snippet that creates the room connection and OpenAI RealtimeModel config (redact keys).
• The part of code that handles JobContext and triggers TTS publishing.
• Any TTS/audio publish calls and their parameters (voice name, sample rate, codecs).
Which snippet would you like me to review first?brief-evening-79958
12/02/2025, 9:52 AMtall-airline-16756
12/02/2025, 9:52 AMsession.generate_reply(...) returns text only. That text is not automatically sent as audio into the LiveKit room, so a caller (MicroSIP or phone) will be silent unless you convert and publish audio.
What to do next
• After session.generate_reply(...), convert the returned text to audio and publish it to the room as an output audio track. Options:
◦ Re-enable a TTS plugin that publishes audio for you.
◦ Use OpenAI Realtime TTS (ensure session.audio.output.voice is set to a supported voice) to synthesize audio and publish the track.
◦ Generate TTS yourself (any service) and publish the resulting PCM/Opus audio to LiveKit.
Checklist to verify in your code
• You call session.generate_reply(...) and capture the reply text.
• You synthesize that text to audio (or use RealtimeModel TTS) and obtain an audio stream or file.
• You publish the audio to the LiveKit room as an output track with compatible codec/sample rate.
• You keep the job/session open until audio finishes playing or a silence timeout elapses.
If you’d like, paste the job-handling snippet that calls session.generate_reply(...) (redact keys). I’ll show the minimal code changes to synthesize and publish audio back into the room.