From 6de79d3edf6dfc0212b417751151bd6c5ab35740 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 1 Mar 2013 05:23:45 -0500 Subject: pass call forwarding to CallForwarding class --- misc/freeswitch/scripts/common/sip_account.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'misc/freeswitch/scripts/common/sip_account.lua') diff --git a/misc/freeswitch/scripts/common/sip_account.lua b/misc/freeswitch/scripts/common/sip_account.lua index 5b1ea56..90fa379 100644 --- a/misc/freeswitch/scripts/common/sip_account.lua +++ b/misc/freeswitch/scripts/common/sip_account.lua @@ -16,6 +16,7 @@ function SipAccount.new(self, arg) self.log = arg.log; self.database = arg.database; self.record = arg.record; + self.domain = arg.domain; return object; end @@ -140,3 +141,24 @@ function SipAccount.call_state(self) return state; end + + +function SipAccount.call_forwarding_on(self, service, destination, destination_type, timeout, source) + + if not self.call_forwarding then + require 'common.call_forwarding'; + self.call_forwarding = common.call_forwarding.CallForwarding:new{ log = self.log, database = self.database, parent = self, domain = self.domain }; + end + + return self.call_forwarding:call_forwarding_on(service, destination, destination_type, timeout, source) +end + + +function SipAccount.call_forwarding_off(self, service, source, delete) + if not self.call_forwarding then + require 'common.call_forwarding'; + self.call_forwarding = common.call_forwarding.CallForwarding:new{ log = self.log, database = self.database, parent = self, domain = self.domain }; + end + + return self.call_forwarding:call_forwarding_off(service, source, delete) +end -- cgit v1.2.3 From ecf2b91a0b0538b60fb708a237e10af77afe33dc Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sat, 2 Mar 2013 02:44:34 -0500 Subject: call waiting fixed --- misc/freeswitch/scripts/common/sip_account.lua | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'misc/freeswitch/scripts/common/sip_account.lua') diff --git a/misc/freeswitch/scripts/common/sip_account.lua b/misc/freeswitch/scripts/common/sip_account.lua index 90fa379..6cc7d25 100644 --- a/misc/freeswitch/scripts/common/sip_account.lua +++ b/misc/freeswitch/scripts/common/sip_account.lua @@ -129,17 +129,13 @@ function SipAccount.send_text(self, text) end -function SipAccount.call_state(self) - local state = nil - local sql_query = "SELECT `callstate` FROM `channels` \ - WHERE `name` LIKE (\"\%" .. self.record.auth_name .. "@%\") \ - OR `name` LIKE (\"\%" .. self.record.auth_name .. "@%\") LIMIT 1"; - - self.database:query(sql_query, function(channel_entry) - state = channel_entry.callstate; - end) +function SipAccount.call_state(self) + local sql_query = 'SELECT `callstate` FROM `detailed_calls` \ + WHERE `presence_id` LIKE "' .. self.record.auth_name .. '@%" \ + OR `b_presence_id` LIKE "' .. self.record.auth_name .. '@%" \ + LIMIT 1'; - return state; + return self.database:query_return_value(sql_query); end -- cgit v1.2.3