From f16b7851d657583b3f89f168d34ca6117762586e Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 20 Jan 2017 03:42:20 -0700 Subject: [PATCH] Update status_registrations.php Add moteus fix to display lan ip for grandstream. --- .../classes/status_registrations.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/registrations/resources/classes/status_registrations.php b/app/registrations/resources/classes/status_registrations.php index 1eba19ebe4..6db293f099 100644 --- a/app/registrations/resources/classes/status_registrations.php +++ b/app/registrations/resources/classes/status_registrations.php @@ -37,17 +37,26 @@ function get_registrations($sip_profile_name) { $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'] = "".$row->{'network-ip'}.""; + $registrations[$x]['network-ip'] = "".$row->{'network-ip'}.""; }else{ $registrations[$x]['network-ip'] = " "; } //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'] = "".$call_id_array[1].""; + $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'] = "".$lan_ip.""; }else{ $registrations[$x]['lan-ip'] = " "; } @@ -61,7 +70,7 @@ function get_registrations($sip_profile_name) { } } } - + //increment the array id $x++; } @@ -70,5 +79,5 @@ function get_registrations($sip_profile_name) { //return the registrations array return $registrations; } - + ?>