Commit 8e88d715 authored by Kulya's avatar Kulya 😊

Обновлен метод выыода настроек своего номера

parent ae1e736f
...@@ -1447,46 +1447,22 @@ class AloVoiceConnector ...@@ -1447,46 +1447,22 @@ class AloVoiceConnector
public function doUserProfileMenu(){ public function doUserProfileMenu(){
if(empty($_REQUEST["PLACEMENT_OPTIONS"])){ $gotUser = BxRest::call("user.current");
return ['page'=>'user_profile_menu',"body"=>"Нет параметров"];
}
$arOpts = json_decode($_REQUEST["PLACEMENT_OPTIONS"],true);
// if(empty($arOpts) || empty($arOpts["USER_ID"])){
// return ['page'=>'user_profile_menu',"body"=>"Сотрудник или номер не найден"];
// }
// return ['page'=>'user_profile_menu',"body"=>$arOpts["USER_ID"]]; if(empty($gotUser["result"])){
if(!empty($arOpts["USER_ID"])){ return ['page'=>'user_profile_menu',"body"=>"Сотрудник или номер не найден!"];
$gotUser = BxRest::call('user.get',[ 'ID' => $arOpts["USER_ID"] ]);
if(!empty($gotUser["result"])){ $arUser = $gotUser["result"][0]; }
}
if(empty($arUser)){
$gotUser = BxRest::call("user.current");
if(!empty($gotUser["result"])){ $arUser = $gotUser["result"]; }
} }
$arUser = $gotUser["result"];
if(empty($arUser)){
return ['page'=>'user_profile_menu',"body"=>"Сотрудник или номер не найден"];
}
if(empty($arUser["UF_PHONE_INNER"])){ if(empty($arUser["UF_PHONE_INNER"])){
return ['page'=>'user_profile_menu',"body"=>"Нету номера"]; return ['page'=>'user_profile_menu',"body"=>"Нету номера"];
} }
$num = $arUser["UF_PHONE_INNER"]; $num = $arUser["UF_PHONE_INNER"];
// if($num=="2424"){ $arSoftphone = self::getUserSoftphoneExe($num);
// $num = "3031";
// }
if($num=="2424"){
$arSoftphone = self::getUserSoftphoneExe($num);
}
else{
$arSoftphone = self::getUserSoftphoneExe($num);
// $arSoftphone = self::getUserSoftphone($num);
}
$arResult = ['page'=>'user_profile_menu']; $arResult = ['page'=>'user_profile_menu'];
$arResult['header'] = 'Программа для звонков в Windows'; $arResult['header'] = 'Программа для звонков в Windows';
...@@ -2592,7 +2568,7 @@ CFU='; ...@@ -2592,7 +2568,7 @@ CFU=';
)); ));
$this->_client->open(); $this->_client->open();
$listener = new AloVoiceHandle($this->configs,$bxonusers); $listener = new AloVoiceHandle($this->_client, $this->configs,$bxonusers);
$this->_client->registerEventListener(array($listener, 'handle')); $this->_client->registerEventListener(array($listener, 'handle'));
//$this->_client->registerEventListener(function ($event) { }); //$this->_client->registerEventListener(function ($event) { });
......
...@@ -14,7 +14,8 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener ...@@ -14,7 +14,8 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
public static $event; public static $event;
public static $configs; public static $configs;
public function __construct($configs=[],$bxusers=[]) { public function __construct(\PAMI\Client\Impl\ClientImpl $client, $configs=[],$bxusers=[]) {
$this->client = $client;
$this->config = $configs; $this->config = $configs;
$this->bxusers = $bxusers; $this->bxusers = $bxusers;
$this->bxuserstime = time(); $this->bxuserstime = time();
...@@ -49,12 +50,12 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener ...@@ -49,12 +50,12 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
$this->bxusers = ALVC::getUsersList(false,true); $this->bxusers = ALVC::getUsersList(false,true);
$this->bxuserstime = time(); $this->bxuserstime = time();
} }
//self::eLog($bxchannels,"--== NOW bxchannels:"); //self::eLog($bxchannels,"--== NOW bxchannels:");
$eventName = $event->getName(); $eventName = $event->getName();
$eventKeys = $event->getKeys(); $eventKeys = $event->getKeys();
// self::eLog($eventKeys,"--== eventKeys on ".$eventName, true); self::eLog($eventKeys,"--== eventKeys on ".$eventName, true);
//Пришел новый звонок //Пришел новый звонок
if ($eventName == "DongleNewSMS") { if ($eventName == "DongleNewSMS") {
...@@ -73,6 +74,32 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener ...@@ -73,6 +74,32 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
file_put_contents($fPath,"Time:".$nowtime.' '.$msgTxt); file_put_contents($fPath,"Time:".$nowtime.' '.$msgTxt);
} }
elseif ($eventName == "DeviceStateChange") {
list($proto,$peer) = explode("/",$eventKeys["device"]);
if(empty($peer)){
$peer = preg_replace("/[^0-9]/", '', $eventKeys["device"]);
}
self::eLog([$proto,$peer],"--== Event ProtoPeer:", true);
// self::eLog($event->getState(),"--== Event getStatus:", true);
if(!empty($peer)){
$this->client->send(new \PAMI\Message\Action\SIPNotifyAction($peer,"STATE=".$eventKeys["state"]));
}
}
elseif ($eventName == "ExtensionStatus") {
// self::eLog($eventKeys,"--== eventKeys on ".$eventName, true);
$exten = $event->getExtension();
self::eLog($event->getExtension(),"--== Event Extension:", true);
self::eLog($event->getStatus(),"--== Event getStatus:", true);
$this->client->send(new \PAMI\Message\Action\SIPNotifyAction($exten,"STATUS=".$event->getStatus()));
}
elseif ($eventName == "DongleNewCMGR") { elseif ($eventName == "DongleNewCMGR") {
$entTypes = array( $entTypes = array(
"LEAD" => 1, "LEAD" => 1,
......
...@@ -1350,11 +1350,16 @@ class BitrixEvents ...@@ -1350,11 +1350,16 @@ class BitrixEvents
if(!empty($arLead["OPPORTUNITY"])){ //&& empty($arLead["UF_CRM_1619575012878"]) if(!empty($arLead["OPPORTUNITY"])){ //&& empty($arLead["UF_CRM_1619575012878"])
$oprtnty = round($arLead["OPPORTUNITY"]); $oprtnty = round($arLead["OPPORTUNITY"]);
$oprtntyTxt = ALVC::num2str($oprtnty); $oprtntyTxt = ALVC::num2str($oprtnty);
$resDealSave = BxRest::call( 'crm.lead.update', array("id"=>$leadID, "fields"=>["UF_CRM_1619575012878"=>$oprtntyTxt]) ); if($arLead["UF_CRM_1619575012878"]!=$oprtntyTxt){
$resDealSave = BxRest::call( 'crm.lead.update', array("id"=>$leadID, "fields"=>["UF_CRM_1619575012878"=>$oprtntyTxt]) );
ALVC::eLog($resDealSave,"------ Events.php :: lead Update Oport TXT: ".$oprtntyTxt);
}
ALVC::eLog($resDealSave,"------ Events.php :: lead Update Oport TXT: ".$oprtntyTxt);
} }
if(empty($arLead["OPPORTUNITY"]) && !empty($arLead["UF_CRM_1619575012878"])){ if(empty($arLead["OPPORTUNITY"]) && !empty($arLead["UF_CRM_1619575012878"])){
......
...@@ -50,9 +50,12 @@ class SIPNotifyAction extends ActionMessage ...@@ -50,9 +50,12 @@ class SIPNotifyAction extends ActionMessage
* *
* @return void * @return void
*/ */
public function __construct($channel) public function __construct($channel,$info='')
{ {
parent::__construct('SIPnotify'); parent::__construct('SIPnotify');
$this->setKey('Channel', $channel); $this->setKey('Channel', $channel);
if(!empty($info)){
$this->setKey('Variable', $info);
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment