Commit Graph

863 Commits

Author SHA1 Message Date
Fabian Stehle
f3b80b2886 fix: wrap IPv6 addresses in brackets in UDP TURN URLs (RFC 3986) (#4476)
`iceServersForParticipant` builds UDP TURN URLs by interpolating the
node IP directly into a format string:

    fmt.Sprintf("turn:%s:%d?transport=udp", ip, port)

When `NodeIP.V6` is set, `ToStringSlice()` includes the bare IPv6
address, producing URLs like:

    turn:2a05:d014:ee4:1201:7039:38c:f652:a252:443?transport=udp

RFC 3986 §3.2.2 requires IPv6 addresses in URIs to be enclosed in
square brackets. Without them the port is ambiguous and WebRTC clients
(e.g. libdatachannel) reject the URL with "Invalid ICE server port".

Use `net.JoinHostPort` which handles bracketing for IPv6 and is a
no-op for IPv4, producing well-formed URLs:

    turn:[2a05:d014:ee4:1201:7039:38c:f652:a252]:443?transport=udp
    turn:1.2.3.4:443?transport=udp
2026-04-24 14:28:25 +05:30
Anunay Maheshwari
1d804737f9 fix: limit join request and WHIP request body to http.DefaultMaxHeaderBytes (#4450)
* fix: CS-1665

* cleanup

* cleanup and testes

* updates
2026-04-16 01:12:33 +05:30
cnderrauber
ce1bf47b5c Revert "fix: ensure num_participants is accurate in webhook events (#4265) (#…" (#4448)
This reverts commit cdb0769c38.
2026-04-13 22:21:22 +08:00
Onyeka Obi
cdb0769c38 fix: ensure num_participants is accurate in webhook events (#4265) (#4422)
* fix: ensure num_participants is accurate in webhook events (#4265)

  Three fixes for stale/incorrect num_participants in webhook payloads:

  1. Move participant map insertion before MarkDirty in join path so
     updateProto() counts the new participant.
  2. Use fresh room.ToProto() for participant_joined webhook instead of
     a stale snapshot captured at session start.
  3. Remove direct NumParticipants-- in leave path (inconsistent with
     updateProto's IsDependent check), force immediate proto update,
     and wait for completion before triggering onClose callbacks.

* fix: use ToProtoConsistent for webhook events instead of forcing immediate updates
2026-04-13 09:26:14 +08:00
Raja Subramanian
c91e79af35 Switch to stdlib maps, slices (#4445)
* Switch to stdlib maps, slices

* slices
2026-04-13 00:11:48 +05:30
David Zhao
4b3856125c chore: pin GH commits and switch to golangci-lint (#4444)
* chore: pin GH commits

* switch to golangci-lint-action

* fix lint issues
2026-04-11 13:04:22 -07:00
Paul Wells
88c77dc666 compute agent dispatch affinity from target load (#4442)
* compute agent dispatch affinity from target load

* fix test config
2026-04-09 13:49:43 -07:00
Raja Subramanian
8fe9937770 Log join duration. (#4433)
* Log join duration.

Also revert the "unresolved" init. Defeated the purpose of log resolver
as it was resolving with those values even if not forced. Instead set it
to "unresolved" if not set when forced.

Join duration is not reset if resolver is reset as that happens on
moving a participant and there is no new join duration in that case.

* explode
2026-04-05 14:01:43 +05:30
Raja Subramanian
050909e627 Enable data tracks by default. (#4429) 2026-04-04 00:54:48 +05:30
David Zhao
72c7e65c25 chore: log API key during worker registration (#4428) 2026-04-03 09:48:42 -07:00
Raja Subramanian
8a67dd1b9f Do not close publisher peer connection to aid migration. (#4427) 2026-04-03 21:50:59 +05:30
Raja Subramanian
91e90c1020 Add some more logging around migration. (#4426)
Some e2e is failing due to subscriptions happening late and the expected
order of m-lines is different. Not a hard failure, but logging more to
make seeing this easie.
2026-04-03 13:07:32 +05:30
Raja Subramanian
7d06cfca8b Keep subscription synchronous when publisher is expected to resume. (#4424)
Subscription can switch between remote track and local track or
vice-versa. When that happens, closing the subscribed track of one or
the other asynchronously means the re-subscribe could race with
subscribed track closing.

Keeping the case of `isExpectedToResume` sync to prevent the race.

Would be good to support multiple subscribed tracks per subscription.
So, when subscribed track closes, subscription manager can check and
close the correct subscribed track. But, it gets complex to clearly
determine if a subccription is pending or not and other events. So,
keeping it sync.
2026-04-02 19:54:14 +05:30
Omar Pakker
e9b113c8f2 Make the TURN bind address configurable and allow for multiple addresses. (#4315) 2026-03-30 14:46:10 +08:00
Anunay Maheshwari
ff7fd7ed56 feat(agent-dispatch): add job restart policy (#4401)
* feat(agent-dispatch): add job restart policy

* deps
2026-03-27 21:32:04 +05:30
Raja Subramanian
9055a34981 Path check helpers (#4392)
* Path check helpers

* remove trailing slash
2026-03-25 10:53:07 +05:30
cnderrauber
1f1eeb6832 Fallback to servicestore if rpc is unavailable (#4391)
* Fallback to servicestore if rpc is unavailable

compatibility mode for #4387

* conf
2026-03-25 11:09:52 +08:00
Raja Subramanian
59e9bb41b9 Fix TURN server URL (#4389)
Addresses https://github.com/livekit/livekit/issues/4384
2026-03-24 15:52:05 +05:30
cnderrauber
9474c807c0 route participant reads through PSRPC instead of Redis (#4387)
rel: #4373
2026-03-24 16:25:11 +08:00
Charlie Tonneslan
8cdd6f4cc7 Replace deprecated io/ioutil with io in whipservice (#4375)
ioutil.ReadAll has been deprecated since Go 1.16 in favor of io.ReadAll.
This was the last remaining io/ioutil usage in the codebase.
2026-03-21 10:01:30 -07:00
Paul Wells
c8bb2578be Rename log field "pID" to "participantID" for consistency (#4365)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 04:32:02 -07:00
cnderrauber
e963953817 Refine ipv6 support (#4352)
* Refine ipv6 support

* go mod

* check ipv4 is set in turn
2026-03-09 20:43:00 +08:00
Milos Pesic
b34b047247 Add StopEgress function to the EgressLauncher interface (#4353)
This allows for abstracting away how the stop is implemented - default implementation stays the same - the existing OSS egress launcher just calls the existing Stop method on the client.
2026-03-09 13:17:05 +01:00
He Chen
cb7dc2d02a TEL-405: support originating calls from custom domains (#4349) 2026-03-06 12:25:40 -08:00
Denys Smirnov
493e87dfd4 Fix SIP client timeout. (#4345) 2026-03-05 19:09:17 +02:00
Raja Subramanian
b81bac0ec3 Key telemetry stats worker using combination of roomID, participantID (#4323)
Some checks failed
Test / test (push) Failing after 17s
Release to Docker / docker (push) Failing after 3m42s
* Key telemetry stats work using combination of roomID, participantID

With forwarded participant, the same participantID can existing in two
rooms.

NOTE: This does not yet allow a participant session to report its
events/track stats into multiple rooms. That would require regitering
multiple listeners (from rooms a participant is forwarded to).

* missed file

* data channel stats

* PR comments + pass in room name so that telemetry events have proper room name also
2026-02-16 13:56:13 +05:30
Benjamin Pracht
03e90dd762 Fix for some CodeQL reported issues (#4314)
One of the fix is in updated protocol (logging of a request message that includes the turn server settings, including password).
2026-02-11 10:15:12 -08:00
Jacob Gelman
a6035212f5 ESP32 client info (#4267) 2026-02-11 16:25:02 +11:00
cnderrauber
8ae564065e generate & log egressID for start egress request (#4303)
* generate & log egressID for start egress request

* seprate method

* use ctx value instead of metadata

* comment
2026-02-10 09:34:56 +08:00
Raja Subramanian
52a4b848a4 Read client protocol from query param (#4294)
* Read client protocol from query param

* Atoi -> ParseInt
2026-02-06 11:33:13 +05:30
Nishad
343f12b88f Wrapping SIP errors for invalid argument and not found (#4253) 2026-01-16 12:38:44 -08:00
Raja Subramanian
a35a6ae751 Add participant option for data track auto-subscribe. (#4240)
* Add participant option for data track auto-subscribe.

Default disabled.

* protocol update to use data track auto subscribe setting

* deps
2026-01-14 13:22:43 +05:30
Nishad
07572511ba Wrapping the invalid request errors for CreateSipParticipant (#4239) 2026-01-13 17:37:13 -08:00
Raja Subramanian
18db4ec146 Log modified timeout of API context. (#4232) 2026-01-12 15:53:53 +05:30
Raja Subramanian
ac20ccda53 Log timeout in API. (#4231)
* Log timeout in API.

* make a reset function
2026-01-12 11:22:39 +05:30
Raja Subramanian
52ab3374c6 Return on SDP fragment read error. (#4228) 2026-01-09 14:36:41 +05:30
Denys Smirnov
4ec0f8f4ce Support OpenTelemetry tracing. Add Jaeger support. (#4222) 2026-01-06 17:22:21 +02:00
Raja Subramanian
b649c2fe95 Remove method not needed from REDTransformer. (#4219)
Also assert that the implementation aligns with the interface.
2026-01-05 11:53:24 +05:30
Raja Subramanian
335f4c33fb Swap result sink atomically rather than closing and setting. (#4216)
To prevent WriteMessage after Close potentially.
2026-01-03 03:17:58 +05:30
cnderrauber
d92f6a790f return iceservers for whip (#4210) 2025-12-31 15:10:15 +08:00
Raja Subramanian
b8ddd0f98c Taking interface{} -> any modernize bits (#4204) 2025-12-28 05:22:12 +05:30
Raja Subramanian
2510b9462e Taking a bunch of go modernize suggestions. (#4194)
This is not all of it as it is not possible (or at least I do not know
of a way) to get all suggestions for a repo/project. Did this via loop
searching mainly and taking the modernize suggestions.
2025-12-25 16:55:58 +05:30
cnderrauber
4104b8270b update protocol (#4183)
* update protocol

* fix test
2025-12-22 12:54:11 +08:00
Raja Subramanian
cd99fec2e7 Make new path for signalling v1.5 support. (#4180)
* Make new path for signalling v1.5 support.

To be able to support newer clients to interact with older servers, move
signalling v1.5 to new path (`/rtc1`). On the new path, `join_request`
is required and single peer connection is used.

With the existing path `/rtc`, single peer connection is still supported
if `join_request` is used.

Newer clients connecting to old server should follow
1. Try new path WebSocket
2. If that fails, try new path validate at `/rtc1/validate`.
3. If the above gets a 404 which will happen with older server, revert
   back to old path and signalling 1.0.

Open to suggestions on path name.

* test on both paths

* change path from /rtc1 -> /rtc/v1

* test all rtc service path combinations
2025-12-20 01:02:22 +05:30
Raja Subramanian
e7601251bc Make data message naming a bit more consistent. (#4177)
* Make data message naming a bit more consistent.

OnDataPacket and OnDataMessage half-way in the chain made it confusing
(for me at least). Use same name throughout.
API still uses SendDataPacket, but that is not harder to read.

* test
2025-12-19 12:09:16 +05:30
Raja Subramanian
a04e566dbf Use published track for model access in data down track. (#4176)
* Use published track for model access in data down track.

No need to pass in the model.

* implementation type assertion

* remove redundant log key

* one more type

* Close interface method

* clean up redundant log key

* remove unused method

* some interface changes to support data tracks in replay

* correct mock signature
2025-12-19 11:00:18 +05:30
Jade Ellis
47c86be1df Add support for TURN static auth secret credentials (#3796)
Closes https://github.com/livekit/livekit/issues/2245
2025-12-18 14:16:38 +05:30
Paul Wells
0a82438687 add explicit room exists servicestore op (#4175) 2025-12-17 22:14:06 -08:00
Paul Wells
898ebe058c clean up manual roomservice log redaction (#4165)
* clean up manual roomservice log redaction

* deps
2025-12-16 23:02:45 -08:00
Paul Wells
3e41725395 move delete to oss service store (#4164) 2025-12-16 22:00:43 -08:00