big-agency-33145
09/30/2025, 4:02 AMawait ctx.room.disconnect()
await ctx.delete_room()
or
ctx = get_job_context()
await ctx.api.room.delete_room(api.DeleteRoomRequest(room=ctx.room.name))
deletes the room and detach the agent correctly but the sip session keeps active (no bye received by caller nor sent by livekit)tall-airline-16756
09/30/2025, 4:02 AMtall-airline-16756
09/30/2025, 4:03 AMdeleteRoom API to end the room along with all participants, including SIP sessions. Here's a quick example for you:
await ctx.api.room.delete_room(api.DeleteRoomRequest(room=ctx.room.name))
• Consider enabling the delete_room_on_close option in agents to automatically clean up the room once the session ends. This can save you some effort!
• Keep an eye on the SIP call status using participant attributes like sip.callStatus. When you see it change to "hangup," that’s a great time to trigger the room deletion.
• If you're deleting rooms from the frontend, make sure to use secure API routes to call the deleteRoom API safely.
Following these steps will help you close SIP sessions smoothly, preventing any lingering active calls or silent participants. If you have any questions or need further help, I’m here for you!
Sources: livekit-agents/livekit/agents/voice/room_io/room_io.py | Job lifecycle | LiveKit Docs | Connecting to LiveKit | LiveKit Docs | Agents telephony integration | LiveKit Docs | Inside a session | LiveKit Docs