Fix my PR for the device registered on extensions page. (#1772)

* Fix my PR for the device registered on extensions page.

* Change to registered
This commit is contained in:
Chris Black
2016-07-27 23:03:59 -06:00
committed by FusionPBX
parent e408cc33bf
commit 1cca98951d
5 changed files with 127 additions and 47 deletions
+2 -47
View File
@@ -27,6 +27,7 @@
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/classes/status_registrations.php";
//check permissions
if (permission_exists("registration_domain") || permission_exists("registration_all") || if_group("superadmin")) {
@@ -88,53 +89,7 @@ require_once "resources/check_auth.php";
exit;
}
//build the registration array
if (count($xml->registrations->registration) > 0) {
$registrations = '';
$x = 0;
foreach ($xml->registrations->registration as $row) {
//get the values from xml and set them to the channel array
$registrations[$x]['user'] = $row->{'user'} ?: " ";
$user_array = explode('@', $row->{'user'});
$registrations[$x]['call-id'] = $row->{'call-id'} ?: " ";
$registrations[$x]['contact'] = $row->{'contact'} ?: " ";
$registrations[$x]['sip-auth-user'] = $row->{'sip-auth-user'} ?: " ";
$registrations[$x]['agent'] = $row->{'agent'} ?: " ";
$registrations[$x]['host'] = $row->{'host'} ?: " ";
$registrations[$x]['network-port'] = $row->{'network-port'} ?: " ";
$registrations[$x]['sip-auth-realm'] = $row->{'sip-auth-realm'} ?: " ";
$registrations[$x]['mwi-account'] = $row->{'mwi-account'} ?: " ";
$registrations[$x]['status'] = $row->{'status'} ?: " ";
$registrations[$x]['ping-time'] = $row->{'ping-time'} ?: " ";
//get network-ip to url or blank
if(isset($row->{'network-ip'})) {
$registrations[$x]['network-ip'] = "<a href='http://".$row->{'network-ip'}."' target='_blank'>".$row->{'network-ip'}."</a>";
}else{
$registrations[$x]['network-ip'] = "&nbsp;";
}
//get the LAN IP address if it exists replace the external ip
$call_id_array = explode('@', $row->{'call-id'});
if (isset($call_id_array[1])) {
$registrations[$x]['lan-ip'] = "<a href='http://".$call_id_array[1]."' target='_blank'>".$call_id_array[1]."</a>";
}else{
$registrations[$x]['lan-ip'] = "&nbsp;";
}
//remove unrelated domains
if (count($_SESSION["domains"]) > 1) {
if (!(permission_exists('registration_all') && $show == "all")) {
if ($registrations[$x]['sip-auth-realm'] == $_SESSION['domain_name']) {}
elseif ($user_array[1] == $_SESSION['domain_name']){}
else {
unset($registrations[$x]);
}
}
}
//increment the array id
$x++;
}
}
$registrations = get_registrations($sip_profile_name);
//show the registrations
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\n";