From acb016e9262e950e610d485eecc0605440533e2a Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 24 Jan 2013 15:38:21 +0100 Subject: use http_request for phone resync --- misc/freeswitch/scripts/phones/snom.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'misc/freeswitch/scripts/phones') diff --git a/misc/freeswitch/scripts/phones/snom.lua b/misc/freeswitch/scripts/phones/snom.lua index 096ccb7..ef3ab93 100644 --- a/misc/freeswitch/scripts/phones/snom.lua +++ b/misc/freeswitch/scripts/phones/snom.lua @@ -53,11 +53,10 @@ function Snom.resync_http(self, ip_address, http_user, http_password, http_port) port_str = ':' .. http_port; end - get_command = 'wget --no-proxy -q -O /dev/null -o /dev/null -b --tries=2 --timeout=10 --user="' .. (http_user or '') .. '" --password="' .. (http_password or '') .. '"' .. - ' wget http://' .. tostring(ip_address):gsub('[^0-9%.]', '') .. port_str .. '/advanced.htm?reboot=Reboot' .. - ' 1>>/dev/null 2>>/dev/null &'; + local command = 'http_request.lua snom_resync http://' .. tostring(ip_address):gsub('[^0-9%.]', '') .. port_str .. '/advanced.htm?reboot=Reboot ' .. (http_user or '') .. ' ' .. (http_password or ''); - result = os.execute(get_command); + require 'common.fapi' + common.fapi.FApi:new():execute('luarun', command); if result and tonumber(result) == 0 then return true; -- cgit v1.2.3 From d8ad6ffe483156ea5474e7c1874ea618d44ba306 Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 24 Jan 2013 15:39:17 +0100 Subject: pass user/password to resync method --- misc/freeswitch/scripts/phones/phone.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'misc/freeswitch/scripts/phones') diff --git a/misc/freeswitch/scripts/phones/phone.lua b/misc/freeswitch/scripts/phones/phone.lua index 856398b..6da20f0 100644 --- a/misc/freeswitch/scripts/phones/phone.lua +++ b/misc/freeswitch/scripts/phones/phone.lua @@ -28,10 +28,10 @@ function Phone.list_by_sql(self, sql_query) if phone.record.ieee_name == 'snom technology ag' then require 'phones.snom' - phone.model = phones.snom.Snom:new(); + phone.model = phones.snom.Snom:new{ log = self.log }; elseif account_entry.ieee_name == 'siemens enterprise communicationsgmbh & co. kg' then require 'phones.siemens' - phone.model = phones.siemens.Siemens:new(); + phone.model = phones.siemens.Siemens:new{ log = self.log }; end table.insert(account_phones, phone); end) @@ -120,5 +120,8 @@ function Phone.resync(self, arg) end arg.ip_address = arg.ip_address or self.record.ip_address; + arg.http_user = arg.http_user or self.record.http_user; + arg.http_password = arg.http_password or self.record.http_password; + return self.model:resync(arg); -end \ No newline at end of file +end -- cgit v1.2.3 From 04eea0955c4a7b6d183fa7545b61c0732b8b41b8 Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 24 Jan 2013 15:59:49 +0100 Subject: unused variables --- misc/freeswitch/scripts/phones/snom.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'misc/freeswitch/scripts/phones') diff --git a/misc/freeswitch/scripts/phones/snom.lua b/misc/freeswitch/scripts/phones/snom.lua index ef3ab93..bb17796 100644 --- a/misc/freeswitch/scripts/phones/snom.lua +++ b/misc/freeswitch/scripts/phones/snom.lua @@ -56,9 +56,5 @@ function Snom.resync_http(self, ip_address, http_user, http_password, http_port) local command = 'http_request.lua snom_resync http://' .. tostring(ip_address):gsub('[^0-9%.]', '') .. port_str .. '/advanced.htm?reboot=Reboot ' .. (http_user or '') .. ' ' .. (http_password or ''); require 'common.fapi' - common.fapi.FApi:new():execute('luarun', command); - - if result and tonumber(result) == 0 then - return true; - end + return common.fapi.FApi:new():execute('luarun', command); end -- cgit v1.2.3