Update status_registrations.php

Add moteus fix to display lan ip for grandstream.
This commit is contained in:
FusionPBX 2017-01-20 03:42:20 -07:00 committed by GitHub
parent 283253ac17
commit f16b7851d6
1 changed files with 14 additions and 5 deletions

View File

@ -37,17 +37,26 @@ function get_registrations($sip_profile_name) {
$registrations[$x]['mwi-account'] = $row->{'mwi-account'} ?: " "; $registrations[$x]['mwi-account'] = $row->{'mwi-account'} ?: " ";
$registrations[$x]['status'] = $row->{'status'} ?: " "; $registrations[$x]['status'] = $row->{'status'} ?: " ";
$registrations[$x]['ping-time'] = $row->{'ping-time'} ?: " "; $registrations[$x]['ping-time'] = $row->{'ping-time'} ?: " ";
//get network-ip to url or blank //get network-ip to url or blank
if(isset($row->{'network-ip'})) { if(isset($row->{'network-ip'})) {
$registrations[$x]['network-ip'] = "<a href='http://".$row->{'network-ip'}."' target='_blank'>".$row->{'network-ip'}."</a>"; $registrations[$x]['network-ip'] = "<a href='http://".$row->{'network-ip'}."' target='_blank'>".$row->{'network-ip'}."</a>";
}else{ }else{
$registrations[$x]['network-ip'] = "&nbsp;"; $registrations[$x]['network-ip'] = "&nbsp;";
} }
//get the LAN IP address if it exists replace the external ip //get the LAN IP address if it exists replace the external ip
$call_id_array = explode('@', $row->{'call-id'}); $call_id_array = explode('@', $row->{'call-id'});
if (isset($call_id_array[1])) { if (isset($call_id_array[1])) {
$registrations[$x]['lan-ip'] = "<a href='http://".$call_id_array[1]."' target='_blank'>".$call_id_array[1]."</a>"; $agent = $row->{'agent'};
$lan_ip = $call_id_array[1];
if (false !== stripos($agent, 'grandstream')) {
$lan_ip = str_ireplace(
array('A','B','C','D','E','F','G','H','I','J'),
array('0','1','2','3','4','5','6','7','8','9'),
$lan_ip
);
}
$registrations[$x]['lan-ip'] = "<a href='http://".$lan_ip."' target='_blank'>".$lan_ip."</a>";
}else{ }else{
$registrations[$x]['lan-ip'] = "&nbsp;"; $registrations[$x]['lan-ip'] = "&nbsp;";
} }
@ -61,7 +70,7 @@ function get_registrations($sip_profile_name) {
} }
} }
} }
//increment the array id //increment the array id
$x++; $x++;
} }
@ -70,5 +79,5 @@ function get_registrations($sip_profile_name) {
//return the registrations array //return the registrations array
return $registrations; return $registrations;
} }
?> ?>