From 0ae2c077c6be0be7ad05bd6a0e090b388c7c490f Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 31 Jul 2013 08:53:14 +0200 Subject: phone.record can be nil --- misc/freeswitch/scripts/phones/phone.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/misc/freeswitch/scripts/phones/phone.lua b/misc/freeswitch/scripts/phones/phone.lua index a256b12..6219eb1 100644 --- a/misc/freeswitch/scripts/phones/phone.lua +++ b/misc/freeswitch/scripts/phones/phone.lua @@ -115,10 +115,13 @@ end function Phone.resync(self, arg) local result = nil; - 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; - + + if self.record then + 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; + end + if self.model then result = self.model:resync(arg); else @@ -127,7 +130,9 @@ function Phone.resync(self, arg) result = phones.snom.Snom:new{ log = self.log }:resync(arg); end - self:resync_extension_modules(arg); + if self.record and self.record.id then + self:resync_extension_modules(arg); + end return result; end -- cgit v1.2.3