• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/call.php
  • Класс: BitrixVoximplantCall
  • Вызов: Call::handleUserConnected
public function handleUserConnected($userId, $device)
{
	$updatedFields = [
		'STATUS' => ModelCallTable::STATUS_CONNECTED
	];

	if(isset($this->users[$userId]))
	{
		$this->updateUserStatus($userId, CallUserTable::STATUS_CONNECTED, $device);

		if(in_array($this->incoming, [CVoxImplantMain::CALL_INCOMING, CVoxImplantMain::CALL_INCOMING_REDIRECT, CVoxImplantMain::CALL_CALLBACK]))
		{
			$updatedFields['USER_ID'] = $userId;

			CVoxImplantCrmHelper::updateCrmEntities($this->getCreatedCrmEntities(), ['ASSIGNED_BY_ID' => $userId]);
		}
	}
	$this->update($updatedFields);

	$userToRemove = [];
	foreach ($this->users as $userId => $user)
	{
		if ($user['STATUS'] == CallUserTable::STATUS_INVITING || $user['STATUS'] == CallUserTable::STATUS_CONNECTING)
		{
			$userToRemove[] = $userId;
		}
		else if ($user['STATUS'] == CallUserTable::STATUS_CONNECTED)
		{
			if ($this->isInternalCall() && !$this->portalUserId && $userId != $this->getUserId())
			{
				$this->updatePortalUserId($userId);
				$this->signaling->sendUpdatePortalUser($this->getUserId());
			}
			$this->signaling->sendStart($userId, $user['DEVICE']);
		}
	}

	$this->removeUsers($userToRemove);
}