Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane James Rose */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('system_status_sofia_status') || permission_exists('system_status_sofia_status_profile') || if_group("superadmin")) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support require_once "app_languages.php"; foreach($text as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } //define variables $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; if ($_GET['a'] == "download") { if ($_GET['t'] == "cdrcsv") { $tmp = $_SESSION['switch']['log']['dir'].'/cdr-csv/'; $filename = 'Master.csv'; } if ($_GET['t'] == "backup") { $tmp = $backup_dir.'/'; $filename = 'backup.tgz'; if (!is_dir($backup_dir.'/')) { exec("mkdir ".$backup_dir."/"); } $parent_dir = realpath($_SESSION['switch']['base']['dir']."/.."); chdir($parent_dir); shell_exec('tar cvzf freeswitch '.$backup_dir.'/backup.tgz'); } session_cache_limiter('public'); $fd = fopen($tmp.$filename, "rb"); header("Content-Type: binary/octet-stream"); header("Content-Length: " . filesize($tmp.$filename)); header('Content-Disposition: attachment; filename="'.$filename.'"'); fpassthru($fd); exit; } //show the content require_once "resources/header.php"; $msg = $_GET["savemsg"]; $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if (!$fp) { $msg = "
".$text['error-event-socket']."
"; } if (strlen($msg) > 0) { echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-message']."
$msg
\n"; echo "
\n"; } //get the gateways $sql = "select g.domain_uuid, g.gateway, g.gateway_uuid, d.domain_name from v_gateways as g, v_domains as d "; $sql .= "where d.domain_uuid = g.domain_uuid "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $gateways = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); //sofia status if ($fp && permission_exists('system_status_sofia_status')) { $cmd = "api sofia xmlstatus"; $xml_response = trim(event_socket_request($fp, $cmd)); try { $xml = new SimpleXMLElement($xml_response); } catch(Exception $e) { echo $e->getMessage(); } echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo " ".$text['title-sofia-status']." \n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; foreach ($xml->profile as $row) { echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } foreach ($xml->gateway as $row) { $gateway_name = ''; $gateway_domain_name = ''; foreach($gateways as $field) { if ($field["gateway_uuid"] == $row->name) { $gateway_name = $field["gateway"]; $gateway_domain_name = $field["domain_name"]; break; } } echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } foreach ($xml->alias as $row) { //print_r($row); echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } echo "
NameTypeDataState
".$row->name."".$row->type."".$row->data."".$row->state."
".$gateway_name."@".$gateway_domain_name."".$row->type."".$row->data."".$row->state."
".$row->name."".$row->type."".$row->data."".$row->state."
\n"; echo "
\n"; unset($xml); } //sofia status profile if (permission_exists('system_status_sofia_status_profile')) { foreach (ListFiles($_SESSION['switch']['conf']['dir'].'/sip_profiles') as $key=>$sip_profile_file){ if (substr($sip_profile_file, -4) == ".xml") { $sip_profile_name = str_replace(".xml", "", $sip_profile_file); if ($fp) { $cmd = "api sofia xmlstatus profile ".$sip_profile_name.""; $xml_response = trim(event_socket_request($fp, $cmd)); if ($xml_response == "Invalid Profile!") { $xml_response = "Invalid Profile!"; } $xml_response = str_replace("", "", $xml_response); $xml_response = str_replace("", "", $xml_response); try { $xml = new SimpleXMLElement($xml_response); } catch(Exception $e) { echo $e->getMessage(); exit; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo " ".$text['title-sofia-status-profile']." ".$sip_profile_name." \n"; echo "\n"; if ($sip_profile_name != "external") { echo " \n"; } echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo ""; unset($xml); } } } } //status if ($fp && permission_exists('sip_status_switch_status')) { $cmd = "api status"; $response = event_socket_request($fp, $cmd); echo "".$text['title-status']."\n"; echo "
"; echo "
";
		echo trim($response);
		echo "
\n"; echo "
"; fclose($fp); } //include the footer require_once "resources/footer.php"; ?>