• Модуль: voximplant
  • Путь к файлу: ~/bitrix/modules/voximplant/lib/transcript.php
  • Класс: BitrixVoximplantTranscript
  • Вызов: Transcript::onTranscriptionComplete
static function onTranscriptionComplete($params)
{
	$sessionId = (int)$params['SESSION_ID'];
	$statisticRecord = StatisticTable::getList(array(
		'filter' => array(
			'=SESSION_ID' => $sessionId
		)
	))->fetch();

	$transcriptionUrl = (string)$params['TRANSCRIPTION_URL'];
	$transcript = self::createWithUrl($transcriptionUrl);
	$transcript->setSessionId($sessionId);
	if($statisticRecord)
	{
		$transcript->setCallId($statisticRecord['CALL_ID']);
	}
	$transcript->setCost((double)$params['COST']);
	$transcript->setCostCurrency((string)$params['COST_CURRENCY']);
	$transcript->fetch();

	$transcript->save();

	if(!$statisticRecord)
	{
		return false;
	}

	StatisticTable::update($statisticRecord['ID'], array(
		'TRANSCRIPT_ID' => $transcript->getId(),
		'TRANSCRIPT_PENDING' => 'N'
	));
	
	if ($statisticRecord['CRM_ACTIVITY_ID'] > 0)
	{
		CVoxImplantCrmHelper::createActivityUpdateEvent($statisticRecord['CRM_ACTIVITY_ID']);
	}
	
	if(Loader::includeModule('pull'))
	{
		CPullWatch::AddToStack(
			self::getTagForCall($statisticRecord['CALL_ID']),
			array(
				'module_id' => 'voximplant',
				'command' => 'transcriptComplete',
				'params' => array(
					'CALL_ID' => $statisticRecord['CALL_ID']
				)
			)
		);
	}

	return true;
}