Commit Graph

651 Commits

Author SHA1 Message Date
Paul Wells 0dda5fc9e0 Merge remote-tracking branch 'origin/master' into agents-cleanup 2024-09-18 00:46:58 -07:00
Paul Wells 1436a1f186 driveby cleanup (#3017)
* driveby cleanup

* test
2024-09-18 00:45:55 -07:00
Paul Wells 58ce5ed605 simplify agent registration 2024-09-18 00:17:45 -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
holzgeist 6523c9c099 Feat add prometheus auth (#2252)
* feat: add support for basic auth on prometheus

* fix: properly name middleware generator

* refactor: move all prometheus configs into common object

* chore: add suggestions from review

add back old config switch and print warning if it is used

* fix: undo accidental change

* fix: rebase/merge issue
2024-06-27 02:13:51 -07:00
Denys Smirnov 4388618e9a Update protocol. Use SIP grants. (#2808) 2024-06-23 21:54:28 +03:00
David Zhao 7a774cc82a Support for participant attributes (#2806)
* Support for participant attributes

* move metadata setters to LocalParticipant

* address feedback

* forward error

* update go mod

* update attributes first
2024-06-19 23:14:19 -07:00
Denys Smirnov 74c7b93170 Support new SIP Trunk API. Improve Redis tests. (#2799) 2024-06-17 21:49:51 +03:00
Paul Wells 2bc101d323 use request context for LaunchJob api request (#2796)
* use request context for LaunchJob api request

* one more
2024-06-16 21:16:29 -07:00
Théo Monnom 5def48bad9 fix agent jobs not launching when using the CreateRoom API (#2784) 2024-06-13 00:00:02 +02:00
David Colburn 29614cd4a1 clean up egress launcher (#2779) 2024-06-10 16:11:11 -07:00
Paul Wells f1886ece42 update protocol (#2760)
* update protocol

* deps
2024-06-05 19:46:34 -07:00
Paul Wells bc6dbd98c7 fix sip MatchTrunk call (#2740) 2024-05-28 19:04:06 -07:00
Denys Smirnov fa65712a0e Use camel case in SIP logs. (#2738) 2024-05-28 13:43:22 +03:00
cnderrauber e6aa36fdd6 Add forward stats (#2725)
* Add forward metrics

* ignore packets was not forwarded

* rename
2024-05-24 17:43:28 +08:00
Denys Smirnov a444f2477c Update protocol. Support SIP transports. (#2724) 2024-05-23 20:31:01 +03:00
Théo Monnom 9887d32bd2 fix: connection reset without any closing handshake on clientside (#2709) 2024-05-11 13:39:17 +02:00
Benjamin Pracht eef3cf0f01 Redact egress object in CreateRoom request (#2710) 2024-05-10 10:05:53 -07:00
Paul Wells b54acb0bad ensure room is running before attempting to delete (#2705)
* ignore api errors when deleting room

* start room before deletion

* delete from db first

* load
2024-05-09 00:06:41 -07:00
Paul Wells 9a5db132eb add room/participant name limit (#2704)
* add room/participant name limit

* defaults

* simplify

* omitempty

* handle 0 config

* fix race

* unlock

* tidy
2024-05-06 17:25:18 -07:00
Benjamin Pracht f088730007 Add support for EnableTranscoding ingress option (#2681)
This changes the default WHIP ingress behavior to skipping transcode. Other inputs are still always transcoded.
2024-04-26 14:26:00 +02:00
Denys Smirnov 07791ffc00 Pass new SIP metadata. Update protocol. (#2683) 2024-04-26 13:57:39 +03:00
Paul Wells c51b3e3fe2 use ttlcache (#2677)
* use ttlcache

* go

* test
2024-04-23 02:20:54 -07:00
Raja Subramanian 8f05385126 TTL param for ICE config cache (#2676)
* TTL param for ICE config cache

* rename to min
2024-04-23 10:49:55 +05:30
David Colburn 8f8825cb88 fix participant, ensure room name matches (#2660) 2024-04-17 13:12:57 -07:00
Benjamin Pracht 6afa63ded3 Use the ingress state updated_at field to ensure that out of order RPC do not overwrite state (#2657) 2024-04-16 18:10:14 +02:00