diff options
author | spag <spag@golwen.net> | 2013-01-21 23:21:48 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-01-21 23:21:48 +0100 |
commit | 495bbfdf78206c8adaec057e83900dda6754092c (patch) | |
tree | 159b80b556f31930023295ec3b885aaa0c2096ac /misc/freeswitch | |
parent | b116d8c75368e4e5593d0bd46850ea04eace83a2 (diff) |
order and limit added to redial query
Diffstat (limited to 'misc/freeswitch')
-rw-r--r-- | misc/freeswitch/scripts/dialplan/functions.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/misc/freeswitch/scripts/dialplan/functions.lua b/misc/freeswitch/scripts/dialplan/functions.lua index 3fa1589..2ca51c8 100644 --- a/misc/freeswitch/scripts/dialplan/functions.lua +++ b/misc/freeswitch/scripts/dialplan/functions.lua @@ -516,7 +516,13 @@ function Functions.redial(self, caller) return { continue = false, code = 403, phrase = 'Incompatible caller', no_cdr = true } end - local sql_query = 'SELECT `destination_number` FROM `call_histories` WHERE `entry_type` = "dialed" AND `call_historyable_type` = "SipAccount" AND `call_historyable_id` = ' .. caller_sip_account.record.id; + local sql_query = 'SELECT `destination_number` \ + FROM `call_histories` \ + WHERE `entry_type` = "dialed" \ + AND `call_historyable_type` = "SipAccount" \ + AND `call_historyable_id` = ' .. caller_sip_account.record.id .. ' \ + ORDER BY `start_stamp` DESC LIMIT 1'; + local phone_number = self.database:query_return_value(sql_query); common_str = require 'common.str'; |