summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--misc/freeswitch/scripts/phones/snom_vision.lua39
1 files changed, 39 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/phones/snom_vision.lua b/misc/freeswitch/scripts/phones/snom_vision.lua
new file mode 100644
index 0000000..ba8a184
--- /dev/null
+++ b/misc/freeswitch/scripts/phones/snom_vision.lua
@@ -0,0 +1,39 @@
+-- Gemeinschaft 5 module: snom vision extension module model class
+-- (c) AMOOMA GmbH 2012-2013
+--
+
+module(...,package.seeall)
+
+SnomVision = {}
+
+-- Create SnomVision object
+function SnomVision.new(self, arg)
+ arg = arg or {}
+ object = arg.object or {}
+ setmetatable(object, self);
+ self.__index = self;
+ self.log = arg.log;
+ self.reboot = arg.reboot or true;
+ return object;
+end
+
+-- send reload message to module
+function SnomVision.resync(self, arg)
+ if arg.ip_address then
+ return self:resync_http(arg.ip_address, arg.http_user, arg.http_password, arg.http_port);
+ end
+
+ return false;
+end
+
+
+function SnomVision.resync_http(self, ip_address, http_user, http_password, http_port)
+ local port_str = '';
+ if tonumber(http_port) then
+ port_str = ':' .. http_port;
+ end
+
+ local command = 'http_request.lua snom_vision_resync http://' .. tostring(ip_address):gsub('[^0-9%.]', '') .. port_str .. '/ConfigurationModule/restart ' .. (http_user or '') .. ' ' .. (http_password or '');
+ require 'common.fapi'
+ return common.fapi.FApi:new():execute('luarun', command);
+end