Commit Graph

673 Commits

Author SHA1 Message Date
Raja Subramanian
49b75e94a6 Consolidate operations on LocalNode. (#3140) 2024-10-25 18:57:23 +05:30
Paul Wells
b0d3d65f18 update events package (#3126)
* update events package

* deps
2024-10-21 23:44:00 -07:00
David Zhao
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 Pracht
d751f209d5 Allow requesting a dialtone during call transfer (#3122) 2024-10-21 21:05:31 -07:00
Raja Subramanian
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 Cherry
19c5ed6343 Parse python, cpp, unity-web, node sdks in clientinfo (#3110) 2024-10-16 20:18:44 -07:00
Denys Smirnov
50b4d6605e Type safe IP checks for SIP Trunks. (#3108) 2024-10-16 17:48:55 +03:00
Raja Subramanian
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 Zhao
33098337fc Support for attributes in initial agent token (#3097) 2024-10-14 22:45:10 -07:00
David Zhao
c41913225d Log fields in SIP service (#3096) 2024-10-14 16:00:15 -07:00
David Zhao
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 Wells
00ac004604 use AgentDispatch in internal request (#3074)
* use AgentDispatch in internal request

* deps

* deps

* deps
2024-10-08 01:25:00 -07:00
Paul Wells
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 Subramanian
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 Wells
8befc8224a use canonical room log field name (#3054) 2024-09-27 16:52:34 -07:00
Raja Subramanian
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 Wells
096157e706 clean up worker jobs in handler when job ends (#3042) 2024-09-25 03:04:01 -07:00
holzgeist
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 Wells
d26ade0076 add helpers for partiicpant reconnect and version (#3034) 2024-09-22 23:37:35 -07:00
Paul Wells
5e3b3ee3c1 return copy of job state when starting job (#3035) 2024-09-22 23:37:06 -07:00
Benjamin Pracht
22c36ef423 Implement SIP TransferParticipant API (#3026) 2024-09-20 12:16:15 -07:00
Paul Wells
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 Subramanian
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 Wells
4deaac2f3f replace proto.Clone calls (#3024)
* replace proto.Clone calls

* deps

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

* test
2024-09-18 00:45:55 -07:00
Denys Smirnov
47a9969f44 Pass project to CreateSIPParticipantRequest. (#3006) 2024-09-16 20:09:33 +03:00
Denys Smirnov
0e68404f2c Support passing SIP headers. (#2993) 2024-09-13 11:06:38 +03:00
Paul Wells
70b84871fe compute agent service affinity from available capacity (#2995) 2024-09-10 18:12:09 -07:00
Paul Wells
b63192a376 add config for signal retry (#2989) 2024-09-08 19:53:19 -07:00
David Zhao
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 Subramanian
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 Kamkar
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 Zhao
91cb4369ef Standardize twirp hooks during server init (#2959) 2024-08-26 00:53:13 -07:00
David Colburn
0fdfe2f5a0 refactor sip create participant (#2949) 2024-08-21 17:13:26 -04:00
Denys Smirnov
7ad6d97b1b Propagate SIP attributes from a Dispatch Rule. (#2943) 2024-08-19 18:09:37 +03:00
Paul Wells
dabbb298c5 mark explicit create paths (#2935) 2024-08-13 22:00:39 -07:00
Paul Wells
c371929535 add roommanager service (#2931)
* add roommanager service

* cleanup

* deps

* timeout

* cleanup

* cleanup

* config

* cleanup
2024-08-13 11:00:41 -07:00
Benjamin Pracht
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 McFaul
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 Wells
e9b6bf43c3 add mock agent for integration tests (#2913)
* add mock agent for integration tests

* cleanup
2024-08-06 19:46:52 -07:00
Paul Wells
de0c5bbd91 use structured logging for create room request (#2912) 2024-08-06 19:45:00 -07:00
Benjamin Pracht
0fd09d73c1 Instantiate default agent dispatches in rtc for better backward compatibility (#2886) 2024-07-22 08:44:13 -07:00
Benjamin Pracht
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
cnderrauber
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 Subramanian
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 Pracht
6c1d5e8699 Do not create room in UpdateRoomMetadata (#2854) 2024-07-11 17:50:30 -07:00
Benjamin Pracht
a1f8e879cd Allow specifying room configuration in token (#2853) 2024-07-10 20:48:19 -07:00
Benjamin Pracht
fb7eb3450e Update agents service to updated protocol (#2837)
- Deprecate namespace field
- Restore former semantic of starting a job for each registered namespace, for a given Agent Name
- Add agentName field
- Use "dispatcher" naming convention
2024-07-08 17:09:11 -07:00
Paul Wells
e511464d3d add handler interface to receive agent worker updates (#2830)
* add handler interface to receive agent worker updates

* cleanup
2024-07-02 13:11:08 -07:00
Benjamin Pracht
32a4d03c9e Implement Agents protocol addition (#2786) 2024-06-27 19:20:52 -07:00