Skip to content

Commit

Permalink
Add SIP analytics events (#831)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
biglittlebigben and github-actions[bot] authored Oct 14, 2024
1 parent a3ae28b commit b754791
Show file tree
Hide file tree
Showing 13 changed files with 1,983 additions and 1,661 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-garlics-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/protocol": minor
---

Add SIP analytics events
673 changes: 406 additions & 267 deletions livekit/livekit_analytics.pb.go

Large diffs are not rendered by default.

1,386 changes: 844 additions & 542 deletions livekit/livekit_sip.pb.go

Large diffs are not rendered by default.

646 changes: 193 additions & 453 deletions livekit/livekit_sip.twirp.go

Large diffs are not rendered by default.

26 changes: 22 additions & 4 deletions protobufs/livekit_analytics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import "google/protobuf/timestamp.proto";
import "livekit_models.proto";
import "livekit_egress.proto";
import "livekit_ingress.proto";
import "livekit_sip.proto";

enum StreamType {
UPSTREAM = 0;
Expand Down Expand Up @@ -110,8 +111,18 @@ enum AnalyticsEventType {
INGRESS_STARTED = 16;
INGRESS_ENDED = 17;
INGRESS_UPDATED = 29;

// NEXT_ID: 30
SIP_INBOUND_TRUNK_CREATED = 30;
SIP_INBOUND_TRUNK_DELETED = 31;
SIP_OUTBOUND_TRUNK_CREATED = 32;
SIP_OUTBOUND_TRUNK_DELETED = 33;
SIP_DISPATCH_RULE_CREATED = 34;
SIP_DISPATCH_RULE_DELETED = 35;
SIP_PARTICIPANT_CREATED = 36;
SIP_CALL_INCOMING = 37;
SIP_CALL_STARTED = 38;
SIP_CALL_ENDED = 39;

// NEXT_ID: 40
}

message AnalyticsClientMeta {
Expand Down Expand Up @@ -152,8 +163,15 @@ message AnalyticsEvent {
RTPStats rtp_stats = 21;
int32 video_layer = 22;
string node_id = 24;

// NEXT_ID: 26
string sip_call_id = 26;
SIPCallInfo sip_call = 27;
string sip_trunk_id = 28;
SIPInboundTrunkInfo sip_inbound_trunk = 29;
SIPOutboundTrunkInfo sip_outbound_trunk = 30;
string sip_dispatch_rule_id = 31;
SIPDispatchRuleInfo sip_dispatch_rule = 32;

// NEXT_ID: 33
}

message AnalyticsEvents {
Expand Down
34 changes: 32 additions & 2 deletions protobufs/livekit_sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ option go_package = "github.com/livekit/protocol/livekit";
option csharp_namespace = "LiveKit.Proto";
option ruby_package = "LiveKit::Proto";

import "google/protobuf/empty.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "livekit_models.proto";

/*
LiveKit's SIP API is built with 3 high level primitives
Expand Down Expand Up @@ -50,7 +51,7 @@ import "google/protobuf/duration.proto";


service SIP {
rpc CreateSIPTrunk(CreateSIPTrunkRequest) returns (SIPTrunkInfo) { option deprecated = true; };
// rpc CreateSIPTrunk(CreateSIPTrunkRequest) returns (SIPTrunkInfo) { option deprecated = true; }; DELETED
rpc ListSIPTrunk(ListSIPTrunkRequest) returns (ListSIPTrunkResponse) { option deprecated = true; };

rpc CreateSIPInboundTrunk(CreateSIPInboundTrunkRequest) returns (SIPInboundTrunkInfo);
Expand Down Expand Up @@ -427,3 +428,32 @@ message TransferSIPParticipantRequest {
string room_name = 2;
string transfer_to = 3;
}

message SIPCallInfo {
string call_id = 1;
string trunk_id = 2;
string room_name = 3;
string room_id = 4; // ID of the current/previous room published to
string participant_identity = 5;
SIPUri from_uri = 6;
SIPUri to_uri = 7;
SIPCallStatus call_status = 8;
int64 started_at = 9;
int64 ended_at = 10;
DisconnectReason disconnect_reason = 11;
}

message SIPUri {
string user = 1;
string host = 2;
string ip = 3;
string port = 4;
SIPTransport transport = 5;
}

enum SIPCallStatus {
SCS_CALL_INCOMING = 0; // Incoming call is being handled by the SIP service. The SIP participant hasn't joined a LiveKit room yet
SCS_PARTICIPANT_JOINED = 1; // SIP participant for outgoing call has been created. The SIP outgoing call is being established
SCS_ACTIVE = 2; // Call is ongoing. SIP participant is active in the LiveKit room
SCS_DISCONNECTED = 3; // Call has ended
}
8 changes: 8 additions & 0 deletions protobufs/rpc/io.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ option go_package = "github.com/livekit/protocol/rpc";

import "livekit_egress.proto";
import "livekit_ingress.proto";
import "livekit_sip.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/duration.proto";

Expand All @@ -39,6 +40,7 @@ service IOInfo {
// sip
rpc GetSIPTrunkAuthentication(GetSIPTrunkAuthenticationRequest) returns (GetSIPTrunkAuthenticationResponse);
rpc EvaluateSIPDispatchRules(EvaluateSIPDispatchRulesRequest) returns (EvaluateSIPDispatchRulesResponse);
rpc UpdateSIPCallState(UpdateSIPCallStateRequest) returns (google.protobuf.Empty);
}

message GetEgressRequest {
Expand Down Expand Up @@ -177,6 +179,12 @@ message EvaluateSIPDispatchRulesResponse {
// NEXT ID: 18
}

message UpdateSIPCallStateRequest {
livekit.SIPCallInfo call_info = 1;

// NEXT ID: 2
}

enum SIPFeature {
NONE = 0;
KRISP_ENABLED = 1;
Expand Down
2 changes: 1 addition & 1 deletion replay/cloud_replay.pb.go

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

605 changes: 333 additions & 272 deletions rpc/io.pb.go

Large diffs are not rendered by default.

195 changes: 107 additions & 88 deletions rpc/io.psrpc.go

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions rpc/participant.psrpc.go

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

24 changes: 12 additions & 12 deletions rpc/room.psrpc.go

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

8 changes: 4 additions & 4 deletions rpc/roommanager.psrpc.go

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

0 comments on commit b754791

Please sign in to comment.