Commit cae8715d authored by Kulya's avatar Kulya 😊

Fix StafStatsApp errors

parent 73ad9438
...@@ -522,10 +522,12 @@ class AloVoiceActions ...@@ -522,10 +522,12 @@ class AloVoiceActions
$userId = ''; $userId = '';
if(!empty($bxPhoneUsers[$arPeer["cid_num"]])){ if(!empty($bxPhoneUsers[$arPeer["cid_num"]])){
$u = $bxPhoneUsers[$arPeer["cid_num"]]; $u = $bxPhoneUsers[$arPeer["cid_num"]];
$userFullname = $u["NAME"].' '.$u["LAST_NAME"]; $uName = (!empty($u["NAME"])) ? $u["NAME"] : '';
$uLastName = (!empty($u["LAST_NAME"])) ? $u["LAST_NAME"] : '';
$userFullname = $uName.' '.$uLastName;
$userLink = 'https://'.$this->configs["bitrix_domain"].'/company/personal/user/'.$u["ID"].'/'; $userLink = 'https://'.$this->configs["bitrix_domain"].'/company/personal/user/'.$u["ID"].'/';
// $userLine = '<a href="https://4uz.bitrix24.ru/company/personal/user/'.$u["ID"].'/" target="_blank">'.$u["NAME"].' '.$u["LAST_NAME"].'</a>'; // $userLine = '<a href="https://4uz.bitrix24.ru/company/personal/user/'.$u["ID"].'/" target="_blank">'.$u["NAME"].' '.$u["LAST_NAME"].'</a>';
$userLine = '<a href="https://'.$this->configs["bitrix_domain"].'/company/personal/user/'.$u["ID"].'/" target="_blank">'.$u["NAME"].' '.$u["LAST_NAME"].' ('.$arPeer["cid_num"].')</a>'; $userLine = '<a href="https://'.$this->configs["bitrix_domain"].'/company/personal/user/'.$u["ID"].'/" target="_blank">'.$userFullname.' ('.$arPeer["cid_num"].')</a>';
$userId = $u["ID"]; $userId = $u["ID"];
} }
/* /*
......
...@@ -64,13 +64,19 @@ class AloVoiceAgi ...@@ -64,13 +64,19 @@ class AloVoiceAgi
// } // }
if($_SERVER['argv'][1]=="aftercall"){ if($_SERVER['argv'][1]=="aftercall"){
$this->aLog("--------------AGi aftercall RET! ");
return true; return true;
} }
$this->AGI->answer(); $this->AGI->answer();
$this->AGI->set_music(true,'default'); $this->AGI->set_music(true,'default');
$this->aLog("--------------AGi after set_music ");
$respNumber = $this->getEntityResposibleNumber($callerid); $respNumber = $this->getEntityResposibleNumber($callerid);
$this->aLog("--------------AGi after getEntityResposibleNumber... ");
$respWaitTime = (!empty($this->config["resposible_wait"])) ? $this->config["resposible_wait"] : 40; $respWaitTime = (!empty($this->config["resposible_wait"])) ? $this->config["resposible_wait"] : 40;
$this->aLog("","--------------AGi RESP and WAIT TIME: (".json_encode($respNumber).") - [".$respWaitTime."]--------"); $this->aLog("","--------------AGi RESP and WAIT TIME: (".json_encode($respNumber).") - [".$respWaitTime."]--------");
......
...@@ -23,7 +23,7 @@ class AloVoiceConnector ...@@ -23,7 +23,7 @@ class AloVoiceConnector
public function __construct() { public function __construct() {
$this->configFile = __DIR__.'/config.json'; $this->configFile = __DIR__.'/config.json';
$this->rootdir = dirname(dirname(dirname(__DIR__))).'/'; $this->rootdir = dirname(dirname(dirname(__DIR__))).'/';
$this->alvhost = (!empty($_SERVER["HTTP_HOST"])) ? 'https://'.$_SERVER["HTTP_HOST"].'/bx24/' : 'https://tug.alovoice.uz/bx24/'; $this->alvhost = (!empty($_SERVER["HTTP_HOST"])) ? 'https://'.$_SERVER["HTTP_HOST"].'/bx24/' : 'https://tel.alovoice.uz/bx24/';
$this->settings = false; $this->settings = false;
$this->configs = $this->getConfigs(); $this->configs = $this->getConfigs();
$this->isAmi=false; $this->isAmi=false;
...@@ -228,7 +228,7 @@ class AloVoiceConnector ...@@ -228,7 +228,7 @@ class AloVoiceConnector
$this->eLog($_REQUEST,"------ AloVoiceConnector: RUN REQUEST----------"); $this->eLog($_REQUEST,"------ AloVoiceConnector: RUN REQUEST----------");
$this->eLog($_FILES,"--== AloVoiceConnector FILES:"); $this->eLog($_FILES,"--== AloVoiceConnector FILES:");
$this->eLog($_SERVER,"------ AloVoiceConnector: RUN SERVER ----------"); // $this->eLog($_SERVER,"------ AloVoiceConnector: RUN SERVER ----------");
if(!empty($_REQUEST['afile'])){ if(!empty($_REQUEST['afile'])){
return $this->getWavAudio($_REQUEST['afile']); return $this->getWavAudio($_REQUEST['afile']);
...@@ -2409,23 +2409,23 @@ CFU='; ...@@ -2409,23 +2409,23 @@ CFU=';
$userID = (!empty($queryData["USER_ID"])) ? $queryData["USER_ID"] : ""; $userID = (!empty($queryData["USER_ID"])) ? $queryData["USER_ID"] : "";
if(empty($userID) && !empty($full["BX24_USERID"])){ $userID = $full["BX24_USERID"]; } if(empty($userID) && !empty($full["BX24_USERID"])){ $userID = $full["BX24_USERID"]; }
$stRes = self::statAPI("update",[ // $stRes = self::statAPI("update",[
'where' => ["ID" => $full["ALV_ECALLID"]], // 'where' => ["ID" => $full["ALV_ECALLID"]],
"KEY" => "4Ad49wD", // "KEY" => "4Ad49wD",
'fields' => [ // 'fields' => [
"DIALSTATUS" => 'DIALBEGIN', // "DIALSTATUS" => 'DIALBEGIN',
"TIME_DIALBEGIN" => time(), // "TIME_DIALBEGIN" => time(),
"BXCALLID" => (!empty($bxRes["result"]["CALL_ID"])) ? $bxRes["result"]["CALL_ID"] : "", // "BXCALLID" => (!empty($bxRes["result"]["CALL_ID"])) ? $bxRes["result"]["CALL_ID"] : "",
"CHANNEL" => (!empty($full["channel"])) ? $full["channel"] : "", // "CHANNEL" => (!empty($full["channel"])) ? $full["channel"] : "",
"USER_ID" => $userID, // "USER_ID" => $userID,
"FROM_NUMBER" => $from_number, // "FROM_NUMBER" => $from_number,
"TO_NUMBER" => $to_number, // "TO_NUMBER" => $to_number,
"LINE_NUMBER" => (!empty($queryData["LINE_NUMBER"])) ? $queryData["LINE_NUMBER"] : "", // "LINE_NUMBER" => (!empty($queryData["LINE_NUMBER"])) ? $queryData["LINE_NUMBER"] : "",
// "QUEUENUM" => "99999", // // "QUEUENUM" => "99999",
"INNER_PHONE" => $innerphone, // "INNER_PHONE" => $innerphone,
"DIRECTION" => (!empty($direction)) ? $direction : "INBOUND", // "DIRECTION" => (!empty($direction)) ? $direction : "INBOUND",
] // ]
]); // ]);
// $stRes = self::statAPI("insert",[ // $stRes = self::statAPI("insert",[
// 'fields' => [ // 'fields' => [
...@@ -2512,22 +2512,22 @@ CFU='; ...@@ -2512,22 +2512,22 @@ CFU=';
} }
} }
$stRes = self::statAPI("update",[ // $stRes = self::statAPI("update",[
'where' => ["ID" => $full["ALV_ECALLID"]], // 'where' => ["ID" => $full["ALV_ECALLID"]],
"KEY" => "4Ad49wD", // "KEY" => "4Ad49wD",
'fields' => [ // 'fields' => [
"FULLINFO" => json_encode($full), // "FULLINFO" => json_encode($full),
"QUEUENUM" => (!empty($full["QUEUENUM"])) ? $full["QUEUENUM"] : "", // "QUEUENUM" => (!empty($full["QUEUENUM"])) ? $full["QUEUENUM"] : "",
"ANSWEREDTIME" => $duration, // "ANSWEREDTIME" => $duration,
"TIME_QUEUEJOINTIME" => (!empty($full["QUEUEJOINTIME"])) ? $full["QUEUEJOINTIME"] : "", // "TIME_QUEUEJOINTIME" => (!empty($full["QUEUEJOINTIME"])) ? $full["QUEUEJOINTIME"] : "",
"TIME_HANGUP" => time(), // "TIME_HANGUP" => time(),
"LAST_POSITION" => $lastPosition, // "LAST_POSITION" => $lastPosition,
"DIALSTATUS" => $dialStatus, // "DIALSTATUS" => $dialStatus,
"REC" => (!empty($queryData["RECORD_URL"])) ? $queryData["RECORD_URL"] : "", // "REC" => (!empty($queryData["RECORD_URL"])) ? $queryData["RECORD_URL"] : "",
"GOOD" => (!empty($duration) && $duration>$goodSecods) ? 1 : NULL // "GOOD" => (!empty($duration) && $duration>$goodSecods) ? 1 : NULL
] // ]
]); // ]);
self::eLog($stRes,"--== finishCall STATAPI RES:"); // self::eLog($stRes,"--== finishCall STATAPI RES:");
} }
...@@ -3529,7 +3529,7 @@ CFU='; ...@@ -3529,7 +3529,7 @@ CFU=';
} }
public function statAPI($m,$p){ public function statAPI($m,$p){
return [];
if(empty($m)){ return false; } if(empty($m)){ return false; }
$params = [ "method" => $m ]; $params = [ "method" => $m ];
......
...@@ -429,7 +429,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener ...@@ -429,7 +429,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
$searchNumber = substr($eventKeys["calleridnum"],-9); $searchNumber = substr($eventKeys["calleridnum"],-9);
} }
$bxchannels[$eventKeys["linkedid"]]["ALV_ECALLID"] = ALVC::beginCall($eventKeys); $bxchannels[$eventKeys["linkedid"]]["ALV_ECALLID"] = 0; //ALVC::beginCall($eventKeys);
$bxchannels[$eventKeys["linkedid"]]["calls"] = array(); $bxchannels[$eventKeys["linkedid"]]["calls"] = array();
$BX_USERID = 1; $BX_USERID = 1;
......
...@@ -27,7 +27,7 @@ function sess($key=null, $value=null){ ...@@ -27,7 +27,7 @@ function sess($key=null, $value=null){
} }
} }
if(isset($key) && $key != null && ( !isset($value) || $value != null ) ){ if(isset($key) && $key != null && ( !isset($value) || $value != null ) && isset($arAllSess[$key]) ){
return $arAllSess[$key]; return $arAllSess[$key];
} }
......
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