Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SIP analytics events #831

Merged
merged 20 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
668 changes: 401 additions & 267 deletions livekit/livekit_analytics.pb.go

Large diffs are not rendered by default.

1,097 changes: 627 additions & 470 deletions livekit/livekit_sip.pb.go

Large diffs are not rendered by default.

240 changes: 125 additions & 115 deletions livekit/livekit_sip.twirp.go

Large diffs are not rendered by default.

25 changes: 21 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,17 @@ 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;
dennwc marked this conversation as resolved.
Show resolved Hide resolved
SIP_CALL_STARTED = 37;
SIP_CALL_ENED = 38;
dennwc marked this conversation as resolved.
Show resolved Hide resolved

// NEXT_ID: 39
}

message AnalyticsClientMeta {
Expand Down Expand Up @@ -152,8 +162,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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the SIP service responsible for sending analytics?

If so, we need to pass Trunk and Dispatch Rule infos via internal protocol to file these fields.

Or will the other service file them based on the IDs above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current plan is to have livekit-server (OSS) and cloud-io (cloud) send these events. We will need some sort of "UpdateSIPCallState" internal call sip -> livekit/cloud-io to trigger the analytics event.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth declaring it in this PR as well?

SIPOutboundTrunkInfo sip_outbound_trunk = 30;
string sip_dispatch_rule_id = 31;
SIPDispatchRuleInfo sip_dispatch_rule = 32;

// NEXT_ID: 33
}

message AnalyticsEvents {
Expand Down
14 changes: 14 additions & 0 deletions protobufs/livekit_sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ option csharp_namespace = "LiveKit.Proto";
option ruby_package = "LiveKit::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 @@ -416,3 +417,16 @@ message TransferSIPParticipantRequest {
string room_name = 2;
string transfer_to = 3;
}

message SIPCallInfo {
string call_id = 1;
string trunk_id = 2;
string room_id = 3; // ID of the current/previous room published to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we include the name as well?

Note to @dennwc, room creation is async, and it could take a few seconds before the room ID resolves.

string from_user = 4;
string to_user = 5;
string to_host = 6;
string src_address = 7;
dennwc marked this conversation as resolved.
Show resolved Hide resolved
int64 started_at = 8;
int64 ended_at = 9;
DisconnectReason disconnect_reason = 10;
}
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.