diff options
author | Joas Schilling <coding@schilljs.com> | 2020-11-03 11:49:15 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-11-26 11:46:44 +0300 |
commit | f4d0368d1442ccfdfbe0418d0eb860da66e6fbe8 (patch) | |
tree | caabad2a98669fb467ed7e03f35055f8baa8c875 /lib | |
parent | 02aa7650cbaa20356d9eaf6a37d8984bd76b750e (diff) |
Generate a PIN for users when they join a room with SIP enabled
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/RoomController.php | 1 | ||||
-rw-r--r-- | lib/Service/ParticipantService.php | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 3b81127e2..fd37addb6 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -1476,6 +1476,7 @@ class RoomController extends AEnvironmentAwareController { $result = $room->verifyPassword((string) $this->session->getPasswordForRoom($token)); if ($user instanceof IUser) { $participant = $this->participantService->joinRoom($room, $user, $password, $result['result']); + $this->participantService->generatePinForParticipant($room, $participant); } else { $participant = $this->participantService->joinRoomAsNewGuest($room, $password, $result['result']); } diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index bdf1fe5b3..89923443b 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -279,6 +279,16 @@ class ParticipantService { return new Participant($room, $attendee, null); } + public function generatePinForParticipant(Room $room, Participant $participant): void { + $attendee = $participant->getAttendee(); + if ($room->getSIPEnabled() === Webinary::SIP_ENABLED + && $this->talkConfig->isSIPConfigured() + && !$attendee->getPin()) { + $attendee->setPin($this->generatePin()); + $this->attendeeMapper->update($attendee); + } + } + public function ensureOneToOneRoomIsFilled(Room $room): void { if ($room->getType() !== Room::ONE_TO_ONE_CALL) { return; |