Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/im/lib/call/ |
Upload File : |
<?php namespace Bitrix\Im\Call; use Bitrix\Im\Model\CallTable; use Bitrix\Im\V2\Call\CallFactory; class Registry { /** @var Call[] */ protected static array $calls = []; /** * @param int $id Id of the call * @return Call|null */ public static function getCallWithId(int $id): ?Call { if (static::$calls[$id] instanceof Call) { return static::$calls[$id]; } $row = CallTable::getRowById($id); if (!$row) { return null; } static::$calls[$id] = CallFactory::createWithArray($row['PROVIDER'], $row); return static::$calls[$id]; } /** * @param string $uuid internal call Id * @return Call|null */ public static function getCallWithUuid(string $uuid): ?Call { foreach (static::$calls as $call) { if ($call instanceof Call && $call->getUuid() === $uuid) { return $call; } } $row = CallTable::getList([ 'select' => ['*'], 'filter' => ['=UUID' => $uuid], 'limit' => 1, ])->fetch(); if (!$row) { return null; } static::$calls[$row['ID']] = CallFactory::getCallInstance($row['PROVIDER'], $row); return static::$calls[$row['ID']]; } }