Commit Graph
676 Commits
Author SHA1 Message Date
Denys SmirnovandGitHub 55d084fd18 Annotate SIP errors with Twirp codes. (#3161) 2024-11-07 17:00:57 +02:00
Paul WellsandGitHub 09f140afa8 auto create rooms during create agent dispatch api request (#3158) 2024-11-05 16:15:05 -08:00
Raja SubramanianandGitHub 365e63230d Some misc clean up. (#3156)
* Some misc clean up.

- Have been seeing counterfeiter warnings about efficiency for a while
  with go:generate declaration multiple times in the same package.
  Address that: https://github.com/maxbrunsfeld/counterfeiter?tab=readme-ov-file#step-2b---add-counterfeitergenerate-directives
- A bit more readability on parameters passed to `sendLeave`

* spacing

* revert some deletes as the complaint was in analytics service only

* Declare in package only once.

Although the warning is about go:generate multiple times when directly
giving the interface to generate, have `go:generate` multiple times in a
package even with `-generate` ends up generating once per invocation.
Once per package is enough to run the generation just once.
2024-11-04 11:26:41 +05:30
Raja SubramanianandGitHub 49b75e94a6 Consolidate operations on LocalNode. (#3140) 2024-10-25 18:57:23 +05:30
Paul WellsandGitHub b0d3d65f18 update events package (#3126)
* update events package

* deps
2024-10-21 23:44:00 -07:00
dd7cd7eafc Handle room configuration that's set in the grant itself (#3120)
* Handle room configuration that's set in the grant itself

* ensure refresh token contains updates

* deps

* dep

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
2024-10-21 23:31:12 -07:00
Benjamin PrachtandGitHub d751f209d5 Allow requesting a dialtone during call transfer (#3122) 2024-10-21 21:05:31 -07:00
Raja SubramanianandGitHub 40b10af960 Use monotonic time util. (#3112)
Thank you @paulwe for doing this. I was promising to do this for a
while, but just like other times, empty promises :-(
2024-10-17 10:49:24 +05:30
Ben CherryandGitHub 19c5ed6343 Parse python, cpp, unity-web, node sdks in clientinfo (#3110) 2024-10-16 20:18:44 -07:00
Denys SmirnovandGitHub 50b4d6605e Type safe IP checks for SIP Trunks. (#3108) 2024-10-16 17:48:55 +03:00
Raja SubramanianandGitHub 8221471b67 Protocol update to get more precise protoproxy timing (#3107)
* Protocol update to get more precise protoproxy timing

* really update protocol
2024-10-16 18:43:09 +05:30
David ZhaoandGitHub 33098337fc Support for attributes in initial agent token (#3097) 2024-10-14 22:45:10 -07:00
David ZhaoandGitHub c41913225d Log fields in SIP service (#3096) 2024-10-14 16:00:15 -07:00
2d6aa049c9 Improve agent job assignment logging (#3090)
* Improve agent job assignment logging

* add more agent logging

---------

Co-authored-by: Paul Wells <paulwe@gmail.com>
2024-10-13 00:56:51 -07:00
Paul WellsandGitHub 00ac004604 use AgentDispatch in internal request (#3074)
* use AgentDispatch in internal request

* deps

* deps

* deps
2024-10-08 01:25:00 -07:00
Paul WellsandGitHub 3261560098 api for agent worker job count (#3068)
* api for agent worker job count

* cleanup

* temp deps

* temp deps

* deps
2024-10-05 05:13:52 -07:00
Raja SubramanianandGitHub 2491ee7c7c Make lite version of RTPStatsReceiver called RTPStatsReceiverLite. (#3065)
* Make lite version of RTPStatsReceiver called RTPStatsReceiverLite.

Refactor around that.

Will probably make some more flavors to have lighter versions still.

* update deps

* use MarshalLogArray

* use util
2024-10-05 10:50:25 +05:30
Paul WellsandGitHub 8befc8224a use canonical room log field name (#3054) 2024-09-27 16:52:34 -07:00
Raja SubramanianandGitHub 45f23f6fc4 Update protocol to get lower case check for kind and source. (#3048)
Also, log kind in starting RTC session and store a clone always in
participants.
2024-09-26 15:45:42 +05:30
Paul WellsandGitHub 096157e706 clean up worker jobs in handler when job ends (#3042) 2024-09-25 03:04:01 -07:00
holzgeistandGitHub 9b277803c6 fix: copy attributes to refresh token (#3036)
otherwise they will be missing on a full reconnect
2024-09-23 08:31:21 -07:00
Paul WellsandGitHub d26ade0076 add helpers for partiicpant reconnect and version (#3034) 2024-09-22 23:37:35 -07:00
Paul WellsandGitHub 5e3b3ee3c1 return copy of job state when starting job (#3035) 2024-09-22 23:37:06 -07:00
Benjamin PrachtandGitHub 22c36ef423 Implement SIP TransferParticipant API (#3026) 2024-09-20 12:16:15 -07:00
Paul WellsandGitHub 61179d5624 simplify agent registration (#3018)
* simplify agent registration

* testutils

* deps

* fix

* gen

* cleanup

* lower job load
2024-09-19 05:58:30 -07:00
Raja SubramanianandGitHub 7df6f86693 Initial plumbing for metrics. (#2950)
* Initial plumbing for metrics.

This implements
- metrics received from participant.
- callback to room.
- room distributes it to all other participants (excluding the sending
  participant).
- other participants forward to client.
- counting metrics bytes in data channel stats

TODO:
  - recording/processing/batching
  - should recording/processing/batching happen on publisher side or
    subscriber side?
  - should metrics be echoed back to publisher?
  - grants to publish/subscribe metrics.

* mage generate

* clear OnMetrics on close

* - CanSubscribeMetrics permission.
- Echo back to sender.

* update deps

* No destination identities for metrics

* WIP

* use normalized timestamp for server injected timestamps

* compile

* debug log metrics batch

* correct comment

* add baseTime to wire

* protocol dep

* Scope metrics forwarding to only participants that a participant is
subscribed to.

Also remove the participant_metrics.go file as it was not doing anything
useful.

* update comment

* utils.ErrorIsOneOf

* couple of more utils.CloneProto
2024-09-19 11:42:31 +05:30
Paul WellsandGitHub 4deaac2f3f replace proto.Clone calls (#3024)
* replace proto.Clone calls

* deps

* tests
2024-09-18 22:47:33 -07:00
Paul WellsandGitHub 1436a1f186 driveby cleanup (#3017)
* driveby cleanup

* test
2024-09-18 00:45:55 -07:00
Denys SmirnovandGitHub 47a9969f44 Pass project to CreateSIPParticipantRequest. (#3006) 2024-09-16 20:09:33 +03:00
Denys SmirnovandGitHub 0e68404f2c Support passing SIP headers. (#2993) 2024-09-13 11:06:38 +03:00
Paul WellsandGitHub 70b84871fe compute agent service affinity from available capacity (#2995) 2024-09-10 18:12:09 -07:00
Paul WellsandGitHub b63192a376 add config for signal retry (#2989) 2024-09-08 19:53:19 -07:00
David ZhaoandGitHub 50576b503e Handle trailing slashes in URL (#2988)
When a user includes a trailing slash in LIVEKIT_URL, it would produce
double slashes in the path, i.e. `https://myhost.livekit.cloud//twirp/RoomService.ListRooms`

Currently the server will send a 302 MOVED response, causing Twirp requests to fail.

We now remove the double slash in front within the middleware.
2024-09-07 11:30:24 -07:00
Raja SubramanianandGitHub bec7453a1f Recreate stats worker on resume if needed. (#2982)
* Ref count the stats worker.

NOTE: Don't liek this much, but wanted to open this get some 👀 on
this and get feedback.

There are two entities, one for counting signal bytes and another for
media stats. They both send `ParticipantJoined` and `ParticipantLeft`
event.

In the case of a participant resume, as the old web socket
connection is closed, that triggers a signal stats counter close. That
would call `ParticipantLeft` and that would close the stats worker.

The closed stats worker got reaped in `FlushStats` after three minutes.

So, all events after that did not have a worker and hence went
unreported including missing participant_left webhook because it relied
on checking if a participant was ever connected and that needed to check
the worker state.

Using a ref count to keep track of join/leaves. And not close the worker
until ref count goes down to 0.

* create a stats worker on resume

* revert incorrect changes

* transfer connected state

* transfer connected state when creating worker

* resolve participant on a resume
2024-09-06 23:58:03 +05:30
Mathew KamkarandGitHub 730fe51642 exponential backoff when calling CreateRoom (#2977)
* exponential backoff when calling CreateRoom

* dz+bb review: check ctx cancellation, remove retry max

* bb review: fix loop condition

* raja review: use timer, bring back max tries
2024-09-04 23:18:31 -07:00
David ZhaoandGitHub 91cb4369ef Standardize twirp hooks during server init (#2959) 2024-08-26 00:53:13 -07:00
David ColburnandGitHub 0fdfe2f5a0 refactor sip create participant (#2949) 2024-08-21 17:13:26 -04:00
Denys SmirnovandGitHub 7ad6d97b1b Propagate SIP attributes from a Dispatch Rule. (#2943) 2024-08-19 18:09:37 +03:00
Paul WellsandGitHub dabbb298c5 mark explicit create paths (#2935) 2024-08-13 22:00:39 -07:00
Paul WellsandGitHub c371929535 add roommanager service (#2931)
* add roommanager service

* cleanup

* deps

* timeout

* cleanup

* cleanup

* config

* cleanup
2024-08-13 11:00:41 -07:00
Benjamin PrachtandGitHub 64057c3e4d Implement AgentDispatch service (#2919)
This allows listing, adding and deleting agent dispatches on an existing room. Requests go to a new AgentDispatchService, which sends them over RPC to the rtc.Room via the RoomManager. The rtc.Room then does agent job management using RPCs to the agent service.
2024-08-08 22:31:23 +02:00
Dan McFaulandGitHub 489f73f0a4 distribute load to agents probabilistically, inversely proportionate to load (#2902)
* select the least loaded agent worker for job dispatch

* update to load balance using inverse load

* remove unused file

* adding unit tests for worker job distribution
2024-08-07 21:05:47 -06:00
Paul WellsandGitHub e9b6bf43c3 add mock agent for integration tests (#2913)
* add mock agent for integration tests

* cleanup
2024-08-06 19:46:52 -07:00
Paul WellsandGitHub de0c5bbd91 use structured logging for create room request (#2912) 2024-08-06 19:45:00 -07:00
Benjamin PrachtandGitHub 0fd09d73c1 Instantiate default agent dispatches in rtc for better backward compatibility (#2886) 2024-07-22 08:44:13 -07:00
Benjamin PrachtandGitHub a877ba2352 Partial support for agent dispatch management (#2872)
- Store agent dispaches independently of room agents on rtc.Room
- Serialize agent dispatches in rtc.Room
- Support for agent dispatch and job serialization in redis

The agent Job object references denormalized Room and ParticipantInfo object. When storing Jobs, this sets the Room to nil, and only stores the Participant identity field. When read back, these fields need to be set to their current value.
2024-07-18 13:36:43 -07:00
cnderrauberandGitHub 5e1b18dab3 Add option to disable ice lite (#2862)
Some sfu's ice agent implementation has problem
to establish ice connection with lite ice agent,
add option to let client to disble it in server side.
2024-07-15 15:11:46 +08:00
Raja SubramanianandGitHub 09e3aef859 Check size limits on metadata and name set from client. (#2850)
* Send error response when update metadata fails.

Keeping it simple for the first implementation.
- Send error response only if request_id != 0
- Two kinds of errors notified
  o does not have permissions - NOT_ALLOWED
  o attributes exceeds size limits -  INVALID_ARGUMENT

* Check size limits on metadata and name set from client.

Added a name length limit also.

* check name length in service update participant path also

* limit check in limit config

* update protocol

* longer keys
2024-07-12 09:57:17 +05:30
Benjamin PrachtandGitHub 6c1d5e8699 Do not create room in UpdateRoomMetadata (#2854) 2024-07-11 17:50:30 -07:00
Benjamin PrachtandGitHub a1f8e879cd Allow specifying room configuration in token (#2853) 2024-07-10 20:48:19 -07:00