From 4118edd666a9d9539f9c77f703212973f3c39838 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Tue, 10 Jun 2014 03:32:35 +0000 Subject: [PATCH] Make the Grandstream use the lua event notify script, and add the sip profile name. --- app/registrations/cmd.php | 22 +++++++++++++--------- app/registrations/status_registrations.php | 6 +++--- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/registrations/cmd.php b/app/registrations/cmd.php index 998d482931..a9cb979b61 100644 --- a/app/registrations/cmd.php +++ b/app/registrations/cmd.php @@ -43,6 +43,7 @@ else { //set the variables $cmd = check_str($_GET['cmd']); $rdr = check_str($_GET['rdr']); + $profile = check_str($_GET['profile']); $domain = check_str($_GET['domain']); $user = check_str($_GET['user']); $agent = check_str($_GET['agent']); @@ -73,18 +74,21 @@ else { //create the event socket connection $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($fp) { - //lua - //$command = "api luarun app.lua event_notify ".$cmd." ".$user." ".$domain." ".$vendor; - //reboot - if ($cmd == "reboot") { - $command = "api sofia profile internal flush_inbound_reg ".$user." reboot"; + //prepare the command + if ($vendor == "grandstream") { + $command = "lua app.lua event_notify ".$cmd." ".$profile." ".$user." ".$vendor; } - //check_sync - if ($cmd == "check_sync") { - $command = "api sofia profile internal check_sync ".$user; + else { + if ($cmd == "reboot") { + $command = "sofia profile ".$profile." flush_inbound_reg ".$user." reboot"; + } + if ($cmd == "check_sync") { + $command = "sofia profile ".$profile." check_sync ".$user; + } } //send the command - $response = event_socket_request($fp, $command); + $response = event_socket_request($fp, "api ".$command); + $response = event_socket_request($fp, "api log notice ".$command); //show the response $_SESSION['message'] = $text['label-event']." ".ucwords($cmd)."     ".$text['label-response'].$response; //close the connection diff --git a/app/registrations/status_registrations.php b/app/registrations/status_registrations.php index 2382c1bd11..f99d50dcd3 100644 --- a/app/registrations/status_registrations.php +++ b/app/registrations/status_registrations.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2014 the Initial Developer. All Rights Reserved. Contributor(s): @@ -210,8 +210,8 @@ require_once "resources/check_auth.php"; //echo "  ".$row['mwi-account']." \n"; echo "  ".$row['status']." \n"; echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; }