handle AGENT_ERROR disconnect reason (#4339)

This commit is contained in:
Théo Monnom
2026-03-17 23:00:16 -07:00
committed by GitHub
parent 8f984c770a
commit 89410df74c
4 changed files with 10 additions and 3 deletions

View File

@@ -94,6 +94,8 @@ func (s *signalhandler) HandleMessage(msg proto.Message) error {
reason = types.ParticipantCloseReasonUserUnavailable
case livekit.DisconnectReason_USER_REJECTED:
reason = types.ParticipantCloseReasonUserRejected
case livekit.DisconnectReason_AGENT_ERROR:
reason = types.ParticipantCloseReasonAgentError
}
s.params.Logger.Debugw("client leaving room", "reason", reason)
s.params.Participant.HandleLeaveRequest(reason)

View File

@@ -117,6 +117,7 @@ const (
ParticipantCloseReasonUserUnavailable
ParticipantCloseReasonUserRejected
ParticipantCloseReasonMoveFailed
ParticipantCloseReasonAgentError
)
func (p ParticipantCloseReason) String() string {
@@ -177,6 +178,8 @@ func (p ParticipantCloseReason) String() string {
return "USER_REJECTED"
case ParticipantCloseReasonMoveFailed:
return "MOVE_FAILED"
case ParticipantCloseReasonAgentError:
return "AGENT_ERROR"
default:
return fmt.Sprintf("%d", int(p))
}
@@ -214,6 +217,8 @@ func (p ParticipantCloseReason) ToDisconnectReason() livekit.DisconnectReason {
return livekit.DisconnectReason_USER_UNAVAILABLE
case ParticipantCloseReasonUserRejected:
return livekit.DisconnectReason_USER_REJECTED
case ParticipantCloseReasonAgentError:
return livekit.DisconnectReason_AGENT_ERROR
default:
// the other types will map to unknown reason
return livekit.DisconnectReason_UNKNOWN_REASON