public function showQueue() { try { $oAsteriskLogin = $this->_getConfigManager(); //get agent_id based on agent number $astParams = array('server' => '127.0.0.1', 'port' => '5038'); $oAIM = new Net_AsteriskManager($astParams); $oAIM->connect(); $result = $oAIM->login($oAsteriskLogin[0], $oAsteriskLogin[1]); $result = $oAIM->_sendCommand("Action: EVENTS\r\n" . "EVENTMASK: OFF\r\n\r\n"); $result = $oAIM->getQueues(); $oAIM->logout(); $oAIM->close(); return $this->convertJsonData($result); } catch (Exception $e) { $this->errMsg = '(internal) showQueue failed: ' . $e->getMessage(); return FALSE; } }
function spycall($agent_number, $supervisor_queue, $whisper) { try { $oAsteriskLogin = $this->_getConfigManager(); $spy_number = '771'; //($whisper?'771':'772'); //$channel = 'Local/'.$supervisor_queue.'@ext-queues'; $channel = 'SIP/' . $supervisor_queue; $var = array('AGENT' => $agent_number, 'WHISPER' => $whisper ? 'w' : ''); $astParams = array('server' => '127.0.0.1', 'port' => '5038'); $oAIM = new Net_AsteriskManager($astParams); $oAIM->connect(); $result = $oAIM->login($oAsteriskLogin[0], $oAsteriskLogin[1]); $result = $oAIM->_sendCommand("Action: EVENTS\r\n" . "EVENTMASK: OFF\r\n\r\n"); $result = $oAIM->originateCall($spy_number, $channel, 'from-internal', $agent_number, 1, 30000, $var, null); $oAIM->logout(); $oAIM->close(); return $result; } catch (PEAR_Exception $e) { $this->errMsg = '(internal) spycall: ' . $e->getMessage(); return TRUE; //work arround for right action but show error } }