Fix the ON NET outbound caller id name and number

This commit is contained in:
Mark Crane
2014-07-02 05:34:14 +00:00
parent 3626cebc4c
commit a4e54c3ad3

View File

@@ -25,6 +25,8 @@
--get the variables
domain_name = session:getVariable("domain_name");
destination_number = session:getVariable("destination_number");
outbound_caller_id_name = session:getVariable("outbound_caller_id_name");
outbound_caller_id_number = session:getVariable("outbound_caller_id_number");
--connect to the database
dofile(scripts_dir.."/resources/functions/database_handle.lua");
@@ -37,21 +39,18 @@
if (cache == "-ERR NOT FOUND") then
sql = "SELECT destination_number, destination_context "
sql = sql .. "FROM v_destinations "
sql = sql .. "WHERE destination_number like '%"..destination_number.."' "
sql = sql .. "WHERE destination_number = '"..destination_number.."' "
sql = sql .. "AND destination_type = 'inbound' "
sql = sql .. "AND destination_enabled = 'true' "
--freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
assert(dbh:query(sql, function(row)
--get the outbound caller id
outbound_caller_id_name = session:getVariable("outbound_caller_id_name");
outbound_caller_id_number = session:getVariable("outbound_caller_id_number");
--set the outbound caller id
if (outbound_caller_id_name ~= nil) then
session:execute("set", "effective_caller_id_name="..outbound_caller_id_name);
session:execute("export", "caller_id_name="..outbound_caller_id_name);
end
if (outbound_caller_id_number ~= nil) then
session:execute("set", "effective_caller_id_number="..outbound_caller_id_number);
session:execute("export", "caller_id_number="..outbound_caller_id_number);
end
--set the local variables