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

Add SIP analytics events #831

merged 20 commits into from
Oct 14, 2024

Conversation

biglittlebigben
Copy link
Contributor

No description provided.

Copy link

changeset-bot bot commented Oct 3, 2024

🦋 Changeset detected

Latest commit: 54996f8

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "github.com/livekit/protocol" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

protobufs/livekit_analytics.proto Outdated Show resolved Hide resolved
protobufs/livekit_sip.proto Outdated Show resolved Hide resolved
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?

Copy link
Member

@davidzhao davidzhao left a comment

Choose a reason for hiding this comment

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

lg, just a couple of Qs

Comment on lines 121 to 123
SIP_CALL_ACCEPTED = 37;
SIP_CALL_STARTED = 38;
SIP_CALL_ENDED = 39;
Copy link
Member

Choose a reason for hiding this comment

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

does this differentiate between inbound and outbound calls? should we have a separate status for CONNECTING or is that what STARTED is? for example the flow for inbound:

  • CONNECTING -> when sip picks up, but no user on the other side
  • ACCEPTED -> when sip connects to end user.

and for outbound

  • CONNECTING -> when we start dialing for outbound
  • ACCEPTED -> when the other side picks up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the current proposal, PARTICIPANT_CREATED and CALL_ACCEPTED match the "CONNECTING" state you suggest in the outbound and inbound cases respectively. I guess ACCEPTED may be confusing as it means that the SIP server accepted it, not the room. Maybe use "CALL_INCOMING"?

SIP_PARTICIPANT_CREATED has the pro that it relates directly to an API call IMHO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or CALL_ACCEPTED -> RINGING?

Copy link
Member

Choose a reason for hiding this comment

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

got it. so accepted is for incoming only.. makes sense.. then I would vote for INCOMING, since it's a bit more explicit about that fact. wdyt?

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.

SIP_CALL_STARTING = 0;
SIP_CALL_ACTIVE = 1;
SIP_CALL_DISCONNECTED = 2;
SIP_CALL_STATUS_CALL_INCOMING = 0;
Copy link
Member

Choose a reason for hiding this comment

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

kind of a nit.. these enums are pretty long.. wdyt about using abbrevations like SIP_ or SCS_

Copy link
Member

Choose a reason for hiding this comment

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

and since it could be confusing what each status means, wanna just put comments in here?

@biglittlebigben biglittlebigben merged commit b754791 into main Oct 14, 2024
1 check passed
@biglittlebigben biglittlebigben deleted the benjamin/SIP_events branch October 14, 2024 22:04
This was referenced Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants