narrow-ice-25787
10/02/2025, 8:53 AMtall-airline-16756
10/02/2025, 8:53 AMtall-airline-16756
10/02/2025, 8:53 AMdelete_room API to end the call for everyone, including the SIP participant. This is the go-to way to fully wrap up a SIP call.
• Disconnect Only the Agent: By using ctx.shutdown(), you can disconnect just the agent while the SIP participant stays connected in the room.
• Transfer the SIP Call: With transfer_sip_participant, you can redirect the SIP participant to another phone number, which effectively ends their involvement in the current session.
Right now, there isn’t a documented way in the LiveKit Python agent SDK to disconnect only a SIP participant while keeping the room active. If you have any specific needs or questions, please don’t hesitate to reach out—I’m here to help! Sources: telephony/sip_lifecycle.py | Job lifecycle | LiveKit Docs | Inside a session | LiveKit Docs | Connecting to LiveKit | LiveKit Docs | livekit-rtc/livekit/rtc/_proto/participant_pb2.pyinarrow-ice-25787
10/02/2025, 8:54 AMtall-airline-16756
10/02/2025, 8:55 AMnarrow-ice-25787
10/02/2025, 8:56 AMtall-airline-16756
10/02/2025, 8:56 AMdelete_room API from an agent, or if you'd like some guidance on how to set up the agent to automatically delete the room when the session ends? I'm here to assist you every step of the way.narrow-ice-25787
10/02/2025, 8:57 AMdelete_room API from an agenttall-airline-16756
10/02/2025, 8:57 AMfrom livekit import api
from livekit.agents import get_job_context
async def hangup_call():
ctx = get_job_context()
if ctx is None:
return
await ctx.api.room.delete_room(
api.DeleteRoomRequest(
room=ctx.room.name,
)
)
What this does is it grabs the current job context, which holds the room details, and then gently calls the delete_room API to close the room. If you have any questions or need a hand with anything else, just let me know—I’m here to help!narrow-ice-25787
10/02/2025, 8:58 AMtall-airline-16756
10/02/2025, 8:59 AMnarrow-ice-25787
10/02/2025, 9:00 AMtall-airline-16756
10/02/2025, 9:00 AM