diff --git a/cmd/lk/simulate.go b/cmd/lk/simulate.go index ebb3fa8de..25bed3d73 100644 --- a/cmd/lk/simulate.go +++ b/cmd/lk/simulate.go @@ -178,16 +178,16 @@ var simulateAudioCommand = &cli.Command{ Usage: "Drop packets from the simulated user's audio track", }, &cli.StringFlag{ - Name: "to-phone-number", - Usage: "Call this `NUMBER` over SIP and simulate against whoever answers, instead of dispatching an agent. Requires --from-phone-number and --scenarios.", + Name: "to", + Usage: "Call this `NUMBER` (or SIP user) and simulate against whoever answers, instead of dispatching an agent. Requires --from and --scenarios.", }, &cli.StringFlag{ - Name: "from-trunk", - Usage: "Outbound SIP trunk `ID` to place --to-phone-number calls through. Without it, calls go out from a LiveKit phone number.", + Name: "trunk", + Usage: "Outbound SIP trunk `ID` to place --to calls through. Without it, calls go out from a LiveKit phone number.", }, &cli.StringFlag{ - Name: "from-phone-number", - Usage: "Caller `NUMBER` for --to-phone-number calls: a LiveKit phone number the project owns, or a number on --from-trunk", + Name: "from", + Usage: "Caller `NUMBER` for --to calls: a LiveKit phone number the project owns, or a number on --trunk", }, }, } @@ -424,7 +424,7 @@ type simulateConfig struct { scenarioGroup *livekit.ScenarioGroup scenariosPath string // path to the --scenarios file (empty when generating from source) viewModeRunID string // non-empty when `view` opens a pre-existing run - liveAgent bool // --agent-name or --to-phone-number: run against an already-running agent, don't spawn one + liveAgent bool // --agent-name or --to: run against an already-running agent, don't spawn one warnings []string // config-level warnings surfaced at setup (e.g. ignored flags) // impairments on the simulated user's audio, set only in SIMULATION_MODE_AUDIO @@ -432,7 +432,7 @@ type simulateConfig struct { lowQualityMicrophone bool packetLoss bool - // --to-phone-number: dial this number over SIP in place of dispatching agentName + // --to: dial this number over SIP in place of dispatching agentName sipCallTo string sipTrunkID string sipNumber string @@ -541,21 +541,21 @@ func runSimulate(ctx context.Context, cmd *cli.Command, simulationMode livekit.S samples := int32(cmd.Int("samples")) passRate := cmd.Float("pass-rate") liveAgentName := cmd.String("agent-name") - var phoneNumber, fromTrunk, fromPhoneNumber string + var callTo, trunkID, callFrom string if simulationMode == livekit.SimulationMode_SIMULATION_MODE_AUDIO { - phoneNumber = cmd.String("to-phone-number") - fromTrunk = cmd.String("from-trunk") - fromPhoneNumber = cmd.String("from-phone-number") + callTo = cmd.String("to") + trunkID = cmd.String("trunk") + callFrom = cmd.String("from") } - if fromTrunk != "" && phoneNumber == "" { - return fmt.Errorf("--from-trunk requires --to-phone-number") + if trunkID != "" && callTo == "" { + return fmt.Errorf("--trunk requires --to") } - if fromPhoneNumber != "" && phoneNumber == "" { - return fmt.Errorf("--from-phone-number requires --to-phone-number") + if callFrom != "" && callTo == "" { + return fmt.Errorf("--from requires --to") } // every call needs a caller: the number simulations are placed from - if phoneNumber != "" && fromPhoneNumber == "" { - return fmt.Errorf("--to-phone-number requires --from-phone-number") + if callTo != "" && callFrom == "" { + return fmt.Errorf("--to requires --from") } // never auto-discovered: an explicit --scenarios file is the source of @@ -582,10 +582,10 @@ func runSimulate(ctx context.Context, cmd *cli.Command, simulationMode livekit.S // --agent-name (even empty) means: run against an already-running agent, // don't spawn one. https://docs.livekit.io/agents/server/agent-dispatch/#automatic - if phoneNumber != "" { + if callTo != "" { // nothing is spawned, so there's no source to generate scenarios from. if scenariosPath == "" { - return fmt.Errorf("--to-phone-number requires --scenarios (no source to generate scenarios from when calling a number)") + return fmt.Errorf("--to requires --scenarios (no source to generate scenarios from when calling a number)") } liveAgent = true } else if cmd.IsSet("agent-name") { @@ -669,9 +669,9 @@ func runSimulate(ctx context.Context, cmd *cli.Command, simulationMode livekit.S simCfg.backgroundNoise = cmd.Bool("background-noise") simCfg.lowQualityMicrophone = cmd.Bool("low-quality-microphone") simCfg.packetLoss = cmd.Bool("packet-loss") - simCfg.sipCallTo = phoneNumber - simCfg.sipTrunkID = fromTrunk - simCfg.sipNumber = fromPhoneNumber + simCfg.sipCallTo = callTo + simCfg.sipTrunkID = trunkID + simCfg.sipNumber = callFrom } if !isInteractive() { diff --git a/cmd/lk/sip.go b/cmd/lk/sip.go index cfdea76cf..ee51ce9b8 100644 --- a/cmd/lk/sip.go +++ b/cmd/lk/sip.go @@ -336,12 +336,14 @@ var ( Usage: "`SIP_TRUNK_ID` to use for the call (overrides json config)", }, &cli.StringFlag{ - Name: "number", - Usage: "`SIP_NUMBER` to use for the call (overrides json config)", + Name: "from", + Aliases: []string{"number"}, + Usage: "`SIP_NUMBER` to use for the call (overrides json config)", }, &cli.StringFlag{ - Name: "call", - Usage: "`SIP_CALL_TO` number to use (overrides json config)", + Name: "to", + Aliases: []string{"call"}, + Usage: "`SIP_CALL_TO` phone number or SIP user to call (overrides json config)", }, &cli.StringFlag{ Name: "name", @@ -1273,10 +1275,10 @@ func createSIPParticipant(ctx context.Context, cmd *cli.Command) error { if v := cmd.String("trunk"); v != "" { req.SipTrunkId = v } - if v := cmd.String("number"); v != "" { + if v := cmd.String("from"); v != "" { req.SipNumber = v } - if v := cmd.String("call"); v != "" { + if v := cmd.String("to"); v != "" { req.SipCallTo = v } if v := cmd.String("room"); v != "" {