:wave: Hello, team! I have a problem and need help...
# ask-ai
c
👋 Hello, team! I have a problem and need help, please. I'm making calling AI Agent using live kit and gemini and sip interface like micro sip and zoiper when i call the ai using micro sip and zoiper it doesnot reply to me however the ogs is saying the ai is responding back • Project:
Mynewproject
• Room:
phone-room-test
• Sample Call ID:
SCL_raWYZKrvPkJB
• Note: ◦ “Our Python agent using LiveKit Agents + Gemini works in sandbox (browser client hears AI).” ◦ “With Telephony → SIP trunk → MicroSIP (PCMU/8000), the agent logs show continuous Gemini audio output into a published track, but the SIP caller hears silence.” ◦ “MicroSIP audio devices are correct; codecs limited to G.711; Windows audio output OK.” any help pls i need to contact with support
t
Thanks for reaching out, Belal. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I see you're describing the AI agent publishing audio in
phone-room-test
but MicroSIP/Zoiper callers hear silence (Project: Mynewproject, Call ID: SCL_raWYZKrvPkJB). I can help troubleshoot — a few targeted checks will quickly narrow the cause. Please confirm the following so I can advise next steps: 1. Is the agent publishing audio at 8000 Hz mono (resampled for G.711)? 2. Are you applying any noise cancellation/filters in RoomIO or AudioInputOptions? If yes, which filter (e.g.,
BVC
,
BVCTelephony
)? 3. Which SIP trunk/provider are you using (Telnyx, Twilio, other)? 4. Can you verify the SIP leg plays a dial tone when
play_dialtone: true
is enabled for the SIP participant? Did you hear the dial tone on MicroSIP/Zoiper? 5. From the agent logs for call SCL_raWYZKrvPkJB, do you see a successful
publish_track
and no publish errors during TTS output? If you confirm 1 or 2 are not set correctly, try these fixes first: • Set agent audio output to 8kHz mono (G.711): use
sample_rate=8000
,
num_channels=1
for AudioOutputOptions. • Use
BVCTelephony()
(or apply it only for SIP participants) to avoid aggressive filtering of synthesized audio. If you prefer, share the relevant snippets of how you start the session / set RoomOptions (audio_output/audio_input) and the SIP trunk provider — I’ll point to exact config changes and a minimal Python sample you can drop into your agent. Sources: HD voice for SIP | LiveKit docs | Using Noise Cancellation for SIP and WebRTC Participants | Agent session | LiveKit docs | Voice AI quickstart | LiveKit docs | Make outbound calls | LiveKit docs
c
Here’s a clean version you can send them, with no code blocks: Here are answers to your questions and some extra context. 1. Agent output sample rate / channels 2. Right now the agent publishes audio into the room at 48,000 Hz, mono (16‑bit PCM). Gemini returns 24 kHz PCM and I resample those chunks to 48 kHz before feeding them into the agent’s output track. I haven’t yet tried 8,000 Hz mono output, but I’m happy to change the agent to publish at 8 kHz mono, resampling 24 kHz → 8 kHz, if that will help the SIP bridge align better with G.711. 3. RoomIO / AudioInputOptions / noise cancellation 4. I’m not using RoomOptions, AudioInputOptions, or any noise‑cancellation filters such as BVC or BVCTelephony. The agent simply uses the basic audio source + local audio track pattern from the LiveKit Python SDK and sends raw PCM frames. 5. SIP trunk / provider 6. I’m using MicroSIP and Zoiper as softphones, registering directly against the LiveKit SIP domain for this project (mynewproject‑x3lulwo7.sip.livekit.cloud). There is no external SIP provider like Twilio or Telnyx in between; SIP traffic goes straight between the softphone and LiveKit Cloud. 7. Dial tone (play_dialtone) 8. I haven’t tested play_dialtone: true yet. I can enable it for the SIP participant and confirm whether the caller hears the dial tone. That should help distinguish between a generic SIP media issue and something specific to the agent’s audio track. 9. Publish track / errors 10. In the agent I create and publish one audio track when the job starts; I don’t see any publish errors in the logs. The same agent code works correctly in the LiveKit Sandbox: when I connect via the sandbox WebRTC client, I can hear the AI’s responses clearly, and the logs show the same “Received audio chunk from Gemini” pattern. 11. Context for the failing SIP calls 12. – Project: Mynewproject 13. – Room: phone-room-test 14. – Example Call ID: SCL_raWYZKrvPkJB 15. In the Telephony UI this call shows: inbound, codec PCMU/8000, SIP 200 OK, and about one minute of duration. On the agent side, for these SIP calls I consistently see: the SIP participant joining, “Audio stream received,” connection to Gemini Live, and continuous Gemini audio chunks being processed. However, the SIP caller hears silence from the agent for the entire call, while the same agent works as expected with WebRTC clients in the sandbox. If you’d like, I can: – Switch the agent’s output to 8,000 Hz mono as you suggested and retest, and – Enable play_dialtone: true and report whether the caller hears the dial tone.
t
Thanks — this is very helpful detail. You’ve answered the key questions I asked; next steps below are focused, actionable, and ordered so you can test quickly. What to try first (in order) 1. Change the agent’s published audio to 8 kHz mono (G.711 alignment) and retest. Resample Gemini’s 24 kHz → 8 kHz before publishing. This is the most likely fix. 2. Enable play_dialtone: true for the SIP participant and verify MicroSIP/Zoiper hears the dial tone. If you hear the dial tone, the SIP media path is OK and the problem is agent-side format/processing. 3. If silence persists after (1) + (2), add a telephony-safe noise filter for SIP participants (use BVCTelephony or an equivalent telephony-mode filter) and retest. What to check if problems continue • Confirm the agent’s track name and that the SIP participant is subscribed to that track (no subscription/ACL issues). • Look for any runtime logs around PCM frame acceptance or dropped frames when you switch to 8 kHz (publish success vs dropped frames). • Verify the Telephony UI still shows PCMU/8000 for that call after you change the agent output. If you want, send back: • Results from the 8 kHz test (did audio become audible?), and • Whether you heard the dial tone when play_dialtone was enabled. I can then give the exact LiveKit Python RoomOptions and a minimal config snippet to apply the 8 kHz resampling and telephony noise filter based on your test results.
c
I switched the agent output to 8 kHz mono as suggested, calls still show PCMU/8000, Gemini audio is flowing (see logs), but the SIP caller still hears silence. I'm Hearing the dial tone only then silence however it replies to me in the logs PS C:\Users\byaya\OneDrive\Desktop\VOOM\LiveKit-Integration> cd gemini-livekit-agent PS C:\Users\byaya\OneDrive\Desktop\VOOM\LiveKit-Integration\gemini-livekit-agent> ..\venv\Scripts\python agent.py dev C\Users\byaya\OneDrive\Desktop\VOOM\LiveKit Integration\gemini livekit agent\agent.py4: DeprecationWarning: 'audioop' is deprecated and slated for removal in Python 3.13 import audioop INFOlivekitlivekit_ffi:server139livekit ffi:server - initializing ffi server v0.12.39 INFOlivekitlivekit_ffi:cabi50livekit ffi:cabi - initializing ffi server v0.12.39 DEBUGasyncioUsing proactor: IocpProactor 200649.727 DEBUG asyncio Using proactor: IocpProactor DEVlivekit.agentsWatching C:\Users\byaya\OneDrive\Desktop\VOOM\LiveKit-Integration\gemini-livekit-agent 200649.731 DEV livekit.agents Watching C:\Users\byaya\OneDrive\Desktop\VOOM\LiveKit-Integration\gemini-livekit-agent INFOlivekitlivekit_ffi:server139livekit ffi:server - initializing ffi server v0.12.39 INFOlivekitlivekit_ffi:cabi50livekit ffi:cabi - initializing ffi server v0.12.39 DEBUGasyncioUsing proactor: IocpProactor 200652.003 DEBUG asyncio Using proactor: IocpProactor INFOlivekit.agentsstarting worker 200652.013 INFO livekit.agents starting worker {"version": "1.3.5", "rtc-version": "1.0.19"} INFOlivekit.agentsregistered worker 200652.513 INFO livekit.agents registered worker {"agent_name": "", "id": "AW_3xzK8FKy6ita", "url": "wss://mynewproject-x3lulwo7.livekit.cloud", "region": "Israel", "protocol": 16} INFOlivekit.agentsreceived job request 200959.121 INFO livekit.agents received job request {"job_id": "AJ_YLxLeKqvJ6Vz", "dispatch_id": "AD_rWwRoS2fhYhn", "room": "phone-room-test", "room_id": "RM_fN6RizPZUUF8", "agent_name": "", "resuming": false, "enable_recording": false} DEBUGlivekit.agentsreceived assignment 200959.233 DEBUG livekit.agents received assignment {"agent_name": "", "room_id": "RM_fN6RizPZUUF8", "room": "phone-room-test", "job_id": "AJ_YLxLeKqvJ6Vz", "dispatch_id": "AD_rWwRoS2fhYhn", "enable_recording": false} INFOlivekit.agentsinitializing job runner 200959.238 INFO livekit.agents initializing job runner {"tid": 16116} DEBUGasyncioUsing proactor: IocpProactor 200959.240 DEBUG asyncio Using proactor: IocpProactor INFOlivekit.agentsjob runner initialized 200959.241 INFO livekit.agents job runner initialized {"tid": 16116, "elapsed_time": 0.0} INFOgemini agentConnecting to room phone-room-test 200959.249 INFO gemini-agent Connecting to room phone-room-test INFOgemini agentParticipant sip_testuser joined 201000.422 INFO gemini-agent Participant sip_testuser joined INFOgemini agentAudio stream received 201000.764 INFO gemini-agent Audio stream received INFOgemini agentConnected to Gemini Live 201001.229 INFO gemini-agent Connected to Gemini Live INFOgemini agentReceived audio chunk from Gemini: 9600 bytes 201001.586 INFO gemini-agent Received audio chunk from Gemini: 9600 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201001.625 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201001.649 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201001.675 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201001.697 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201001.746 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201001.986 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201002.227 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 3840 bytes 201002.467 INFO gemini-agent Received audio chunk from Gemini: 3840 bytes INFOgemini agentReceived audio chunk from Gemini: 9600 bytes 201006.170 INFO gemini-agent Received audio chunk from Gemini: 9600 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201006.194 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201006.219 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201006.249 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201006.275 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 11520 bytes 201006.326 INFO gemini-agent Received audio chunk from Gemini: 11520 bytes INFOgemini agentReceived audio chunk from Gemini: 5760 bytes 201006.567 INFO gemini-agent Received audio chunk from Gemini: 5760 bytes
t
Thanks — this is very useful detail. You’ve confirmed: agent is publishing at 8kHz mono, Gemini chunks arrive, SIP shows PCMU/8000 and plays dial tone, but caller still hears silence. That narrows this to audio encoding/packaging or routing to the SIP leg. Please try the following targeted steps (ordered by likelihood + quick checks): 1) Confirm PCM → PCMU conversion before publish • Convert the resampled 8kHz PCM frames to G.711 μ-law (PCMU) before sending them into the LiveKit AudioSource. Use
audioop.lin2ulaw()
(or equivalent) so the outgoing frames match PCMU expectations. 2) Ensure frame sizes and sample counts are correct • Publish frames with consistent sizes (e.g., 20ms or 50ms). For 8kHz, 20ms = 160 samples, 50ms = 400 samples. Mismatched frame lengths can cause SIP clients to ignore audio. 3) Verify the AudioSource creation matches the final format • Create the audio source as 8000 Hz, 1 channel and feed it frames already encoded/packed to match that layout. 4) Confirm publish success and outbound RTP packets in the dashboard/inspector • In the LiveKit Admin Dashboard, confirm the agent’s audio track appears and that RTP packets are being sent toward the SIP participant. If no outbound RTP for the agent track exists, the problem is publish/routing. 5) Test with a known-good 8kHz PCMU file played as the agent output • Replace Gemini temporarily: play a local 8kHz mono PCMU (or 8kHz PCM then convert) audio file via the agent. If the SIP caller hears that file, the problem is the Gemini→resample→encode pipeline; if still silent, it’s publish/routing. 6) Disable DTX/RED and ensure no aggressive post-processing is applied • Make sure TrackPublishOptions or RoomIO are not enabling DTX/RED or WebRTC-only filters that could suppress synthetic audio. 7) Try a short tone test via frames (sine wave) encoded to PCMU • If a tone is audible, you’ve confirmed routing and encoding are correct and can focus on how Gemini audio is packaged. If you want, paste the minimal snippet that takes Gemini chunks → resampling → frame creation → publish (no secrets, just the transformation code and calls used) and I’ll point out exactly where to convert/pack frames or adjust sizes. Sources: Agent session | LiveKit docs | HD voice for SIP | LiveKit docs | livekit/livekit_composite | DeepWiki | Camera & microphone | LiveKit docs | Agent speech and audio | LiveKit docs
c
Thanks for the follow‑up and detailed suggestions. A few clarifications about what I can do from the Python agent side versus what’s handled by LiveKit: • The LiveKit Python SDK’s AudioSource interface expects linear PCM, not pre‑encoded G.711 μ‑law. If I applied audioop.lin2ulaw() and fed μ‑law bytes into AudioSource, they would be interpreted as linear PCM and would not be valid audio. My understanding is that the SIP bridge is responsible for transcoding the room’s linear PCM/Opus audio to PCMU/8000 for the SIP leg. • I’ve already adjusted the agent so that: ◦ Output is 8 kHz mono. ◦ Gemini’s 24 kHz PCM is resampled to 8 kHz. ◦ Frames are chunked into consistent 20 ms blocks (160 samples, 320 bytes), which matches your recommended frame sizes. • The exact same agent (same publish logic, same frame handling) works as expected with WebRTC clients in the LiveKit Sandbox: browser participants hear the AI audio clearly. • On the SIP side: ◦ Calls negotiate
PCMU/8000
, return SIP 200 OK, and can play the dial tone when
play_dialtone
is enabled. ◦ During those calls, my agent logs show continuous Gemini audio chunks being processed and published, with no publish errors. ◦ Despite this, the SIP caller still hears silence from the agent. Given that: • WebRTC clients can hear the agent with this setup. • SIP calls can receive and play the dial tone. • The agent is already publishing 8 kHz mono PCM in correct 20 ms frames. It seems the remaining issue is in the SIP bridge’s handling/routing of this agent track for my project/region, rather than something I can resolve further inside the agent code. If you can, please: • Inspect the RTP stream for the agent’s audio track on the SIP leg for a call like
SCL_raWYZKrvPkJB
(project
Mynewproject
, room
phone-room-test
), and • Confirm whether the bridge is actually sending those frames to the SIP endpoint, or if there is any error/dropping on the server side. If you still believe a specific change is needed in the Python agent, it would be very helpful to have a small, concrete example (for the LiveKit Python SDK) that shows the exact expected format for frames passed into rtc.AudioSource when targeting SIP/PCMU, so I can align to that implementation.
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!