- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/controller/call.php
- Класс: BitrixImControllerCall
- Вызов: Call::inviteAction
public function inviteAction($callId, array $userIds, $video = "N", $legacyMobile = "N", $repeated = "N")
{
$isVideo = ($video === "Y");
$isLegacyMobile = ($legacyMobile === "Y");
$isRepeated = ($repeated === "Y");
$currentUserId = $this->getCurrentUser()->getId();
$call = Registry::getCallWithId($callId);
if (!$call)
{
$this->addError(new Error(Loc::getMessage("IM_REST_CALL_ERROR_CALL_NOT_FOUND"), "call_not_found"));
return null;
}
if(!$this->checkCallAccess($call, $currentUserId))
return null;
$call->getUser($currentUserId)->update([
'LAST_SEEN' => new DateTime(),
'IS_MOBILE' => ($isLegacyMobile ? 'Y' : 'N')
]);
$lockName = static::getLockNameWithCallId($callId);
if (!Application::getConnection()->lock($lockName, static::LOCK_TTL))
{
$this->addError(new Error("Could not get exclusive lock", "could_not_lock"));
return null;
}
$this->inviteUsers($call, $userIds, $isLegacyMobile, $isVideo, $isRepeated);
Application::getConnection()->unlock($lockName);
return true;
}