/** * Query Asterisk for details via SNMP */ public function ajaxGetForHostAction() { $host = $this->_getParam('host', null); if ($host) { $device = new \OSS_SNMP\SNMP($host, $this->_options['community']); $details['astVersion'] = $device->useAsterisk()->version(); $details['astTag'] = $device->useAsterisk()->tag(); $details['astUptime'] = $this->_timeticksToString($device->useAsterisk()->uptime()); $details['astReload'] = $this->_timeticksToString($device->useAsterisk()->reloadTime()); $details['astCallsProcessed'] = $device->useAsterisk()->callsProcessed(); $details['astCallsActive'] = $device->useAsterisk()->callsActive(); $details['calls'] = $device->useAsterisk_Channels()->channelDetails(true); unset($device); $this->getResponse()->setHeader('Content-Type', 'application/json')->setBody(Zend_Json::encode($details))->sendResponse(); exit(0); } }
echo "Asterisk on {$argv[1]} reloaded: " . $host->useAsterisk()->reloadTime() / 100 / 60 / 60 . " hours ago\n"; echo "Asterisk PID: " . $host->useAsterisk()->pid() . "\n"; echo "Asterisk control socket: " . $host->useAsterisk()->controlSocket() . "\n"; echo "Calls active: " . $host->useAsterisk()->callsActive() . "\n"; echo "Calls processed: " . $host->useAsterisk()->callsProcessed() . "\n"; echo "Modules compiled in: " . $host->useAsterisk()->modules() . "\n"; echo "\n\n"; echo "Indications defined: " . $host->useAsterisk_Indications()->number() . "\n"; echo "Default indications zone: " . $host->useAsterisk_Indications()->defaultZone() . "\n"; echo "Indication country codes:\n\n"; print_r($host->useAsterisk_Indications()->countryCodes()); echo "\n\n"; echo "Indication descriptions:\n\n"; print_r($host->useAsterisk_Indications()->descriptions()); echo "\n\n"; echo "Channels active: " . $host->useAsterisk_Channels()->active() . "\n"; echo "Channels supported: " . $host->useAsterisk_Channels()->supported() . "\n"; echo "Channel type names:\n\n"; print_r($host->useAsterisk_Channels()->names()); echo "\n\n"; echo "Channel type descriptions:\n\n"; print_r($host->useAsterisk_Channels()->descriptions()); echo "\n\n"; echo "Channel type device state capability:\n\n"; print_r($host->useAsterisk_Channels()->deviceStates()); echo "\n\n"; echo "Channel type progress indication capability:\n\n"; print_r($host->useAsterisk_Channels()->progressIndications()); echo "\n\n"; echo "Channel type transfer capability:\n\n"; print_r($host->useAsterisk_Channels()->transfers());