|
|
|
@ -69,39 +69,4 @@ class ServiceQueue implements IService
|
|
|
|
|
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()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |