• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/routing/router.php
  • Класс: BitrixVoximplantRoutingRouter
  • Вызов: Router::updateCallStateWithAction
protected function updateCallStateWithAction(Action $action)
{
	$firstUserId = 0;
	if($action->getCommand() === Command::INVITE)
	{
		$userIds = [];
		foreach($action->getParameter('USERS') as $userFields)
		{
			$userIds[] = $userFields['USER_ID'];
		}
		if(!empty($userIds))
		{
			$this->call->addUsers($userIds, CallUserTable::ROLE_CALLEE, CallUserTable::STATUS_INVITING);
			$firstUserId = (int)$userIds[0];
		}
	}
	else if($action->getCommand() === Command::PSTN)
	{
		$firstUserId = (int)$action->getParameter('USER_ID');
		if($firstUserId > 0)
		{
			$this->call->addUsers([$firstUserId], CallUserTable::ROLE_CALLEE, CallUserTable::STATUS_INVITING);
		}
	}
	else if($action->getCommand() == Command::VOICEMAIL)
	{
		$firstUserId = (int)$action->getParameter('USER_ID');
	}
	else if($action->getCommand() == Command::ENQUEUE)
	{
		$firstUserId = (int)$action->getParameter('USER_ID');
	}

	if($firstUserId > 0)
	{
		if(in_array($this->call->getIncoming(), [CVoxImplantMain::CALL_INCOMING, CVoxImplantMain::CALL_INCOMING_REDIRECT, CVoxImplantMain::CALL_CALLBACK]))
		{
			$this->call->updateUserId($firstUserId);
		}

		if(CVoxImplantCrmHelper::shouldCreateLead($this->call))
		{
			CVoxImplantCrmHelper::registerCallInCrm($this->call);
			if(CVoxImplantConfig::GetLeadWorkflowExecution() == CVoxImplantConfig::WORKFLOW_START_IMMEDIATE)
			{
				CVoxImplantCrmHelper::StartCallTrigger($this->call, true);
			}
		}
	}
}