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