@@ -236,26 +236,34 @@ var (
236236 Name : "trunks" ,
237237 Usage : "Sets a list of trunks for the dispatch rule" ,
238238 },
239- & cli.StringFlag {
240- Name : "direct" ,
241- Usage : "Sets a direct dispatch to a specified room" ,
242- },
243- & cli.StringFlag {
244- Name : "caller" ,
245- Aliases : []string {"individual" },
246- Usage : "Sets a individual caller dispatch to a new room with a specific prefix" ,
247- },
248- & cli.StringFlag {
249- Name : "callee" ,
250- Usage : "Sets a callee number dispatch to a new room with a specific prefix" ,
251- },
252- & cli.BoolFlag {
253- Name : "pin" ,
254- Usage : "PIN for a dispatch rule" ,
255- },
256- & cli.BoolFlag {
257- Name : "randomize" ,
258- Usage : "Randomize room name, only applies to callee dispatch" ,
239+ },
240+ MutuallyExclusiveFlags : []cli.MutuallyExclusiveFlags {
241+ {
242+ Flags : [][]cli.Flag {
243+ {
244+ & cli.StringFlag {
245+ Name : "direct" ,
246+ Usage : "Sets a direct dispatch to a specified room" ,
247+ },
248+ },
249+ {
250+ & cli.StringFlag {
251+ Name : "caller" ,
252+ Aliases : []string {"individual" },
253+ Usage : "Sets a individual caller dispatch to a new room with a specific prefix" ,
254+ },
255+ },
256+ {
257+ & cli.StringFlag {
258+ Name : "callee" ,
259+ Usage : "Sets a callee number dispatch to a new room with a specific prefix" ,
260+ },
261+ & cli.BoolFlag {
262+ Name : "randomize" ,
263+ Usage : "Randomize room name" ,
264+ },
265+ },
266+ },
259267 },
260268 },
261269 },
@@ -278,6 +286,35 @@ var (
278286 Usage : "Sets a new list of trunk IDs" ,
279287 },
280288 },
289+ MutuallyExclusiveFlags : []cli.MutuallyExclusiveFlags {
290+ {
291+ Flags : [][]cli.Flag {
292+ {
293+ & cli.StringFlag {
294+ Name : "direct" ,
295+ Usage : "Sets a direct dispatch to a specified room" ,
296+ },
297+ },
298+ {
299+ & cli.StringFlag {
300+ Name : "caller" ,
301+ Aliases : []string {"individual" },
302+ Usage : "Sets a individual caller dispatch to a new room with a specific prefix" ,
303+ },
304+ },
305+ {
306+ & cli.StringFlag {
307+ Name : "callee" ,
308+ Usage : "Sets a callee number dispatch to a new room with a specific prefix" ,
309+ },
310+ & cli.BoolFlag {
311+ Name : "randomize" ,
312+ Usage : "Randomize room name" ,
313+ },
314+ },
315+ },
316+ },
317+ },
281318 },
282319 {
283320 Name : "delete" ,
@@ -944,6 +981,43 @@ func updateSIPDispatchRule(ctx context.Context, cmd *cli.Command) error {
944981 req .Name = & val
945982 }
946983 req .TrunkIds = listUpdateFlag (cmd , "trunks" )
984+ if val := cmd .String ("direct" ); val != "" {
985+ if req .Rule != nil {
986+ return fmt .Errorf ("only one dispatch rule type is allowed" )
987+ }
988+ req .Rule = & livekit.SIPDispatchRule {
989+ Rule : & livekit.SIPDispatchRule_DispatchRuleDirect {
990+ DispatchRuleDirect : & livekit.SIPDispatchRuleDirect {
991+ RoomName : val ,
992+ },
993+ },
994+ }
995+ }
996+ if val := cmd .String ("caller" ); val != "" {
997+ if req .Rule != nil {
998+ return fmt .Errorf ("only one dispatch rule type is allowed" )
999+ }
1000+ req .Rule = & livekit.SIPDispatchRule {
1001+ Rule : & livekit.SIPDispatchRule_DispatchRuleIndividual {
1002+ DispatchRuleIndividual : & livekit.SIPDispatchRuleIndividual {
1003+ RoomPrefix : val ,
1004+ },
1005+ },
1006+ }
1007+ }
1008+ if val := cmd .String ("callee" ); val != "" {
1009+ if req .Rule != nil {
1010+ return fmt .Errorf ("only one dispatch rule type is allowed" )
1011+ }
1012+ req .Rule = & livekit.SIPDispatchRule {
1013+ Rule : & livekit.SIPDispatchRule_DispatchRuleCallee {
1014+ DispatchRuleCallee : & livekit.SIPDispatchRuleCallee {
1015+ RoomPrefix : val ,
1016+ Randomize : cmd .Bool ("randomize" ),
1017+ },
1018+ },
1019+ }
1020+ }
9471021 info , err := cli .UpdateSIPDispatchRule (ctx , & livekit.UpdateSIPDispatchRuleRequest {
9481022 SipDispatchRuleId : id ,
9491023 Action : & livekit.UpdateSIPDispatchRuleRequest_Update {
0 commit comments