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()) + } }) }