• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/routing/queue.php
  • Класс: BitrixVoximplantRoutingQueue
  • Вызов: Queue::leaveQueue
protected function leaveQueue(Call $call)
{
	$queue = $this->queue;

	if ($queue->getNoAnswerRule() === CVoxImplantIncoming::RULE_NEXT_QUEUE && Limits::isRedirectToQueueAllowed())
	{
		return false;
	}

	$userId = $call->getUserId();

	if ($userId <= 0)
	{
		$userId = $queue->getFirstUserId($this->checkTimeman);
		if ($userId)
		{
			$queue->touchUser($userId);
		}
	}

	if ($queue->getNoAnswerRule() == CVoxImplantIncoming::RULE_PSTN_SPECIFIC)
	{
		if ($queue->getForwardNumber() <> '')
		{
			$this->insertAfter(new Pstn($queue->getForwardNumber(),'voicemail'));
			return false;
		}
	}

	if ($queue->getNoAnswerRule() == CVoxImplantIncoming::RULE_PSTN && $userId > 0)
	{
		$userPhone = CVoxImplantPhone::GetUserPhone($userId);
		$userPhone = CVoxImplantPhone::stripLetters($userPhone);
		if ($userPhone)
		{
			$this->insertAfter(new Pstn($userPhone,'voicemail', $userId));
			return false;
		}
	}

	if ($queue->getNoAnswerRule() == CVoxImplantIncoming::RULE_VOICEMAIL)
	{
		return new Action(Command::VOICEMAIL, ['USER_ID' => $userId]);
	}

	return new Action(Command::HANGUP, ['USER_ID' => $userId]);
}