Skip to content

Commit 7b5fafd

Browse files
authored
Set ringing timeout for SIP outbound. (#589)
1 parent ae75f4c commit 7b5fafd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/lk/sip.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/livekit/protocol/livekit"
2727
lksdk "github.com/livekit/server-sdk-go/v2"
2828
"github.com/urfave/cli/v3"
29+
"google.golang.org/protobuf/types/known/durationpb"
2930
)
3031

3132
//lint:file-ignore SA1019 we still support older APIs for compatibility
@@ -326,7 +327,7 @@ var (
326327
},
327328
&cli.DurationFlag{
328329
Name: "timeout",
329-
Usage: "timeout for the call to dial (requires wait flag)",
330+
Usage: "timeout for the call to dial",
330331
Value: 80 * time.Second,
331332
},
332333
},
@@ -1078,6 +1079,13 @@ func createSIPParticipant(ctx context.Context, cmd *cli.Command) error {
10781079
if dt := cmd.Duration("timeout"); dt != 0 {
10791080
timeout = dt
10801081
}
1082+
req.RingingTimeout = durationpb.New(timeout - 500*time.Millisecond)
1083+
} else {
1084+
// For async API we should use a default timeout for the RPC,
1085+
// and set a ringing timeout for the call instead.
1086+
if dt := cmd.Duration("timeout"); dt != 0 {
1087+
req.RingingTimeout = durationpb.New(dt)
1088+
}
10811089
}
10821090
ctx, cancel := context.WithTimeout(ctx, timeout)
10831091
defer cancel()

0 commit comments

Comments
 (0)