summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan/functions.lua
diff options
context:
space:
mode:
Diffstat (limited to 'misc/freeswitch/scripts/dialplan/functions.lua')
-rw-r--r--misc/freeswitch/scripts/dialplan/functions.lua8
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';