- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/controller/call.php
- Класс: BitrixImControllerCall
- Вызов: Call::createChildCallAction
public function createChildCallAction($parentId, $newProvider, $newUsers)
{
$currentUserId = $this->getCurrentUser()->getId();
$parentCall = Registry::getCallWithId($parentId);
if (!$parentCall)
{
$this->addError(new Error(Loc::getMessage("IM_REST_CALL_ERROR_CALL_NOT_FOUND"), "call_not_found"));
return null;
}
if(!$this->checkCallAccess($parentCall, $currentUserId))
{
$this->errorCollection[] = new Error("You do not have access to the parent call", "access_denied");
return null;
}
$childCall = $parentCall->makeClone($newProvider);
$initiator = $childCall->getUser($currentUserId);
$initiator->updateState(CallUser::STATE_READY);
$initiator->updateLastSeen(new DateTime());
foreach ($newUsers as $userId)
{
if(!$childCall->hasUser($userId))
{
$childCall->addUser($userId)->updateState(CallUser::STATE_CALLING);
}
}
$users = $childCall->getUsers();
return array(
'call' => $childCall->toArray(),
'connectionData' => $childCall->getConnectionData($currentUserId),
'users' => $users,
'userData' => Util::getUsers($users),
'logToken' => $childCall->getLogToken($currentUserId)
);
}