Skip to content

Commit

Permalink
Add media encryption options.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc committed Nov 25, 2024
1 parent 96cae88 commit a880c6a
Show file tree
Hide file tree
Showing 11 changed files with 970 additions and 810 deletions.
757 changes: 430 additions & 327 deletions livekit/livekit_sip.pb.go

Large diffs are not rendered by default.

297 changes: 152 additions & 145 deletions livekit/livekit_sip.twirp.go

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions protobufs/livekit_sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ enum SIPTransport {
SIP_TRANSPORT_TLS = 3;
}

enum SIPMediaEncryption {
SIP_MEDIA_ENCRYPT_WITH_TLS = 0; // require encryption with TLS
SIP_MEDIA_ENCRYPT_DISABLE = 1; // do not enable encryption
SIP_MEDIA_ENCRYPT_REQUIRE = 2; // require encryption
SIP_MEDIA_ENCRYPT_ALLOW = 3; // use encryption if available
}

message SIPTrunkInfo {
option deprecated = true;

Expand Down Expand Up @@ -154,7 +161,8 @@ message SIPTrunkInfo {
// User-defined metadata for the Trunk.
string metadata = 12;

// NEXT ID: 15
SIPMediaEncryption media_encryption = 15;
// NEXT ID: 16
}

message CreateSIPInboundTrunkRequest {
Expand Down Expand Up @@ -197,6 +205,7 @@ message SIPInboundTrunkInfo {
google.protobuf.Duration max_call_duration = 12;

bool krisp_enabled = 13;
SIPMediaEncryption media_encryption = 14;
}

message CreateSIPOutboundTrunkRequest {
Expand Down Expand Up @@ -421,7 +430,9 @@ message CreateSIPParticipantRequest {

// Enable voice isolation for the callee.
bool enable_krisp = 14;
// NEXT ID: 16
SIPMediaEncryption media_encryption = 16;

// NEXT ID: 17
}

message SIPParticipantInfo {
Expand Down
4 changes: 3 additions & 1 deletion protobufs/rpc/io.proto
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ message EvaluateSIPDispatchRulesResponse {
// Max call duration.
google.protobuf.Duration max_call_duration = 17;

// NEXT ID: 18
livekit.SIPMediaEncryption media_encryption = 18;

// NEXT ID: 19
}

message UpdateSIPCallStateRequest {
Expand Down
4 changes: 3 additions & 1 deletion protobufs/rpc/sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ message InternalCreateSIPParticipantRequest {
// Max call duration.
google.protobuf.Duration max_call_duration = 24;

// NEXT ID: 26
livekit.SIPMediaEncryption media_encryption = 26;

// NEXT ID: 27
}

message InternalCreateSIPParticipantResponse {
Expand Down
237 changes: 126 additions & 111 deletions rpc/io.pb.go

Large diffs are not rendered by default.

180 changes: 91 additions & 89 deletions rpc/io.psrpc.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions rpc/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ func NewCreateSIPParticipantRequest(
EnabledFeatures: features,
RingingTimeout: req.RingingTimeout,
MaxCallDuration: req.MaxCallDuration,
MediaEncryption: req.MediaEncryption,
}, nil
}
166 changes: 90 additions & 76 deletions rpc/sip.pb.go

Large diffs are not rendered by default.

116 changes: 59 additions & 57 deletions rpc/sip.psrpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion sip/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
"github.com/twitchtv/twirp"
"maps"
"math"
"net/netip"
"sort"
"strings"

"github.com/twitchtv/twirp"
"golang.org/x/exp/slices"

"github.com/livekit/protocol/livekit"
Expand Down Expand Up @@ -517,6 +517,7 @@ func EvaluateDispatchRule(projectID string, trunk *livekit.SIPInboundTrunkInfo,
resp.HeadersToAttributes = trunk.HeadersToAttributes
resp.RingingTimeout = trunk.RingingTimeout
resp.MaxCallDuration = trunk.MaxCallDuration
resp.MediaEncryption = trunk.MediaEncryption
if trunk.KrispEnabled {
resp.EnabledFeatures = append(resp.EnabledFeatures, rpc.SIPFeature_KRISP_ENABLED)
}
Expand Down

0 comments on commit a880c6a

Please sign in to comment.