<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
* @author Lukas Reschke <lukas@statuscode.ch>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Talk\Controller;
use GuzzleHttp\Exception\ConnectException;
use OCA\Talk\Config;
use OCA\Talk\Events\SignalingEvent;
use OCA\Talk\Exceptions\ParticipantNotFoundException;
use OCA\Talk\Exceptions\RoomNotFoundException;
use OCA\Talk\Manager;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Model\Session;
use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCA\Talk\Service\ParticipantService;
use OCA\Talk\Service\SessionService;
use OCA\Talk\Signaling\Messages;
use OCA\Talk\TalkSession;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
use OCP\AppFramework\Http\Attribute\PublicPage;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\DB\Exception;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Security\Bruteforce\IThrottler;
use Psr\Log\LoggerInterface;
class SignalingController extends OCSController {
/** @var int */
private const PULL_MESSAGES_TIMEOUT = 30;
public const EVENT_BACKEND_SIGNALING_ROOMS = self::class . '::signalingBackendRoom';
private Config $talkConfig;
private \OCA\Talk\Signaling\Manager $signalingManager;
private TalkSession $session;
private Manager $manager;
private ParticipantService $participantService;
private SessionService $sessionService;
private IDBConnection $dbConnection;
private Messages $messages;
private IUserManager $userManager;
private IEventDispatcher $dispatcher;
private ITimeFactory $timeFactory;
private IClientService $clientService;
private LoggerInterface $logger;
private ?string $userId;
public function __construct(
string $appName,
IRequest $request,
IConfig $serverConfig,
Config $talkConfig,
\OCA\Talk\Signaling\Manager $signalingManager,
TalkSession $session,
Manager $manager,
ParticipantService $participantService,
SessionService $sessionService,
IDBConnection $connection,
Messages $messages,
IUserManager $userManager,
IEventDispatcher $dispatcher,
ITimeFactory $timeFactory,
IClientService $clientService,
IThrottler $throttler,
LoggerInterface $logger,
?string $UserId,
) {
parent::__construct($appName, $request);
$this->talkConfig = $talkConfig;
$this->signalingManager = $signalingManager;
$this->session = $session;
$this->dbConnection = $connection;
$this->manager = $manager;
$this->participantService = $participantService;
$this->sessionService = $sessionService;
$this->messages = $messages;
$this