Skip to content

Commit 7485d20

Browse files
committed
Allow setting a list of SIP codecs for SDP.
1 parent 0f86fd3 commit 7485d20

12 files changed

Lines changed: 1208 additions & 970 deletions

File tree

livekit/livekit_sip.pb.go

Lines changed: 504 additions & 341 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

livekit/livekit_sip.twirp.go

Lines changed: 350 additions & 342 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

livekit/sip.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import (
88
"strconv"
99
"strings"
1010

11+
"golang.org/x/text/language"
1112
"google.golang.org/grpc/codes"
1213
"google.golang.org/grpc/status"
1314

1415
"github.com/livekit/protocol/utils/xtwirp"
15-
"golang.org/x/text/language"
1616
)
1717

1818
var (
@@ -1024,3 +1024,13 @@ var (
10241024
")", "",
10251025
)
10261026
)
1027+
1028+
// MergeEncryption optionally applies SIPMediaEncryption if it's not set on the SIPMediaConfig.
1029+
func (m *SIPMediaConfig) MergeEncryption(v SIPMediaEncryption) {
1030+
if m == nil {
1031+
return
1032+
}
1033+
if m.Encryption == 0 {
1034+
m.Encryption = v
1035+
}
1036+
}

protobufs/livekit_sip.proto

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,19 @@ enum SIPMediaEncryption {
223223
SIP_MEDIA_ENCRYPT_REQUIRE = 2; // require encryption
224224
}
225225

226+
message SIPCodec {
227+
string name = 1;
228+
uint32 rate = 2;
229+
}
230+
231+
message SIPMediaConfig {
232+
// if set, ignore the default codecs and use the list below.
233+
bool only_listed_codecs = 1;
234+
// List of allowed codecs. If only_listed_codecs is not set, this list is added to default codecs.
235+
repeated SIPCodec codecs = 2;
236+
SIPMediaEncryption encryption = 3;
237+
}
238+
226239
message ProviderInfo {
227240
string id = 1;
228241
string name = 2;
@@ -649,13 +662,14 @@ message SIPDispatchRuleInfo {
649662
// RoomConfiguration to use if the participant initiates the room
650663
RoomConfiguration room_config = 10;
651664

665+
SIPMediaConfig media = 16;
652666
bool krisp_enabled = 11;
653-
SIPMediaEncryption media_encryption = 12;
667+
SIPMediaEncryption media_encryption = 12 [deprecated=true];
654668

655669
google.protobuf.Timestamp created_at = 14;
656670
google.protobuf.Timestamp updated_at = 15;
657671

658-
// NEXT ID: 16
672+
// NEXT ID: 17
659673
}
660674

661675
message SIPDispatchRuleUpdate {
@@ -670,7 +684,8 @@ message SIPDispatchRuleUpdate {
670684
(logger.redact) = true,
671685
(logger.redact_format) = "<redacted ({{ .Size }} bytes)>"
672686
];
673-
optional SIPMediaEncryption media_encryption = 6;
687+
optional SIPMediaEncryption media_encryption = 6 [deprecated=true];
688+
SIPMediaConfig media = 7;
674689
}
675690

676691
// ListSIPDispatchRuleRequest lists dispatch rules for given filters. If no filters are set, all rules are listed.
@@ -788,7 +803,8 @@ message CreateSIPParticipantRequest {
788803
// Enable voice isolation for the callee.
789804
bool krisp_enabled = 14;
790805

791-
SIPMediaEncryption media_encryption = 18;
806+
SIPMediaEncryption media_encryption = 18 [deprecated = true];
807+
SIPMediaConfig media = 23;
792808

793809
// Wait for the answer for the call before returning.
794810
bool wait_until_answered = 19;
@@ -804,7 +820,7 @@ message CreateSIPParticipantRequest {
804820
(logger.redact_format) = "<redacted ({{ .Size }} bytes)>"
805821
];
806822
optional Destination destination = 22;
807-
// NEXT ID: 23
823+
// NEXT ID: 24
808824
}
809825

810826
message SIPParticipantInfo {

protobufs/rpc/io.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,12 @@ message EvaluateSIPDispatchRulesResponse {
236236
string room_preset = 20;
237237
livekit.RoomConfiguration room_config = 21;
238238

239-
livekit.SIPMediaEncryption media_encryption = 22;
239+
livekit.SIPMediaEncryption media_encryption = 22 [deprecated = true];
240+
livekit.SIPMediaConfig media = 24;
240241

241242
map<string, string> feature_flags = 23;
242243

243-
// NEXT ID: 24
244+
// NEXT ID: 25
244245
}
245246

246247
message UpdateSIPCallStateRequest {

protobufs/rpc/sip.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ message InternalCreateSIPParticipantRequest {
121121
// Max call duration.
122122
google.protobuf.Duration max_call_duration = 24;
123123

124-
livekit.SIPMediaEncryption media_encryption = 28;
124+
livekit.SIPMediaEncryption media_encryption = 28 [deprecated = true];
125+
livekit.SIPMediaConfig media = 34;
125126

126127
// Wait for the answer for the call before returning.
127128
bool wait_until_answered = 29;
@@ -143,7 +144,7 @@ message InternalCreateSIPParticipantRequest {
143144
// Project-level feature flags from ProjectSettings.FeatureFlags
144145
map<string, string> feature_flags = 33;
145146

146-
// NEXT ID: 34
147+
// NEXT ID: 35
147148
}
148149

149150
message InternalCreateSIPParticipantResponse {

rpc/io.pb.go

Lines changed: 61 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)