diff options
author | Mario "Kuroir" Ricalde <kuroir@gmail.com> | 2013-03-05 11:01:01 -0600 |
---|---|---|
committer | Mario "Kuroir" Ricalde <kuroir@gmail.com> | 2013-03-05 11:01:01 -0600 |
commit | 4fcdd330139921b6fa5d4f9d15fb5f91775b27af (patch) | |
tree | 62e82c385c9a804a8f32da6f276881ff8c21fc90 /misc/freeswitch/scripts/common/sip_account.lua | |
parent | 2b94b16ee1201d15b3b9d66e142df311141a47db (diff) | |
parent | a865b1f9506b900ed8643c01d94c86268e907720 (diff) |
Merge remote-tracking branch 'origin/develop' into develop
Diffstat (limited to 'misc/freeswitch/scripts/common/sip_account.lua')
-rw-r--r-- | misc/freeswitch/scripts/common/sip_account.lua | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/misc/freeswitch/scripts/common/sip_account.lua b/misc/freeswitch/scripts/common/sip_account.lua index 5b1ea56..6cc7d25 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 @@ -128,15 +129,32 @@ 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"; +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'; - self.database:query(sql_query, function(channel_entry) - state = channel_entry.callstate; - end) + return self.database:query_return_value(sql_query); +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 state; + return self.call_forwarding:call_forwarding_off(service, source, delete) end |