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;
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,6 +668,8 @@ 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"] : [];
......@@ -674,10 +678,13 @@ 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
if($isChangeassignedid){
$crmEntity = 'crm.'.$crmEntType.'.update';
$crmUpdateParams = array(
'id'=>$crmEntId,
......@@ -694,6 +701,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
}
}
}
}
elseif (!empty($eventKeys["channelstate"]) && $eventName == "DialEnd" && $eventKeys["channelstate"] == "6" && $eventKeys["dialstatus"] == "ANSWER") {
//arr:{"event":"DialEnd","privilege":"call,all","channel":"Dongle\/dongle3-0100000006","channelstate":"6","channelstatedesc":"Up","calleridnum":"+998994412860","calleridname":"dongle3","connectedlinenum":"<unknown>","connectedlinename":"<unknown>","language":"ru","accountcode":"","context":"ext-queues","exten":"10","priority":"40","uniqueid":"1579771666.108","linkedid":"1579771666.108","destchannel":"Local\/1004@from-queue-00000030;1","destchannelstate":"6","destchannelstatedesc":"Up","destcalleridnum":"+998994008840","destcalleridname":"<unknown>","destconnectedlinenum":"+998994412860","destconnectedlinename":"dongle3","destlanguage":"ru","destaccountcode":"","destcontext":"from-queue","destexten":"10","destpriority":"1","destuniqueid":"1579771667.121","destlinkedid":"1579771666.108","dialstatus":"ANSWER"}
......@@ -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,9 +809,10 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
}
else{
$asgUserId = $this->config["miscallagentid"];
}
}
if($isChangeassignedid){
$crmUpdateParams = array(
'id'=>$crmEntId,
'fields'=>array(
......@@ -811,6 +822,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
$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