From 49b22ca42ba17c8250a31996ca909fd6dc090fa4 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Mon, 16 Dec 2013 19:37:06 +0000 Subject: [PATCH] Translate the gateway uuid into the name and domain name on the SIP Status page. --- app/sip_status/sip_status.php | 58 ++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/app/sip_status/sip_status.php b/app/sip_status/sip_status.php index 4cc242bb76..692ee64c86 100644 --- a/app/sip_status/sip_status.php +++ b/app/sip_status/sip_status.php @@ -72,25 +72,34 @@ if ($_GET['a'] == "download") { exit; } -require_once "resources/header.php"; +//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"; -} + $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')) { @@ -124,7 +133,6 @@ if (strlen($msg) > 0) { echo "State\n"; echo "\n"; foreach ($xml->profile as $row) { - //print_r($row); echo "\n"; echo " ".$row->name."\n"; echo " ".$row->type."\n"; @@ -134,9 +142,17 @@ if (strlen($msg) > 0) { if ($c==0) { $c=1; } else { $c=0; } } foreach ($xml->gateway as $row) { - //print_r($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 " ".$row->name."\n"; + echo " ".$gateway_name."@".$gateway_domain_name."\n"; echo " ".$row->type."\n"; echo " ".$row->data."\n"; echo " ".$row->state."\n";