Commit 312ab74a authored by Kulya's avatar Kulya 😊

Fix versions-1

parent 8e6d7866
......@@ -111,12 +111,19 @@
</div>
</div>
<div class="flex-row py-2">
<label for="changeassignedid" class="col-4 col-form-label text-right p-r-10">Менять ответственного если общался не текущий ответственный? </label>
<div class="col-auto">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="changeassignedid" checked>
</div>
</div>
</div>
<div class="flex-row py-2">
<label for="showcallcard" class="col-4 col-form-label text-right p-r-10">Запускать окно обработки звонка? </label>
<div class="col-auto">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="showcallcard" checked>
<!--label class="form-check-label" for="showcallcard">Вкл</label-->
</div>
</div>
</div>
......
......@@ -332,7 +332,7 @@ class AloVoiceActions
$arLocalChannels = array();
$arChans["queue_incoms"] = [];
$arChans["Incom"] = [];
// Outlines
foreach( $CoreShowChannelsEvents as $schan){
if(!empty($schan)){
$cKeys = $schan->getKeys();
......@@ -356,7 +356,8 @@ class AloVoiceActions
$queue_ins[$mtchnum[1]] = $cKeys["exten"];
}
elseif( (!empty($cKeys["application"])) && ($cKeys["application"]=="Queue") && (!empty($cKeys["exten"])) ){
$arChans["Incom"][$cKeys["exten"]] = $cKeys;
$extNumber = (!empty($cKeys["connectedlinenum"]) && is_numeric($cKeys["connectedlinenum"])) ? $cKeys["connectedlinenum"] : $cKeys["exten"];
$arChans["Incom"][$extNumber] = $cKeys;
}
elseif( (!empty($cKeys["application"])) && ($cKeys["application"]=="BackGround") && (!empty($cKeys["exten"])) ){
$arChans["other_plays"][] = $cKeys;
......@@ -371,6 +372,17 @@ class AloVoiceActions
$arChans["other_plays"][] = $cKeys;
}
}
elseif( !empty($cKeys["applicationdata"]) && $cKeys["applicationdata"]=="(Outgoing Line)" && $cKeys["context"]=="from-internal"){
if(!empty($cKeys["exten"]) && $cKeys["linkedid"]==$cKeys["uniqueid"]){
$arChans["Outlines"][$cKeys["calleridnum"]] = $cKeys;
}
else {
if(empty($arChans["Incom"][$cKeys["calleridnum"]])){
$arChans["Incom"][$cKeys["calleridnum"]] = $cKeys;
}
}
}
}
}
......@@ -414,7 +426,11 @@ class AloVoiceActions
foreach($queue_ins as $inum=>$qis){
$arChans["queue_incoms"][$qis] = $queue_chans[$inum] ;
$queue_chans[$inum]["queue_number"] = $qis;
$arChans["Incom"][$inum] = $queue_chans[$inum] ;
if(empty($arChans["Incom"][$inum])){
$arChans["Incom"][$inum] = $queue_chans[$inum] ;
}
}
foreach( $arChnls as $cKeys){
......@@ -425,13 +441,27 @@ class AloVoiceActions
$arOnumLine = (!empty($arOnLine[2])) ? explode(",",$arOnLine[2]) : [''];
$cKeys["outnum"] = $arOnumLine[0];
if( (!empty($cKeys["applicationdata"])) && ($cKeys["applicationdata"]=="(Outgoing Line)") && ($cKeys["context"]=="from-internal")){
if(!empty($cKeys["exten"])){
$arChans["Outlines"][$cKeys["calleridnum"]] = $cKeys;
}
else {
$arChans["Incom"][$cKeys["calleridnum"]] = $cKeys;
}
$arChans["InOutTest"][$cKeys["calleridnum"]] = $cKeys;
// if( !empty($cKeys["applicationdata"]) && $cKeys["applicationdata"]=="(Outgoing Line)" && $cKeys["context"]=="from-internal"){
// if(!empty($cKeys["exten"]) && $cKeys["linkedid"]==$cKeys["uniqueid"]){
// $arChans["Outlines"][$cKeys["calleridnum"]] = $cKeys;
// }
// else {
// if(empty($arChans["Incom"][$cKeys["calleridnum"]])){
// $arChans["Incom"][$cKeys["calleridnum"]] = $cKeys;
// }
// }
// }
// else
if(!empty($arChans["Incom"][$cKeys["connectedlinenum"]])){
$origChanState = $arChans["Incom"][$cKeys["connectedlinenum"]]["channelstate"];
$origDuration = $arChans["Incom"][$cKeys["connectedlinenum"]]["duration"];
$arChans["Incom"][$cKeys["connectedlinenum"]] = $cKeys;
$arChans["Incom"][$cKeys["connectedlinenum"]]["channelstate"] = $origChanState;
$arChans["Incom"][$cKeys["connectedlinenum"]]["duration"] = $origDuration;
}
if( (!empty($cKeys["context"])) && ( $cKeys["context"]=="macro-dialout-trunk" || $cKeys["context"]=="macro-dial-one") ){
......@@ -561,14 +591,14 @@ class AloVoiceActions
}
if( !empty($arChans["Incom"][$arPeer["cid_num"]]) && $arChans["Incom"][$arPeer["cid_num"]]['channelstate']=='4' ){
if( !empty($arChans["Incom"][$arPeer["cid_num"]]) && ($arChans["Incom"][$arPeer["cid_num"]]['channelstate']=='4' || $arChans["Incom"][$arPeer["cid_num"]]['channelstate']=='5') ){
$agStatus = 'incring';
}
if( !empty($arChans["Incom"][$arPeer["cid_num"]]) && $arChans["Incom"][$arPeer["cid_num"]]['channelstate']=='6' ){
$agStatus = 'inccall';
}
if( !empty($arChans["Out"][$arPeer["cid_num"]]) && $arChans["Out"][$arPeer["cid_num"]]['channelstate']=='4' ){
if( !empty($arChans["Out"][$arPeer["cid_num"]]) && ($arChans["Out"][$arPeer["cid_num"]]['channelstate']=='4' || $arChans["Out"][$arPeer["cid_num"]]['channelstate']=='5') ){
$agStatus = 'outring';
}
if( !empty($arChans["Out"][$arPeer["cid_num"]]) && $arChans["Out"][$arPeer["cid_num"]]['channelstate']=='6' ){
......@@ -622,6 +652,7 @@ class AloVoiceActions
// 'headers' => $arHeaders,
'agents' => $arPeers,
'channels' => $arChans,
'chtst' => $arChnls,
'queues' => $arQueues,
'src' => $serializedPeers,
'auth_test' => sess("BX_AUTH_ID"),
......
......@@ -42,6 +42,12 @@ class AloVoiceConnector
];
}
public function getVersion(){
$verTxt = file_get_contents('version');
return (!empty($verTxt)) ? $verTxt : '2.721';
}
public function isDevelopServer(){
return ($_SERVER["HTTP_HOST"]=="tug.alovoice.uz");
}
......@@ -2373,7 +2379,7 @@ CFU=';
}
if(empty($outBxCallId)){
if(strlen($queryData["PHONE_NUMBER"])==9){
if(!empty($queryData["PHONE_NUMBER"]) && strlen($queryData["PHONE_NUMBER"])==9){
$queryData["PHONE_NUMBER"] = "+998".$queryData["PHONE_NUMBER"];
}
$bxRes = BxRest::call("telephony.externalcall.register",$queryData);
......
......@@ -539,6 +539,8 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
$callRegisterParams["CRM_CREATE"] = 0; //TODO Delete after test
self::eLog($callRegisterParams,"--== DialBegin check callRegisterParams: ",true);
$searchNumber = ALVC::nn($callRegisterParams["PHONE_NUMBER"]);
$searchNumberLittle = substr($searchNumber,-9);
......@@ -666,7 +668,9 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
}
elseif ( ($eventName == "Newstate") && ( ($eventKeys["exten"] != "*78") || ($eventKeys["exten"] != "*76") || ($eventKeys["exten"] != "*79")) && ($eventKeys["channelstate"] == "6") && ($eventKeys["priority"] == "1") ) { // && ($eventKeys["calleridnum"] == $eventKeys["exten"]) && ($eventKeys["exten"] != "ACALLER")
self::eLog($eventKeys,"--== NewSTATE UP Keys:",true);
$changeassignedid = $this->config["changeassignedid"];
$isChangeassignedid = (!empty($changeassignedid) && ($changeassignedid==="true" || $changeassignedid===true));
$regParams = (!empty($bxchannels[$eventKeys["linkedid"]]["BX24_REGISTER_PARAMS"])) ? $bxchannels[$eventKeys["linkedid"]]["BX24_REGISTER_PARAMS"] : [];
self::eLog($regParams,"--== NewSTATE BX24_REGISTER_PARAMS TEST: ", true);
......@@ -674,23 +678,27 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
if(!empty($this->bxusers[$eventKeys["exten"]])){
$upUserID = $this->bxusers[$eventKeys["exten"]]["ID"];
if(!empty($regParams[$eventKeys["exten"]]["CRM_ENTITY_ID"])){
$crmEntType = strtolower($regParams[$eventKeys["exten"]]["CRM_ENTITY_TYPE"]);
$crmEntId = $regParams[$eventKeys["exten"]]["CRM_ENTITY_ID"];
//ASSIGNED_BY_ID
//crm.lead.update
$crmEntity = 'crm.'.$crmEntType.'.update';
$crmUpdateParams = array(
'id'=>$crmEntId,
'fields'=>array(
'ASSIGNED_BY_ID'=>$upUserID
)
);
self::eLog($crmEntity,"--== ASSIGNED_BY Update crmEntity",true);
self::eLog($crmUpdateParams,"--== ASSIGNED_BY Update crmUpdateParams",true);
if($isChangeassignedid){
$crmEntity = 'crm.'.$crmEntType.'.update';
$crmUpdateParams = array(
'id'=>$crmEntId,
'fields'=>array(
'ASSIGNED_BY_ID'=>$upUserID
)
);
self::eLog($crmEntity,"--== ASSIGNED_BY Update crmEntity",true);
self::eLog($crmUpdateParams,"--== ASSIGNED_BY Update crmUpdateParams",true);
$updResult = BxRest::call($crmEntity,$crmUpdateParams);
self::eLog($updResult,"--== RESULT Update CRM Entity CALL on BITRIX",true);
$updResult = BxRest::call($crmEntity,$crmUpdateParams);
self::eLog($updResult,"--== RESULT Update CRM Entity CALL on BITRIX",true);
}
}
}
}
......@@ -775,6 +783,8 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
self::eLog($eventKeys,"--== eventKeys on ".$eventName, true);
self::eLog($this->bxusers,"--================== MAIN CALL CHECk USERS ==============----------------",true);
self::eLog($chVars,"--===== MAIN CALL HANGUP VARS: ======------",true);
$changeassignedid = $this->config["changeassignedid"];
$isChangeassignedid = (!empty($changeassignedid) && ($changeassignedid==="true" || $changeassignedid===true));
if( !empty($chVars["DIALSTATUS"]) ){
$dialstatus = $chVars["DIALSTATUS"];
......@@ -799,17 +809,19 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
}
else{
$asgUserId = $this->config["miscallagentid"];
}
$crmUpdateParams = array(
'id'=>$crmEntId,
'fields'=>array(
'ASSIGNED_BY_ID'=>$asgUserId
)
);
$updResult = BxRest::call($crmEntity,$crmUpdateParams);
self::eLog($updResult,"--===== MAIN CALL HANGUP LEAD updResult: ======------",true);
if($isChangeassignedid){
$crmUpdateParams = array(
'id'=>$crmEntId,
'fields'=>array(
'ASSIGNED_BY_ID'=>$asgUserId
)
);
$updResult = BxRest::call($crmEntity,$crmUpdateParams);
self::eLog($updResult,"--===== MAIN CALL HANGUP LEAD updResult: ======------",true);
}
}
break;
......@@ -915,7 +927,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
if(!empty($chVars["BX24_CALLERID"]) && !empty($chVars["BX24_DIRECTION"]) && $chVars["BX24_DIRECTION"]=="OUTCALL"){
$innerPhone = $chVars["BX24_CALLERID"];
}
if(empty($innerPhone) && $chVars["context"]=="from-internal" && !empty($chVars["calleridnum"])){
if(empty($innerPhone) && !empty($chVars["context"]) && $chVars["context"]=="from-internal" && !empty($chVars["calleridnum"]) && is_numeric($chVars["calleridnum"])){
$innerPhone = $chVars["calleridnum"];
}
$regParams = array(
......
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