Skip to content

Commit

Permalink
Allow requesting a ringtone during SIP call tramsfers
Browse files Browse the repository at this point in the history
  • Loading branch information
biglittlebigben committed Oct 21, 2024
1 parent edcd47f commit f7f6919
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
21 changes: 21 additions & 0 deletions cmd/lk/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ var (
Required: true,
Usage: "`SIP URL` to transfer the call to. Use 'tel:<phone number>' to transfer to a phone",
},
&cli.BoolFlag{
Name: "play-ringtone",
Usage: "if set, a ring tone will be played to the SIP participant while the transfer is being attempted",
},
},
},
},
Expand All @@ -148,6 +152,17 @@ var (
},

// Deprecated commands kept for compatibility
{
Hidden: true, // deprecated: use `sip trunk create`
Name: "create-sip-trunk",
Usage: "Create a SIP Trunk",
Action: createSIPTrunkLegacy,
Category: sipCategory,
Flags: []cli.Flag{
//lint:ignore SA1019 we still support it
RequestFlag[livekit.CreateSIPTrunkRequest](),
},
},
{
Hidden: true, // deprecated: use `sip trunk list`
Name: "list-sip-trunk",
Expand Down Expand Up @@ -221,6 +236,10 @@ func createSIPClient(cmd *cli.Command) (*lksdk.SIPClient, error) {
return lksdk.NewSIPClient(pc.URL, pc.APIKey, pc.APISecret, withDefaultClientOpts(pc)...), nil
}

func createSIPTrunkLegacy(ctx context.Context, cmd *cli.Command) error {
return fmt.Errorf("create-sip-trunk is deprecated and not supported anymore. Use 'sip in create' or 'sip out create' instead.")
}

func createSIPInboundTrunk(ctx context.Context, cmd *cli.Command) error {
cli, err := createSIPClient(cmd)
if err != nil {
Expand Down Expand Up @@ -478,11 +497,13 @@ func createSIPParticipantLegacy(ctx context.Context, cmd *cli.Command) error {
func transferSIPParticipant(ctx context.Context, cmd *cli.Command) error {
roomName, identity := participantInfoFromArgOrFlags(cmd)
to := cmd.String("to")
ringtone := cmd.Bool("play-ringtone")

req := livekit.TransferSIPParticipantRequest{
RoomName: roomName,
ParticipantIdentity: identity,
TransferTo: to,
PlayRingtone: ringtone,
}

cli, err := createSIPClient(cmd)
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module github.com/livekit/livekit-cli

go 1.22.0
go 1.22.7

toolchain go1.23.1

replace github.com/livekit/protocol => ../protocol

require (
github.com/charmbracelet/huh v0.6.0
github.com/charmbracelet/huh/spinner v0.0.0-20241011224433-983a50776b31
Expand All @@ -13,7 +15,7 @@ require (
github.com/go-task/task/v3 v3.39.2
github.com/joho/godotenv v1.5.1
github.com/livekit/protocol v1.24.0
github.com/livekit/server-sdk-go/v2 v2.2.2-0.20241007155002-76007e61480f
github.com/livekit/server-sdk-go/v2 v2.2.2-0.20241015094126-b8538ae5d67b
github.com/pion/rtcp v1.2.14
github.com/pion/rtp v1.8.9
github.com/pion/webrtc/v3 v3.3.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ github.com/livekit/psrpc v0.6.1-0.20240924010758-9f0a4268a3b9 h1:33oBjGpVD9tYkDX
github.com/livekit/psrpc v0.6.1-0.20240924010758-9f0a4268a3b9/go.mod h1:CQUBSPfYYAaevg1TNCc6/aYsa8DJH4jSRFdCeSZk5u0=
github.com/livekit/server-sdk-go/v2 v2.2.2-0.20241007155002-76007e61480f h1:7Vb/gkzVnnNdsV3K47LsWOCQpMfqM927V3XogwUM3jI=
github.com/livekit/server-sdk-go/v2 v2.2.2-0.20241007155002-76007e61480f/go.mod h1:AERqUiaZiAZjMxB5bxZn+M8PJlDD3TAOZn0PieQjnXk=
github.com/livekit/server-sdk-go/v2 v2.2.2-0.20241015094126-b8538ae5d67b h1:R1GpKwVbSYsG08k5sIkNCukvnrkOE18R8IO1YeujR8o=
github.com/livekit/server-sdk-go/v2 v2.2.2-0.20241015094126-b8538ae5d67b/go.mod h1:m2IukIyPCvJCdx04mdWIud9FoCBUAWc3526x3KgT8qY=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=
Expand Down

0 comments on commit f7f6919

Please sign in to comment.