public static function AddConfigBySearchId($phone, $country = 'RU') { $melodyLang = 'EN'; $country = strtoupper($country); if (in_array($country, array('RU', 'UA', 'DE'))) { $melodyLang = $country; } $arFields = array('SEARCH_ID' => $phone, 'PHONE_NAME' => $phone, 'MELODY_LANG' => $melodyLang); $result = VI\ConfigTable::add($arFields); if ($result) { if (CVoxImplantConfig::GetPortalNumber() == CVoxImplantConfig::LINK_BASE_NUMBER) { CVoxImplantConfig::SetPortalNumber($arFields['SEARCH_ID']); } } CVoxImplantConfig::SetModeStatus(CVoxImplantConfig::MODE_RENT, true); return true; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (isset($_REQUEST['AJAX_CALL']) && $_REQUEST['AJAX_CALL'] == 'Y') { return; } if (!CModule::IncludeModule('voximplant')) { return; } $ViHttp = new CVoxImplantHttp(); $result = $ViHttp->GetSipInfo(); $arResult = array('FREE' => intval($result->FREE), 'ACTIVE' => $result->ACTIVE, 'DATE_END' => $result->DATE_END); if ($result->ACTIVE != CVoxImplantConfig::GetModeStatus(CVoxImplantConfig::MODE_SIP)) { CVoxImplantConfig::SetModeStatus(CVoxImplantConfig::MODE_SIP, $result->ACTIVE ? true : false); } $arResult['LINK_TO_BUY'] = ''; if (IsModuleInstalled('bitrix24')) { if (LANGUAGE_ID != 'kz') { $arResult['LINK_TO_BUY'] = '/settings/license_phone_sip.php'; } } else { if (LANGUAGE_ID == 'ru') { $arResult['LINK_TO_BUY'] = 'http://www.1c-bitrix.ru/buy/intranet.php#tab-call-link'; } else { if (LANGUAGE_ID == 'ua') { $arResult['LINK_TO_BUY'] = 'http://www.1c-bitrix.ua/buy/intranet.php#tab-call-link'; } else { if (LANGUAGE_ID == 'kz') { } else {
public static function DeletePhoneConfig($configId) { $configId = intval($configId); $result = VI\ConfigTable::getList(array('select' => array('ID', 'SEARCH_ID'), 'filter' => array('=ID' => $configId))); $config = $result->fetch(); if (!$config) { return false; } $needChangePortalNumber = false; VI\ConfigTable::delete($configId); if ($config['SEARCH_ID'] == CVoxImplantConfig::GetPortalNumber()) { $needChangePortalNumber = true; } $result = VI\QueueTable::getList(array('select' => array('ID'), 'filter' => array('=CONFIG_ID' => $configId))); while ($row = $result->fetch()) { VI\QueueTable::delete($row['ID']); } $firstPhoneNumber = ''; $result = VI\ConfigTable::getList(array('select' => array('ID', 'SEARCH_ID'))); while ($row = $result->fetch()) { if (!$firstPhoneNumber) { $firstPhoneNumber = $row['SEARCH_ID']; } } if (!$firstPhoneNumber) { CVoxImplantConfig::SetModeStatus(CVoxImplantConfig::MODE_RENT, false); } if ($needChangePortalNumber) { if ($firstPhoneNumber) { CVoxImplantConfig::SetPortalNumber($firstPhoneNumber); } else { CVoxImplantConfig::SetPortalNumber(CVoxImplantConfig::LINK_BASE_NUMBER); } } return true; }