From d1b95c28b34fd2a0797bb45da00b5f0afddefe24 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Wed, 18 Nov 2026 20:29:57 +0530 Subject: [PATCH] service: stamp the join request time for every participant kind (#5240) lk.rtc.joinRequestTime was set only for standard participants. SIP, agent, egress and other participants now get it too, so the time a participant reached the signal node is known for every kind. Co-authored-by: Claude Opus 5.5 --- pkg/service/rtcservice.go | 4 ++-- pkg/service/rtcservice_test.go | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pkg/service/rtcservice.go b/pkg/service/rtcservice.go index 67b91ddef..9b8b23914 100644 --- a/pkg/service/rtcservice.go +++ b/pkg/service/rtcservice.go @@ -782,9 +782,9 @@ func (s *RTCService) startConnection( return cr, initialResponse, nil } -// stampJoinRequestTime sets when the server received a new user's join request. +// stampJoinRequestTime sets when the server received a new participant's join request. func stampJoinRequestTime(pi *routing.ParticipantInit, at time.Time) { - if pi.Reconnect || pi.Grants.GetParticipantKind() != livekit.ParticipantInfo_STANDARD { + if pi.Reconnect { return } if pi.Grants.Attributes == nil { diff --git a/pkg/service/rtcservice_test.go b/pkg/service/rtcservice_test.go index 8aa7b2d01..07aa821be 100644 --- a/pkg/service/rtcservice_test.go +++ b/pkg/service/rtcservice_test.go @@ -125,9 +125,15 @@ func TestStampJoinRequestTime(t *testing.T) { require.Empty(t, stamped(routing.ParticipantInit{Reconnect: true, Grants: &auth.ClaimGrants{}})) }) - t.Run("agent", func(t *testing.T) { - grants := &auth.ClaimGrants{} - grants.SetParticipantKind(livekit.ParticipantInfo_AGENT) - require.Empty(t, stamped(routing.ParticipantInit{Grants: grants})) + t.Run("every participant kind", func(t *testing.T) { + for _, kind := range []livekit.ParticipantInfo_Kind{ + livekit.ParticipantInfo_SIP, + livekit.ParticipantInfo_AGENT, + livekit.ParticipantInfo_EGRESS, + } { + grants := &auth.ClaimGrants{} + grants.SetParticipantKind(kind) + require.Equal(t, map[string]string{livekit.AttrRTCJoinRequestTime: "1700000000123"}, stamped(routing.ParticipantInit{Grants: grants}), kind.String()) + } }) }