summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-07-23 12:58:20 +0200
committerPeter Kozak <spag@golwen.net>2013-07-23 12:58:20 +0200
commit95cc4e82b1818c9adb2525e2787a0fb0d31955a8 (patch)
tree58cb9485a7b2c7b94fd8c09bb29fb210c3654ac5
parent8421bffd731abf1e6c6732ef891502624afb9d73 (diff)
snom vision class added
-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