Beispiel #1
0
<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
/**
 * @var $arParams array
 * @var $arResult array
 * @var $arResult['NAV_OBJECT'] CAllDBResult
 * @var $APPLICATION CMain
 * @var $USER CUser
 */
$APPLICATION->SetAdditionalCSS("/bitrix/components/bitrix/voximplant.main/templates/.default/telephony.css");
$numbersC = CVoxImplantConfig::GetPortalNumbers();
$portalNumber = CVoxImplantConfig::GetPortalNumber();
$numbers = array('' => GetMessage("VI_NUMBERS_DEFAULT")) + $numbersC;
?>
<div class="bx-vi-block bx-vi-filter">
	<form id="search_form" action="<?php 
echo POST_FORM_ACTION_URI;
?>
" method="GET">
		<input type="hidden" name="act" value="search">
		<span class="filter-field">
			<input name="FILTER" type="text" value="<?php 
echo htmlspecialcharsbx($arResult['FILTER']);
?>
" class="tel-set-inp" placeholder="<?php 
echo GetMessage('VI_NUMBERS_SEARCH');
?>
" />
Beispiel #2
0
 public static function AddLead($params)
 {
     if (!CModule::IncludeModule('crm')) {
         return false;
     }
     if (strlen($params['PHONE_NUMBER']) <= 0 || intval($params['USER_ID']) <= 0) {
         return false;
     }
     $result = VI\PhoneTable::getList(array('select' => array('USER_ID', 'PHONE_MNEMONIC'), 'filter' => array('=PHONE_NUMBER' => $params['PHONE_NUMBER'])));
     if ($row = $result->fetch()) {
         return false;
     }
     $title = GetMessage($params['INCOMING'] ? 'VI_CRM_CALL_INCOMING' : 'VI_CRM_CALL_OUTGOING');
     $arFields = array('TITLE' => $params['PHONE_NUMBER'] . ' - ' . $title, 'OPENED' => 'Y', 'PHONE_WORK' => $params['PHONE_NUMBER']);
     $statuses = CCrmStatus::GetStatusList("SOURCE");
     if (isset($statuses[$params['CRM_SOURCE']])) {
         $arFields['SOURCE_ID'] = $params['CRM_SOURCE'];
     } else {
         if (isset($statuses['CALL'])) {
             $arFields['SOURCE_ID'] = 'CALL';
         } else {
             if (isset($statuses['OTHER'])) {
                 $arFields['SOURCE_ID'] = 'OTHER';
             }
         }
     }
     $portalNumbers = CVoxImplantConfig::GetPortalNumbers();
     $portalNumber = isset($portalNumbers[$params['SEARCH_ID']]) ? $portalNumbers[$params['SEARCH_ID']] : '';
     if ($portalNumber) {
         $arFields['SOURCE_DESCRIPTION'] = GetMessage('VI_CRM_CALL_TO_PORTAL_NUMBER', array('#PORTAL_NUMBER#' => $portalNumber));
     }
     $arFields['FM'] = CCrmFieldMulti::PrepareFields($arFields);
     $CCrmLead = new CCrmLead(false);
     $ID = $CCrmLead->Add($arFields, true, array('CURRENT_USER' => $params['USER_ID'], 'DISABLE_USER_FIELD_CHECK' => true));
     $arErrors = array();
     CCrmBizProcHelper::AutoStartWorkflows(CCrmOwnerType::Lead, $ID, CCrmBizProcEventType::Create, $arErrors);
     CVoxImplantHistory::WriteToLog($arFields, 'LEAD CREATED');
     return $ID;
 }
Beispiel #3
0
 public static function lineGet()
 {
     if (!CVoxImplantMain::CheckAccess()) {
         throw new \Bitrix\Rest\AccessException();
     }
     return CVoxImplantConfig::GetPortalNumbers();
 }
Beispiel #4
0
 public function GetUserInfo($userId, $getPhoneAccess = false)
 {
     $userId = intval($userId);
     if ($userId <= 0) {
         $this->error = new CVoxImplantError(__METHOD__, 'USER_ID_NULL', 'UserId is not correct');
         return false;
     }
     $userPassword = '';
     $userBackphone = '';
     $phoneEnable = false;
     $phonePassword = '';
     $arExtParams = array('FIELDS' => array("ID"), 'SELECT' => array('UF_VI_PASSWORD', 'UF_VI_BACKPHONE', 'UF_VI_PHONE', 'UF_VI_PHONE_PASSWORD', 'UF_PHONE_INNER', 'UF_DEPARTMENT'));
     $dbUsers = CUser::GetList($sort_by = '', $dummy = '', array('ID' => $userId), $arExtParams);
     if ($arUser = $dbUsers->Fetch()) {
         if (strlen($arUser['UF_VI_PASSWORD']) > 0) {
             $userPassword = $arUser['UF_VI_PASSWORD'];
         }
         if (strlen($arUser['UF_VI_PHONE_PASSWORD']) > 0) {
             $phonePassword = $arUser['UF_VI_PHONE_PASSWORD'];
         }
         $userInnerPhone = $arUser['UF_PHONE_INNER'];
         $userBackphone = $arUser['UF_VI_BACKPHONE'];
         if ($arUser['UF_VI_PHONE'] == 'Y') {
             $phoneEnable = true;
             $getPhoneAccess = true;
         }
         $arUser['IS_EXTRANET'] = self::IsExtranet($arUser);
         unset($arUser['UF_DEPARTMENT']);
     }
     if ($userPassword == '' || $getPhoneAccess && $phonePassword == '') {
         $result = $this->GetUser($userId, $getPhoneAccess, true);
         if (!$result || $this->GetError()->error) {
             $this->error = new CVoxImplantError(__METHOD__, $this->GetError()->code, $this->GetError()->msg);
             return false;
         }
         $userPassword = $result->result->user_password;
         $phonePassword = $result->result->phone_password;
         global $USER_FIELD_MANAGER;
         $USER_FIELD_MANAGER->Update("USER", $userId, array('UF_VI_PASSWORD' => $userPassword, 'UF_VI_PHONE_PASSWORD' => $phonePassword));
     }
     if ($userBackphone) {
         $portalPhones = CVoxImplantConfig::GetPortalNumbers();
         if (!isset($portalPhones[$userBackphone])) {
             $userBackphone = '';
         }
     }
     if ($userBackphone == '') {
         $userBackphone = CVoxImplantConfig::GetPortalNumber();
         if ($userBackphone == CVoxImplantConfig::LINK_BASE_NUMBER) {
             $userBackphone = '';
         }
     }
     $viAccount = new CVoxImplantAccount();
     return array('call_server' => str_replace('voximplant.com', 'bitrixphone.com', $viAccount->GetCallServer()), 'user_login' => 'user' . $userId, 'user_password' => $userPassword, 'user_backphone' => $userBackphone, 'user_innerphone' => $userInnerPhone, 'phone_enable' => $phoneEnable, 'phone_login' => $phonePassword ? 'phone' . $userId : "", 'phone_password' => $phonePassword, 'user_extranet' => $arUser['IS_EXTRANET']);
 }
Beispiel #5
0
 public static function AddLead($params)
 {
     if (!CModule::IncludeModule('crm')) {
         return false;
     }
     if (strlen($params['PHONE_NUMBER']) <= 0 || intval($params['USER_ID']) <= 0) {
         return false;
     }
     $dateNow = new Bitrix\Main\Type\DateTime();
     $title = GetMessage($params['INCOMING'] ? 'VI_CRM_CALL_INCOMING' : 'VI_CRM_CALL_OUTGOING');
     $arFields = array('TITLE' => $title . ' ' . $dateNow->format('H:i d.m.Y'), 'OPENED' => 'Y', 'PHONE_WORK' => $params['PHONE_NUMBER']);
     $statuses = CCrmStatus::GetStatusList("SOURCE");
     if (isset($statuses['CALL'])) {
         $arFields['SOURCE_ID'] = 'CALL';
     }
     $portalNumbers = CVoxImplantConfig::GetPortalNumbers();
     $portalNumber = isset($portalNumbers[$params['SEARCH_ID']]) ? $portalNumbers[$params['SEARCH_ID']] : '';
     if ($portalNumber) {
         $arFields['SOURCE_DESCRIPTION'] = GetMessage('VI_CRM_CALL_TO_PORTAL_NUMBER', array('#PORTAL_NUMBER#' => $portalNumber));
     }
     $arFields['FM'] = CCrmFieldMulti::PrepareFields($arFields);
     $CCrmLead = new CCrmLead(false);
     $ID = $CCrmLead->Add($arFields, true, array('CURRENT_USER' => $params['USER_ID'], 'DISABLE_USER_FIELD_CHECK' => true));
     $arErrors = array();
     CCrmBizProcHelper::AutoStartWorkflows(CCrmOwnerType::Lead, $ID, CCrmBizProcEventType::Create, $arErrors);
     CVoxImplantHistory::WriteToLog($arFields, 'LEAD CREATED');
     return $ID;
 }
Beispiel #6
0
 public static function DelCallerID($number)
 {
     $number = CVoxImplantPhone::Normalize($number);
     if ($number) {
         $ViHttp = new CVoxImplantHttp();
         $result = $ViHttp->DelCallerID($number);
         if ($result) {
             COption::SetOptionString("voximplant", "backphone_number", "");
             if (COption::GetOptionString("voximplant", "portal_number") == $number) {
                 $portalPhones = CVoxImplantConfig::GetPortalNumbers();
                 foreach ($portalPhones as $phone => $phoneName) {
                     COption::SetOptionString("voximplant", "portal_number", $phone);
                     break;
                 }
             }
             return true;
         }
     }
     return false;
 }