From 8f1f5d41304510bd7c8eb71a3dbc040826261724 Mon Sep 17 00:00:00 2001 From: Nuno Miguel Reis Date: Wed, 22 Jan 2014 21:39:27 +0000 Subject: [PATCH] registrations panel reboot options (extended) --- app/registrations/cmd.php | 16 +++++++++++----- .../install/scripts/app/event_notify/index.lua | 8 +++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/registrations/cmd.php b/app/registrations/cmd.php index 9ad76a81f7..0c8d1f0a78 100644 --- a/app/registrations/cmd.php +++ b/app/registrations/cmd.php @@ -42,21 +42,27 @@ else { $agent = check_str($_GET['agent']); //get the vendor - if (substr($agent, 0, 6) == "Aastra") { + if (preg_replace('/^.*?(aastra).*$/i', '$1', strtolower($agent)) == "aastra") { $vendor = "aastra"; } - if (substr($agent, 0, 9) == "Cisco/SPA") { + if (preg_replace('/^.*?(cisco).*$/i', '$1', strtolower($agent)) == "cisco") { $vendor = "cisco"; } - if (substr($agent, 0,11) == "Grandstream") { + if (preg_replace('/^.*?(grandstream).*$/i', '$1', strtolower($agent)) == "grandstream") { $vendor = "grandstream"; } - if (substr($agent, 0, 10) == "PolycomVVX") { + if (preg_replace('/^.*?(polycom).*$/i', '$1', strtolower($agent)) == "polycom") { $vendor = "polycom"; } - if (substr($agent, 0, 7) == "Yealink") { + if (preg_replace('/^.*?(yealink).*$/i', '$1', strtolower($agent)) == "yealink") { $vendor = "yealink"; } + if (preg_replace('/^.*?(vp530p).*$/i', '$1', strtolower($agent)) == "vp530p") { + $vendor = "yealink"; + } + if (preg_replace('/^.*?(snom).*$/i', '$1', strtolower($agent)) == "snom") { + $vendor = "snom"; + } //create the event socket connection $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); diff --git a/resources/install/scripts/app/event_notify/index.lua b/resources/install/scripts/app/event_notify/index.lua index 0776245bcc..5589e48fd0 100644 --- a/resources/install/scripts/app/event_notify/index.lua +++ b/resources/install/scripts/app/event_notify/index.lua @@ -67,9 +67,15 @@ event:addHeader('event-string', 'check-sync;reboot=true'); end end +--snom + if (vendor == "snom") then + if (command == "reboot") then + event:addHeader('event-string', 'check-sync;reboot=true'); + end + end --send the event event:fire(); --log the event - freeswitch.consoleLog("notice", "[event_notify] command "..command.." "..user.."@"..domain.." vendor "..vendor.."\n"); + freeswitch.consoleLog("notice", "[event_notify] command "..command.." "..user.."@"..domain.." vendor "..tostring(vendor).."\n");