コード例 #1
0
ファイル: queue_waiting.class.php プロジェクト: hardikk/HNH
 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;
     }
 }
コード例 #2
0
ファイル: example.php プロジェクト: vladylen/magento-test
 * Begin monitoring channel to filename "test.gsm"
 * If it fails then echo Asterisk error
 */
$chan = 'SIP/868';
try {
    $ast->startMonitor($chan, 'test', 'gsm', 1);
} catch (PEAR_Exception $e) {
    echo $e;
}
/**
 * Queues
 * List queues then add and remove a handset from a queue
 */
// Print all the queues on the server
try {
    echo $ast->getQueues();
} catch (PEAR_Exception $e) {
    echo $e;
}
// Add the SIP handset 234 to a the applicants queue
try {
    $ast->queueAdd('applicants', 'SIP/234', 1);
} catch (PEAR_Exception $e) {
    echo $e;
}
// Take it out again
try {
    $ast->queueRemove('applicants', 'SIP/234');
} catch (PEAR_Exception $e) {
    echo $e;
}