"Summary", "registries" => "Registries", "channels" => "Channels", "peers" => "Peers", "sip" => "Sip Info", "iax" => "IAX Info", "conferences" => "Conferences", "subscriptions" => "Subscriptions", "voicemail" => "Voicemail Users", "all" => "Full Report" ); $arr_all = array( "Uptime" => "show uptime", "Active Channel(s)" => "show channels", "Sip Channel(s)" => "sip show channels", "IAX2 Channel(s)" => "iax2 show channels", "Sip Registry" => "sip show registry", "Sip Peers" => "sip show peers", "IAX2 Registry" => "iax2 show registry", "IAX2 Peers" => "iax2 show peers", "Subscribe/Notify" => "show hints", "Zaptel driver info" => "zap show channels", "Conference Info" => "meetme", "Voicemail users" => "show voicemail users", ); $arr_registries = array( "Sip Registry" => "sip show registry", "IAX2 Registry" => "iax2 show registry", ); $arr_channels = array( "Active Channel(s)" => "show channels", "Sip Channel(s)" => "sip show channels", "IAX2 Channel(s)" => "iax2 show channels", ); $arr_peers = array( "Sip Peers" => "sip show peers", "IAX2 Peers" => "iax2 show peers", ); $arr_sip = array( "Sip Registry" => "sip show registry", "Sip Peers" => "sip show peers", ); $arr_iax = array( "IAX2 Registry" => "iax2 show registry", "IAX2 Peers" => "iax2 show peers", ); $arr_conferences = array( "Conference Info" => "meetme", ); $arr_subscriptions = array( "Subscribe/Notify" => "show hints" ); $arr_voicemail = array( "Voicemail users" => "show voicemail users", ); $engineinfo = engine_getinfo(); $astver = $engineinfo['version']; if (version_compare($astver, '1.4', 'ge')) { $arr_all["Uptime"]="core show uptime"; $arr_all["Active Channel(s)"]="core show channels"; $arr_all["Subscribe/Notify"]="core show hints"; $arr_all["Voicemail users"]="voicemail show users"; $arr_channels["Active Channel(s)"]="core show channels"; $arr_subscriptions["Subscribe/Notify"]="core show hints"; $arr_voicemail["Voicemail users"]="voicemail show users"; } ?>

$value) { ?>

The module was unable to connect to the asterisk manager.
Make sure Asterisk is running and your manager.conf settings are proper.

"; ?>

								send_request('Command',array('Command'=>$value));
								$new_value = $response['data'];
								echo ltrim($new_value,'Privilege: Command');
								?>
							

">
1){ if($channelType == NULL || $channelType == 'SIP'){ $sipChannel_arr = $channel_arr; $sipChannel_arrCount = count($sipChannel_arr); $sipChannel_string = $sipChannel_arr[$sipChannel_arrCount - 2]; $sipChannel = explode(' ', $sipChannel_string); return $sipChannel[0]; }elseif($channelType == 'IAX2'){ $iax2Channel_arr = $channel_arr; $iax2Channel_arrCount = count($iax2Channel_arr); $iax2Channel_string = $iax2Channel_arr[$iax2Channel_arrCount - 2]; $iax2Channel = explode(' ', $iax2Channel_string); return $iax2Channel[0]; } } } function getRegistration($registration, $channelType = 'SIP'){ if($channelType == NULL || $channelType == 'SIP'){ $sipRegistration_arr = $registration; $sipRegistration_count = count($sipRegistration_arr); return $sipRegistration_count-3; }elseif($channelType == 'IAX2'){ $iax2Registration_arr = $registration; $iax2Registration_count = count($iax2Registration_arr); return $iax2Registration_count-3; } } function getPeer($peer, $channelType = NULL){ global $astver_major, $astver_minor; global $astver; if(count($peer) > 1){ if($channelType == NULL || $channelType == 'SIP'){ $sipPeer = $peer; $sipPeer_count = count($sipPeer); $sipPeerInfo_arr['sipPeer_count'] = $sipPeer_count -3; $sipPeerInfo_string = $sipPeer[$sipPeer_count -2]; $sipPeerInfo_arr2 = explode('[',$sipPeerInfo_string); $sipPeerInfo_arr3 = explode(' ',$sipPeerInfo_arr2[1]); if (version_compare($astver, '1.4', 'ge')) { $sipPeerInfo_arr['online'] = $sipPeerInfo_arr3[1] + $sipPeerInfo_arr3[6]; $sipPeerInfo_arr['offline'] = $sipPeerInfo_arr3[3] + $sipPeerInfo_arr3[8]; }else{ $sipPeerInfo_arr['online'] = $sipPeerInfo_arr3[0]; $sipPeerInfo_arr['offline'] = $sipPeerInfo_arr3[3]; } return $sipPeerInfo_arr; }elseif($channelType == 'IAX2'){ $iax2Peer = $peer; $iax2Peer_count = count($iax2Peer); $iax2PeerInfo_arr['iax2Peer_count'] = $iax2Peer_count -3; $iax2PeerInfo_string = $iax2Peer[$iax2Peer_count -2]; $iax2PeerInfo_arr2 = explode('[',$iax2PeerInfo_string); $iax2PeerInfo_arr3 = explode(' ',$iax2PeerInfo_arr2[1]); $iax2PeerInfo_arr['online'] = $iax2PeerInfo_arr3[0]; $iax2PeerInfo_arr['offline'] = $iax2PeerInfo_arr3[2]; $iax2PeerInfo_arr['unmonitored'] = $iax2PeerInfo_arr3[4]; return $iax2PeerInfo_arr; } } } function buildAsteriskInfo(){ global $astman; global $astver; $arr = array( "Uptime" => "show uptime", "Active SIP Channel(s)" => "sip show channels", "Active IAX2 Channel(s)" => "iax2 show channels", "Sip Registry" => "sip show registry", "IAX2 Registry" => "iax2 show registry", "Sip Peers" => "sip show peers", "IAX2 Peers" => "iax2 show peers", ); if (version_compare($astver, '1.4', 'ge')) { $arr['Uptime'] = 'core show uptime'; } $htmlOutput = '
'; $htmlOutput .= ''; foreach ($arr as $key => $value) { $response = $astman->send_request('Command',array('Command'=>$value)); $astout = explode("\n",$response['data']); switch ($key) { case 'Uptime': $uptime = $astout; $htmlOutput .= '"; $htmlOutput .= ''; break; case 'Active SIP Channel(s)': $activeSipChannel = $astout; $activeSipChannel_count = getActiveChannel($activeSipChannel, $channelType = 'SIP'); $htmlOutput .= ''; $htmlOutput .= ""; break; case 'Active IAX2 Channel(s)': $activeIAX2Channel = $astout; $activeIAX2Channel_count = getActiveChannel($activeIAX2Channel, $channelType = 'IAX2'); $htmlOutput .= ""; $htmlOutput .= ''; break; break; case 'Sip Registry': $sipRegistration = $astout; $sipRegistration_count = getRegistration($sipRegistration, $channelType = 'SIP'); $htmlOutput .= ''; $htmlOutput .= ""; break; case 'IAX2 Registry': $iax2Registration = $astout; $iax2Registration_count = getRegistration($iax2Registration, $channelType = 'IAX2'); $htmlOutput .= ""; $htmlOutput .= ''; break; case 'Sip Peers': $sipPeer = $astout; $sipPeer_arr = getPeer($sipPeer, $channelType = 'SIP'); if($sipPeer_arr['offline'] != 0){ $sipPeerColor = 'red'; }else{ $sipPeerColor = '#000000'; } $htmlOutput .= ''; $htmlOutput .= ""; break; case 'IAX2 Peers': $iax2Peer = $astout; $iax2Peer_arr = getPeer($iax2Peer, $channelType = 'IAX2'); if($iax2Peer_arr['offline'] != 0){ $iax2PeerColor = 'red'; }else{ $iax2PeerColor = '#000000'; } $htmlOutput .= ""; $htmlOutput .= ''; break; default: } } $htmlOutput .= '
'.$uptime[1]."
".$uptime[2]."
Active Sip Channels: ".$activeSipChannel_count."Active IAX2 Channels: ".$activeIAX2Channel_count."
SIP Registrations: ".$sipRegistration_count."IAX2 Registrations: ".$iax2Registration_count."
SIP Peers
    Online: ".$sipPeer_arr['online']."
    Offline: ".$sipPeer_arr['offline']."
IAX2 Peers
    Online: ".$iax2Peer_arr['online']."
    Offline: ".$iax2Peer_arr['offline']."
    Unmonitored: ".$iax2Peer_arr['unmonitored']."
'; return $htmlOutput."
"; } ?>