future-glass-56154
09/15/2025, 10:19 PMtall-airline-16756
09/15/2025, 10:19 PMtall-airline-16756
09/15/2025, 10:20 PMdelete_room method from the RoomService API. Just make sure the agent has finished speaking by waiting for wait_for_playout() before you call delete_room. This way, the session will close smoothly for all participants.
If your goal is to disconnect only the agent but keep the user connected, you can simply use ctx.shutdown(). And if you need to remove a specific participant, the remove_participant API is there for you—just provide the participant’s identity.
Please feel free to reach out if you’d like me to walk you through any examples or provide more details on how to use these methods. I’m here to help!
Sources: Agents telephony integration | LiveKit Docs | Making calls using SIP | LiveKit Docs | Agents telephony integration | LiveKit Docs | Agent speech and audio | LiveKit Docs | Job lifecycle | LiveKit Docsfuture-glass-56154
09/15/2025, 10:20 PMtall-airline-16756
09/15/2025, 10:21 PMdelete_room?
• Do the clients receive a Disconnected event with the reason ROOM_DELETED?
• How are you calling the delete_room method? For example, are you using the SDK, CLI, or a custom implementation?
Knowing these details will really help us get to the bottom of this together. Thanks so much for your patience!
Sources: Connecting to LiveKit | LiveKit Docs | Agents telephony integration | LiveKit Docs | livekit-android-test/src/test/java/io/livekit/android/room/RoomMockE2ETest.... | Managing rooms | LiveKit Docs | protobufs/livekit_room.protofuture-glass-56154
09/15/2025, 10:22 PMasync def hangup_call():
"""Helper function to delete the room and end the call for all participants"""
ctx = get_job_context()
if ctx is None:
# Not running in a job context
return
await ctx.api.room.delete_room(api.DeleteRoomRequest(room=ctx.room.name))
This is defined in my agent class definition and called as part of a tool call.tall-airline-16756
09/15/2025, 10:23 PMdelete_room function is implemented correctly, which is great! To help us figure out what might be going on, could we check a few things together?
• Is the agent running in console mode? Sometimes in this mode, delete_room calls are ignored to keep things safe during testing.
• Have you had a chance to look at the API response to see if the room deletion went through successfully?
• Also, does the room actually exist when the API call is made?
Getting a bit more info on these points will really help us pinpoint the root cause. I’m here to help you through this!
Sources: Managing rooms | LiveKit Docs | Docs::Home | livekit-agents/livekit/agents/job.py | livekit/livekit_room.pb.go | Connecting to LiveKit | LiveKit Docsfuture-glass-56154
09/15/2025, 10:27 PMtall-airline-16756
09/15/2025, 10:27 PMdelete_room function is called, LiveKit kindly sends internal signaling to disconnect all participants, including SIP connections. However, sometimes an SIP connection might still appear active because of a few reasons:
• There could be slight delays in signaling propagation between LiveKit and the SIP trunk provider.
• LiveKit uses asynchronous cleanup mechanisms, which might take a moment to complete.
• The SIP trunk provider’s way of handling session termination, like sending the SIP BYE message, can also affect timing.
LiveKit does update the SIP participant’s status (for example, sip.callStatus) to show that the call is disconnected, but external factors such as network latency or trunk configuration might cause a little delay before the SIP call fully ends.
Please feel free to reach out if you’d like any more help troubleshooting this — I’m here to support you!
Sources: CHANGELOG.md | Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name | mcp/server.py | agent.py | test/lktest/livekit.go