CCrmViewHelper::PrepareSipCallHtml

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmViewHelper
  4. PrepareSipCallHtml
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_view_helper.php
  • Класс: \CCrmViewHelper
  • Вызов: CCrmViewHelper::PrepareSipCallHtml
static function PrepareSipCallHtml($phone, $params = null)
{
	if(!CCrmSipHelper::checkPhoneNumber($phone))
	{
		return '';
	}

	$entityType = is_array($params) && isset($params['ENTITY_TYPE']) ? $params['ENTITY_TYPE'] : '';
	$entityId = is_array($params) && isset($params['ENTITY_ID']) ? intval($params['ENTITY_ID']) : 0;
	$activityId = is_array($params) && isset($params['SRC_ACTIVITY_ID']) ? intval($params['SRC_ACTIVITY_ID']) : 0;

	$phone = CUtil::JSEscape(htmlspecialcharsbx($phone));
	$entityType = CUtil::JSEscape(htmlspecialcharsbx($entityType));
	$entityId = CUtil::JSEscape(htmlspecialcharsbx($entityId));
	$activityId = CUtil::JSEscape(htmlspecialcharsbx($activityId));

	$onclick =
		'if(typeof(top.BXIM) === \'undefined\') { window.alert(\''.GetMessageJS('CRM_SIP_NO_SUPPORTED').'\'); return; } '
		.' BX.CrmSipManager.startCall('
		.' { number:\''.$phone.'\', enableInfoLoading: true },'
		.' { ENTITY_TYPE: \''.$entityType.'\', ENTITY_ID: \''.$entityId.'\', SRC_ACTIVITY_ID: \''.$activityId.'\' }, true, this);'
	;

	return '';
}

Добавить комментарий