From 0b79f3e9d4d21b9c313b182e2422b13df3bd99b3 Mon Sep 17 00:00:00 2001 From: Benjamin Pracht Date: Fri, 28 Jun 2024 13:53:18 -0700 Subject: [PATCH] Allow specifying agents configuration on room creation (#347) --- cmd/livekit-cli/room.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmd/livekit-cli/room.go b/cmd/livekit-cli/room.go index de76c455..d3d4e249 100644 --- a/cmd/livekit-cli/room.go +++ b/cmd/livekit-cli/room.go @@ -54,6 +54,10 @@ var ( Name: "track-egress-file", Usage: "AutoTrackEgress json file (see examples/auto-track-egress.json)", }, + &cli.StringFlag{ + Name: "agents-file", + Usage: "Agents configuration json file", + }, &cli.StringFlag{ Name: "room-configuration", Usage: "Name of the room configuration to associate with the created room", @@ -285,6 +289,18 @@ func createRoom(c *cli.Context) error { req.Egress.Tracks = trackEgress } + if agentsFile := c.String("agents-file"); agentsFile != "" { + agent := &livekit.RoomAgent{} + b, err := os.ReadFile(agentsFile) + if err != nil { + return err + } + if err = protojson.Unmarshal(b, agent); err != nil { + return err + } + req.Agent = agent + } + if roomConfig := c.String("room-configuration"); roomConfig != "" { req.ConfigName = roomConfig }