• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/integration/voximplant/messageaudiocall.php
  • Класс: Bitrix\Sender\Integration\VoxImplant\MessageAudioCall
  • Вызов: MessageAudioCall::getAudioValue
public function getAudioValue($optionCode, $newValue)
{
	$valueIsCorrect = false;

	if($newValue <> '')
	{
		$audio = (new Audio())
			->withValue($newValue)
			->withMessageCode($this->getCode());

		if($audio->createdFromPreset())
		{
			if($audio->getFileUrl()) // preset $newValue is really exists
			{
				$valueIsCorrect = true;
			}
		}
		else
		{
			$oldValue = $this->configuration->getOption($optionCode);
			$oldAudio = (new Audio())
				->withJsonString($oldValue->getValue())
				->withMessageCode($this->getCode());

			if($oldAudio->getFileId() == $newValue) // file wasn't changed
			{
				$audio = $oldAudio;
				$valueIsCorrect = true;
			}
			else
			{
				if(
					$audio->getDuration() && // check if new file is really mp3
					FileInputUtility::instance()->checkFiles($optionCode, [$newValue]) // check if file was uploaded by current user
				)
				{
					$valueIsCorrect = true;
				}
			}
		}
	}

	if ($valueIsCorrect)
	{
		return $audio->getDbValue();
	}

	return false;
}