Browse Source

clean code in servicequeue

websocket
lucas cardoso 3 years ago
parent
commit
e8984f821e
  1. 35
      service/ServiceQueue.php
  2. 1
      service/ServiceSupervisorPBx.php

35
service/ServiceQueue.php

@ -69,39 +69,4 @@ class ServiceQueue implements IService
break; break;
} }
} }
function timeoutAgente($item, $conn)
{
$freetime = $item['FREETIME'] / 60;
if (($freetime >= $this->timeout_agent_alert) && ($freetime < $this->timeout_agent_desconexao) && !$item['SALA2'] && $item['STATUS'] == CONF_AGENT_STATUS_LIVRE) {
$this->agente->timeFinishAgente($item['MATRICULA'], $item['RAMAL'], ($this->timeout_agent_desconexao - $this->timeout_agent_alert));
$conn->send($this->enviaActions($this->mensagem['ALERTA_INATIVIDADE'], 'ALERTA_INATIVIDADE'));
} else if ($freetime >= $this->timeout_agent_desconexao && $item['STATUS'] == CONF_AGENT_STATUS_LIVRE) {
$this->agente->logoff($item['RAMAL']);
$conn->send($this->enviaActions($this->mensagem['ALERTA_DESCONECTADO'], 'ALERTA_DESCONECTADO'));
} else {
$this->agente->refreshAgent($item['RAMAL'], $item['SALA2']);
}
}
function enviaActions($msg, $tipo)
{
try {
$mensagem = [];
$mensagem["event"] = [
"type" => 'actions',
"contact" => [
"name" => 'Sistema',
"number" => '0'
],
"mensagem" => [
"type" => $tipo,
"content" => utf8_encode($msg)
],
];
return json_encode($mensagem);
} catch (\Exception $th) {
logger('monitora')->info($th->getMessage(), debug_backtrace());
}
}
} }

1
service/ServiceSupervisorPBx.php

@ -25,7 +25,6 @@ class ServiceSupervisorPBx implements IService
function atualizaTabelaSupervisor($agente, $agentePbx) function atualizaTabelaSupervisor($agente, $agentePbx)
{ {
$this->supervisor->updateAgent2( $this->supervisor->updateAgent2(
$agente->matricula, $agente->matricula,
$agente->ramal, $agente->ramal,

Loading…
Cancel
Save