get($_SESSION['domain']['language']['code'], 'app/switch');
//switch status
echo "
\n";
//set the row style class names
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//switch version
if (permission_exists('switch_version') && $fp) {
$switch_version = event_socket_request($fp, 'api version');
preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(.*?(\d+\w+)\s*\)/", $switch_version, $matches);
$switch_version = $matches[1];
$switch_bits = $matches[2];
}
//switch uptime
if (permission_exists('switch_uptime') && $fp) {
$tmp = event_socket_request($fp, 'api status');
$tmp = explode("\n", $tmp);
$tmp = $tmp[0];
$tmp = explode(' ', $tmp);
$uptime = (($tmp[1]) ? $tmp[1].'y ' : null);
$uptime .= (($tmp[3]) ? $tmp[3].'d ' : null);
$uptime .= (($tmp[5]) ? $tmp[5].'h ' : null);
$uptime .= (($tmp[7]) ? $tmp[7].'m ' : null);
$uptime .= (($tmp[9]) ? $tmp[9].'s' : null);
if (permission_exists('system_status_sofia_status') || permission_exists('system_status_sofia_status_profile') || if_group("superadmin")) {
$tr_link_sip_status = "href='".PROJECT_PATH."/app/sip_status/sip_status.php'";
}
}
//channel count
if (permission_exists('switch_channels') && $fp) {
$tmp = event_socket_request($fp, 'api status');
$matches = Array();
preg_match("/(\d+)\s+session\(s\)\s+\-\speak/", $tmp, $matches);
$channels = $matches[1] ? $matches[1] : 0;
if (permission_exists('call_active_view')) {
$tr_link_channels = "href='".PROJECT_PATH."/app/calls_active/calls_active.php'";
}
}
//registration count
if (permission_exists('switch_registrations') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) {
$registration = new registrations;
if (permission_exists("registration_all")) {
$registration->show = 'all';
$tr_link_registrations = "href='".PROJECT_PATH."/app/registrations/registrations.php'";
}
$registrations = $registration->count();
}
//add doughnut chart
?>
";
echo "
\n";
echo "\n";
echo "| ".$text['label-name']." | \n";
echo "".$text['label-value']." | \n";
echo "
\n";
//switch version
if (permission_exists('switch_version') && $switch_version != '') {
echo "\n";
echo "| ".$text['label-switch']." | \n";
echo "".$switch_version." (".$switch_bits.") | \n";
echo "
\n";
$c = ($c) ? 0 : 1;
}
//switch uptime
if (permission_exists('switch_uptime') && $uptime != '') {
echo "\n";
echo "| ".$text['label-switch_uptime']." | \n";
echo "".$uptime." | \n";
echo "
\n";
$c = ($c) ? 0 : 1;
}
//switch channels
if (permission_exists('switch_channels')) {
echo "\n";
echo "| ".$text['label-channels']." | \n";
echo "".$channels." | \n";
echo "
\n";
$c = ($c) ? 0 : 1;
}
//switch registrations
if (permission_exists('switch_registrations')) {
echo "\n";
echo "| ".$text['label-registrations']." | \n";
echo "".$registrations." | \n";
echo "
\n";
$c = ($c) ? 0 : 1;
}
echo "
\n";
echo "
";
//$n++;
echo "