diff options
author | Joas Schilling <coding@schilljs.com> | 2020-11-04 14:03:50 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-11-26 11:46:45 +0300 |
commit | f9813a584d2110d160db6310c96129a13dba8ca4 (patch) | |
tree | 12e429f4abf0af47cdec6803d0cc4ddbc01f013f /lib | |
parent | b05a602b3370885cc3edafcf50607e304ec531eb (diff) |
Dispatch leave call events when the user was in call while leaving the conversation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Service/ParticipantService.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 89923443b..8707cf3ca 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -320,7 +320,17 @@ class ParticipantService { $session = $participant->getSession(); if ($session instanceof Session) { + $dispatchLeaveCallEvents = $session->getInCall() !== Participant::FLAG_DISCONNECTED; + if ($dispatchLeaveCallEvents) { + $event = new ModifyParticipantEvent($room, $participant, 'inCall', Participant::FLAG_DISCONNECTED, $session->getInCall()); + $this->dispatcher->dispatch(Room::EVENT_BEFORE_SESSION_LEAVE_CALL, $event); + } + $this->sessionMapper->delete($session); + + if ($dispatchLeaveCallEvents) { + $this->dispatcher->dispatch(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $event); + } } else { $this->sessionMapper->deleteByAttendeeId($participant->getAttendee()->getId()); } |