last night, i had a room run all night by mistake....
# ask-ai
p
last night, i had a room run all night by mistake. how do i avoid that happening when i have egress enabled? It is especially important for me that egresses are killed when there is no active human participant
t
Thanks for reaching out, tedtrux. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To help make sure egress doesn’t keep running when there aren’t any active human participants, here are a few easy ways to handle it: • RoomComposite Egress: This one’s great because it automatically stops recording as soon as everyone leaves the room. It’s linked to the room’s lifecycle, so you don’t have to worry about extra setup. • Set a Departure Timeout: You can set the room to close automatically after everyone leaves by using the
departure_timeout
parameter. For example, setting it to 30 seconds means the room will close shortly after the last person leaves, which also stops any related egress. • Manual Control: If you prefer, you can watch for participant events yourself and manually stop the egress using the StopEgress API or delete the room once the last human participant is gone. For most folks, using RoomComposite egress with a departure timeout is the easiest and most reliable way to go. If you want, I’m here to help you set any of this up—just let me know! Sources: Composite and web recordings | LiveKit Docs | livekit/livekit_room.pb.go | packages/livekit-server-sdk/src/EgressClient.ts
p
but when you say everyone, are you including the agent?
t
Hey there! So, RoomComposite egress wraps up when everyone—including agents—has left the room. But the room actually closes right when the last non-agent participant (a human) exits. Here’s what happens then: • The room closes automatically, and any agents still hanging around get disconnected. • The recording stops since the room’s lifecycle has ended. If you want to skip any delay or extra audio from agents who stick around for a bit, you can either delete the room as soon as the last human leaves or manually stop the egress at that moment. Just give me a shout if you want a hand setting this up! Sources: Anatomy of an Agent | LiveKit Docs | Composite and web recordings | LiveKit Docs
p
is there a way of having a max room duration serverside?
t
LiveKit doesn’t have a built-in server-side setting to limit the maximum room duration directly. But no worries—you can easily add this feature in your app by: • Keeping track of when the room was created in your application. • Using the Room Service API to close rooms automatically after the time you want. If you’re working with SIP integrations, there’s also a handy
max_call_duration
setting you can use to limit call lengths. Feel free to reach out if you want a hand setting up room duration limits with the Room Service API or if you’re dealing with SIP settings—I’m here to help! Sources: SIP APIs | LiveKit Docs | packages/livekit-server-sdk/src/RoomServiceClient.ts | config-sample.yaml