diff --git a/app/registrations/app_config.php b/app/registrations/app_config.php
index 021c13b75b..7524b5f7b3 100644
--- a/app/registrations/app_config.php
+++ b/app/registrations/app_config.php
@@ -34,7 +34,7 @@
$apps[$x]['menu'][0]['uuid'] = "17dbfd56-291d-8c1c-bc43-713283a9dd5a";
$apps[$x]['menu'][0]['parent_uuid'] = "0438b504-8613-7887-c420-c837ffb20cb1";
$apps[$x]['menu'][0]['category'] = "internal";
- $apps[$x]['menu'][0]['path'] = "/app/registrations/status_registrations.php?show_reg=1&profile=internal";
+ $apps[$x]['menu'][0]['path'] = "/app/registrations/status_registrations.php?profile=internal";
$apps[$x]['menu'][0]['groups'][] = "admin";
$apps[$x]['menu'][0]['groups'][] = "superadmin";
diff --git a/app/registrations/app_languages.php b/app/registrations/app_languages.php
index 8dee17e7db..51aaa67b90 100644
--- a/app/registrations/app_languages.php
+++ b/app/registrations/app_languages.php
@@ -75,11 +75,6 @@
$text['button-back']['pt-pt'] = "Voltar";
$text['button-back']['fr-fr'] = "Retour";
- $text['button-refresh']['en-us'] = "Refresh";
- $text['button-refresh']['es-cl'] = "Actualizar";
- $text['button-refresh']['pt-pt'] = "Actualizar";
- $text['button-refresh']['fr-fr'] = "RafraƮchir";
-
$text['label-interval']['en-us'] = "Interval (Sec)";
$text['label-interval']['es-cl'] = "Intervalo";
$text['label-interval']['pt-pt'] = "Intervalo";
diff --git a/app/registrations/status_registrations.php b/app/registrations/status_registrations.php
index bc3068a29b..bcbd064431 100644
--- a/app/registrations/status_registrations.php
+++ b/app/registrations/status_registrations.php
@@ -46,188 +46,78 @@ require_once "resources/check_auth.php";
//request form values and set them as variables
$sip_profile_name = trim($_REQUEST["profile"]);
-//define variables
- $c = 0;
- $row_style["0"] = "row_style0";
- $row_style["1"] = "row_style1";
+//show the header
+ require_once "resources/header.php";
+ $page["title"] = $text['header-registrations'];
-//create the event socket connection
- $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
- if (!$fp) {
- $msg = "
".$text['error-event-socket']."
";
+//ajax for refresh
+ ?>
+ \n";
-
- echo "\n";
-
- echo "\n";
- echo "\n";
- echo "\n";
-
- echo "\n";
-
- //close the connection and unset the variable
- fclose($fp);
- unset($xml);
+ loadXmlHttp.prototype.stateChanged=function () {
+ if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
+ //this.el.innerHTML = this.xmlHttp.responseText;
+ document.getElementById('ajax_reponse').innerHTML = this.xmlHttp.responseText;
}
-//add some space at the bottom of the page
- echo "
\n";
- echo "
\n";
- echo "
\n";
+ var requestTime = function() {
+ var url = 'status_registrations_inc.php?profile=internal';
+ new loadXmlHttp(url, 'ajax_reponse');
+ setInterval(function(){new loadXmlHttp(url, 'ajax_reponse');}, 1500);
+ }
+
+ if (window.addEventListener) {
+ window.addEventListener('load', requestTime, false);
+ }
+ else if (window.attachEvent) {
+ window.attachEvent('onload', requestTime);
+ }
+
+ var record_count = 0;
+ var destination;
+
+
+ \n";
+ echo " \n";
+ echo " | \n";
+ echo " \n";
+ include_once "status_registrations_inc.php";
+ echo " \n";
+ echo " ".date('Y-m-d-s')." \n";
+ echo " | ";
+ echo "
";
+ echo "";
+
+
//get the footer
require_once "resources/footer.php";
diff --git a/app/registrations/status_registrations_inc.php b/app/registrations/status_registrations_inc.php
new file mode 100644
index 0000000000..17af21ba9b
--- /dev/null
+++ b/app/registrations/status_registrations_inc.php
@@ -0,0 +1,178 @@
+
+ Portions created by the Initial Developer are Copyright (C) 2008-2014
+ the Initial Developer. All Rights Reserved.
+
+ Contributor(s):
+ Mark J Crane
+ James Rose
+*/
+include "root.php";
+require_once "resources/require.php";
+require_once "resources/check_auth.php";
+
+//check permissions
+ if (permission_exists("registration_domain") || permission_exists("registration_all") || if_group("superadmin")) {
+ //access granted
+ }
+ else {
+ echo "access denied";
+ exit;
+ }
+
+//add multi-lingual support
+ if (!is_array($text)) {
+ require_once "app_languages.php";
+ foreach($text as $key => $value) {
+ $text[$key] = $value[$_SESSION['domain']['language']['code']];
+ }
+ }
+
+//request form values and set them as variables
+ $sip_profile_name = trim($_REQUEST["profile"]);
+
+//define variables
+ $c = 0;
+ $row_style["0"] = "row_style0";
+ $row_style["1"] = "row_style1";
+
+//create the event socket connection
+ $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
+ if (!$fp) {
+ $msg = "".$text['error-event-socket']."
";
+ }
+
+//show the error message or show the content
+ if (strlen($msg) > 0) {
+ echo "\n";
+ echo "
\n";
+ echo "\n";
+ echo "| ".$text['label-message']." | \n";
+ echo "
\n";
+ echo "\n";
+ echo "| $msg | \n";
+ echo "
\n";
+ echo "
\n";
+ echo "
\n";
+ }
+ else {
+ //get sofia status profile information including registrations
+ $cmd = "api sofia xmlstatus profile ".$sip_profile_name." reg";
+ $xml_response = trim(event_socket_request($fp, $cmd));
+ if ($xml_response == "Invalid Profile!") { $xml_response = "".$text['label-message'].""; }
+ $xml_response = str_replace("", "", $xml_response);
+ $xml_response = str_replace("", "", $xml_response);
+ try {
+ $xml = new SimpleXMLElement($xml_response);
+ }
+ catch(Exception $e) {
+ echo $e->getMessage();
+ 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-ip'] = $row->{'network-ip'};
+ $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'};
+
+ //remove unrelated domains
+ if (count($_SESSION["domains"]) > 1) {
+ if (permission_exists('registration_all')) {
+ //show all registrations
+ }
+ else {
+ if ($registrations[$x]['sip-auth-realm'] != $_SESSION['domain_name']) {
+ unset($registrations[$x]);
+ }
+ }
+ }
+ //increment the array id
+ $x++;
+ }
+ }
+
+ //show the registrations
+ echo "\n";
+ echo "\n";
+ echo "| \n";
+ echo " ".$text['header-registrations'].": ".count($registrations)."\n";
+ echo " | \n";
+ echo "
\n";
+ echo "
\n";
+ echo "
\n";
+
+ echo "\n";
+
+ //close the connection and unset the variable
+ fclose($fp);
+ unset($xml);
+ }
+
+?>
\ No newline at end of file