diff --git a/app/sip_status/sip_status.php b/app/sip_status/sip_status.php index 364023a108..369d275272 100644 --- a/app/sip_status/sip_status.php +++ b/app/sip_status/sip_status.php @@ -85,6 +85,28 @@ $xml_response = trim(event_socket::api($cmd)); if ($xml_response) { $xml = new SimpleXMLElement($xml_response); + + //turn into array + $profilesA = array(); + foreach($xml->profile as $profile) { + $profilesA[] = $profile; + } + + //sort the array + function sortXML($a, $b) { + return strnatcmp($a->name, $b->name); + } + usort($profilesA, 'sortXML'); + + //convert array back to SimpleXMLElement + $xmlString = ""; + foreach ($profilesA as $node) { + $xmlStringRow = $node -> saveXML(); + $xmlString = $xmlString . $xmlStringRow; + } + $xmlString = $xmlString . ""; + + $xml = simplexml_load_string($xmlString); } } catch(Exception $e) {