Commit cae8715d authored by Kulya's avatar Kulya 😊

Fix StafStatsApp errors

parent 73ad9438
......@@ -522,10 +522,12 @@ class AloVoiceActions
$userId = '';
if(!empty($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"].'/';
// $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"];
}
/*
......
......@@ -64,13 +64,19 @@ class AloVoiceAgi
// }
if($_SERVER['argv'][1]=="aftercall"){
$this->aLog("--------------AGi aftercall RET! ");
return true;
}
$this->AGI->answer();
$this->AGI->set_music(true,'default');
$this->aLog("--------------AGi after set_music ");
$respNumber = $this->getEntityResposibleNumber($callerid);
$this->aLog("--------------AGi after getEntityResposibleNumber... ");
$respWaitTime = (!empty($this->config["resposible_wait"])) ? $this->config["resposible_wait"] : 40;
$this->aLog("","--------------AGi RESP and WAIT TIME: (".json_encode($respNumber).") - [".$respWaitTime."]--------");
......
......@@ -23,7 +23,7 @@ class AloVoiceConnector
public function __construct() {
$this->configFile = __DIR__.'/config.json';
$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->configs = $this->getConfigs();
$this->isAmi=false;
......@@ -228,7 +228,7 @@ class AloVoiceConnector
$this->eLog($_REQUEST,"------ AloVoiceConnector: RUN REQUEST----------");
$this->eLog($_FILES,"--== AloVoiceConnector FILES:");
$this->eLog($_SERVER,"------ AloVoiceConnector: RUN SERVER ----------");
// $this->eLog($_SERVER,"------ AloVoiceConnector: RUN SERVER ----------");
if(!empty($_REQUEST['afile'])){
return $this->getWavAudio($_REQUEST['afile']);
......@@ -2409,23 +2409,23 @@ CFU=';
$userID = (!empty($queryData["USER_ID"])) ? $queryData["USER_ID"] : "";
if(empty($userID) && !empty($full["BX24_USERID"])){ $userID = $full["BX24_USERID"]; }
$stRes = self::statAPI("update",[
'where' => ["ID" => $full["ALV_ECALLID"]],
"KEY" => "4Ad49wD",
'fields' => [
"DIALSTATUS" => 'DIALBEGIN',
"TIME_DIALBEGIN" => time(),
"BXCALLID" => (!empty($bxRes["result"]["CALL_ID"])) ? $bxRes["result"]["CALL_ID"] : "",
"CHANNEL" => (!empty($full["channel"])) ? $full["channel"] : "",
"USER_ID" => $userID,
"FROM_NUMBER" => $from_number,
"TO_NUMBER" => $to_number,
"LINE_NUMBER" => (!empty($queryData["LINE_NUMBER"])) ? $queryData["LINE_NUMBER"] : "",
// "QUEUENUM" => "99999",
"INNER_PHONE" => $innerphone,
"DIRECTION" => (!empty($direction)) ? $direction : "INBOUND",
]
]);
// $stRes = self::statAPI("update",[
// 'where' => ["ID" => $full["ALV_ECALLID"]],
// "KEY" => "4Ad49wD",
// 'fields' => [
// "DIALSTATUS" => 'DIALBEGIN',
// "TIME_DIALBEGIN" => time(),
// "BXCALLID" => (!empty($bxRes["result"]["CALL_ID"])) ? $bxRes["result"]["CALL_ID"] : "",
// "CHANNEL" => (!empty($full["channel"])) ? $full["channel"] : "",
// "USER_ID" => $userID,
// "FROM_NUMBER" => $from_number,
// "TO_NUMBER" => $to_number,
// "LINE_NUMBER" => (!empty($queryData["LINE_NUMBER"])) ? $queryData["LINE_NUMBER"] : "",
// // "QUEUENUM" => "99999",
// "INNER_PHONE" => $innerphone,
// "DIRECTION" => (!empty($direction)) ? $direction : "INBOUND",
// ]
// ]);
// $stRes = self::statAPI("insert",[
// 'fields' => [
......@@ -2512,22 +2512,22 @@ CFU=';
}
}
$stRes = self::statAPI("update",[
'where' => ["ID" => $full["ALV_ECALLID"]],
"KEY" => "4Ad49wD",
'fields' => [
"FULLINFO" => json_encode($full),
"QUEUENUM" => (!empty($full["QUEUENUM"])) ? $full["QUEUENUM"] : "",
"ANSWEREDTIME" => $duration,
"TIME_QUEUEJOINTIME" => (!empty($full["QUEUEJOINTIME"])) ? $full["QUEUEJOINTIME"] : "",
"TIME_HANGUP" => time(),
"LAST_POSITION" => $lastPosition,
"DIALSTATUS" => $dialStatus,
"REC" => (!empty($queryData["RECORD_URL"])) ? $queryData["RECORD_URL"] : "",
"GOOD" => (!empty($duration) && $duration>$goodSecods) ? 1 : NULL
]
]);
self::eLog($stRes,"--== finishCall STATAPI RES:");
// $stRes = self::statAPI("update",[
// 'where' => ["ID" => $full["ALV_ECALLID"]],
// "KEY" => "4Ad49wD",
// 'fields' => [
// "FULLINFO" => json_encode($full),
// "QUEUENUM" => (!empty($full["QUEUENUM"])) ? $full["QUEUENUM"] : "",
// "ANSWEREDTIME" => $duration,
// "TIME_QUEUEJOINTIME" => (!empty($full["QUEUEJOINTIME"])) ? $full["QUEUEJOINTIME"] : "",
// "TIME_HANGUP" => time(),
// "LAST_POSITION" => $lastPosition,
// "DIALSTATUS" => $dialStatus,
// "REC" => (!empty($queryData["RECORD_URL"])) ? $queryData["RECORD_URL"] : "",
// "GOOD" => (!empty($duration) && $duration>$goodSecods) ? 1 : NULL
// ]
// ]);
// self::eLog($stRes,"--== finishCall STATAPI RES:");
}
......@@ -3529,7 +3529,7 @@ CFU=';
}
public function statAPI($m,$p){
return [];
if(empty($m)){ return false; }
$params = [ "method" => $m ];
......
......@@ -429,7 +429,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
$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();
$BX_USERID = 1;
......
......@@ -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];
}
......
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