nice-fish-21757
07/31/2025, 10:41 AMtall-airline-16756
07/31/2025, 10:41 AMtall-airline-16756
07/31/2025, 10:41 AMdelete_room API to terminate the entire session. This will disconnect all participants and remove the room from the server:
await ctx.api.room.delete_room(
api.DeleteRoomRequest(
room=ctx.room.name,
)
)
2. End Call for Specific Participants:
If you want to remove only specific participants, use the remove_participant API:
await self.api.room.remove_participant(api.RoomParticipantIdentity(
room=self.room.name,
identity=self.participant.identity,
))
3. Agent-Specific Disconnection:
For agent-specific disconnection while allowing other participants to continue, use the job context shutdown method:
ctx.shutdown(reason="Session ended")
Important Considerations:
• Let the agent finish speaking before terminating the connection.
• The delete_room API sends a Disconnected room event to all participants.
• Handle errors gracefully, as users may have already hung up.
Let me know if you need further clarification or assistance with implementing these methods.
Sources: Agents telephony integration | LiveKit Docs | Making calls using SIP | LiveKit Docs | Job lifecycle | LiveKit Docs | telephony/sip_lifecycle.py