Let’s walk through the lifecycle of a call in LiveKit—it’s pretty straightforward and helps keep everything running smoothly:
1. Room Creation: The moment the first participant tries to join a room that doesn’t exist yet, the system automatically creates it. This way, there’s always a room ready and waiting for new connections.
2. Participant Joining: When someone joins, they move through these stages:
◦ JOINING: They’re just starting to connect.
◦ JOINED: They’ve received confirmation and are officially in.
◦ ACTIVE: Fully connected and able to interact with everyone in the room.
◦ DISCONNECTED: They’ve left or lost connection.
1. Agent Creation and Dispatch:
◦ Automatic Dispatch: If automatic dispatch is turned on, agents get assigned to rooms as soon as those rooms are created—no extra steps needed.
◦ Explicit Dispatch: You can also assign agents to rooms manually using the API whenever you want, giving you flexibility to bring in specific agents as needed.
So, to sum it up: first, a room gets created, then participants (including agents) join in. Agents can either be assigned automatically right away or added later through API calls. And as participants go through their journey, they move from JOINING to JOINED, then ACTIVE, and finally DISCONNECTED. Hope this helps clarify how it all works!