mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-03 10:23:50 +00:00
Update index.lua
This commit is contained in:
@@ -27,7 +27,8 @@
|
||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||
-- Luis Daniel Lucio Qurioz <dlucio@okay.com.mx>
|
||||
|
||||
local log = require "resources.functions.log".ring_group
|
||||
--include the log
|
||||
local log = require "resources.functions.log".ring_group
|
||||
|
||||
--connect to the database
|
||||
local Database = require "resources.functions.database";
|
||||
@@ -47,26 +48,57 @@ local log = require "resources.functions.log".ring_group
|
||||
require "resources.functions.channel_utils"
|
||||
require "resources.functions.format_ringback"
|
||||
|
||||
--get the variables
|
||||
domain_name = session:getVariable("domain_name");
|
||||
ring_group_uuid = session:getVariable("ring_group_uuid");
|
||||
recordings_dir = session:getVariable("recordings_dir");
|
||||
sounds_dir = session:getVariable("sounds_dir");
|
||||
--define the session hangup
|
||||
function session_hangup_hook()
|
||||
|
||||
--variables that don't require ${} when used in the dialplan conditions
|
||||
username = session:getVariable("username");
|
||||
dialplan = session:getVariable("dialplan");
|
||||
caller_id_name = session:getVariable("caller_id_name");
|
||||
caller_id_number = session:getVariable("caller_id_number");
|
||||
network_addr = session:getVariable("network_addr");
|
||||
ani = session:getVariable("ani");
|
||||
aniii = session:getVariable("aniii");
|
||||
rdnis = session:getVariable("rdnis");
|
||||
destination_number = session:getVariable("destination_number");
|
||||
source = session:getVariable("source");
|
||||
uuid = session:getVariable("uuid");
|
||||
context = session:getVariable("context");
|
||||
call_direction = session:getVariable("call_direction");
|
||||
--send info to the log
|
||||
--freeswitch.consoleLog("notice","[ring_groups] originate_disposition: " .. session:getVariable("originate_disposition") .. "\n");
|
||||
|
||||
--run the missed called function
|
||||
if (
|
||||
session:getVariable("originate_disposition") == "ALLOTTED_TIMEOUT"
|
||||
or session:getVariable("originate_disposition") == "NO_ANSWER"
|
||||
or session:getVariable("originate_disposition") == "NO_USER_RESPONSE"
|
||||
or session:getVariable("originate_disposition") == "USER_NOT_REGISTERED"
|
||||
or session:getVariable("originate_disposition") == "NORMAL_TEMPORARY_FAILURE"
|
||||
or session:getVariable("originate_disposition") == "NO_ROUTE_DESTINATION"
|
||||
or session:getVariable("originate_disposition") == "USER_BUSY"
|
||||
or session:getVariable("originate_disposition") == "RECOVERY_ON_TIMER_EXPIRE"
|
||||
or session:getVariable("originate_disposition") == "failure"
|
||||
or session:getVariable("originate_disposition") == "ORIGINATOR_CANCEL"
|
||||
) then
|
||||
--send missed call notification
|
||||
missed();
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--set the hangup hook function
|
||||
if (session:ready()) then
|
||||
session:setHangupHook("session_hangup_hook");
|
||||
end
|
||||
|
||||
--get the variables
|
||||
if (session:ready()) then
|
||||
session:setAutoHangup(false);
|
||||
domain_name = session:getVariable("domain_name");
|
||||
ring_group_uuid = session:getVariable("ring_group_uuid");
|
||||
recordings_dir = session:getVariable("recordings_dir");
|
||||
sounds_dir = session:getVariable("sounds_dir");
|
||||
username = session:getVariable("username");
|
||||
dialplan = session:getVariable("dialplan");
|
||||
caller_id_name = session:getVariable("caller_id_name");
|
||||
caller_id_number = session:getVariable("caller_id_number");
|
||||
network_addr = session:getVariable("network_addr");
|
||||
ani = session:getVariable("ani");
|
||||
aniii = session:getVariable("aniii");
|
||||
rdnis = session:getVariable("rdnis");
|
||||
destination_number = session:getVariable("destination_number");
|
||||
source = session:getVariable("source");
|
||||
uuid = session:getVariable("uuid");
|
||||
context = session:getVariable("context");
|
||||
call_direction = session:getVariable("call_direction");
|
||||
end
|
||||
|
||||
--default to local if nil
|
||||
if (call_direction == nil) then
|
||||
@@ -83,12 +115,14 @@ local log = require "resources.functions.log".ring_group
|
||||
external = "false";
|
||||
|
||||
--set the sounds path for the language, dialect and voice
|
||||
default_language = session:getVariable("default_language");
|
||||
default_dialect = session:getVariable("default_dialect");
|
||||
default_voice = session:getVariable("default_voice");
|
||||
if (not default_language) then default_language = 'en'; end
|
||||
if (not default_dialect) then default_dialect = 'us'; end
|
||||
if (not default_voice) then default_voice = 'callie'; end
|
||||
if (session:ready()) then
|
||||
default_language = session:getVariable("default_language");
|
||||
default_dialect = session:getVariable("default_dialect");
|
||||
default_voice = session:getVariable("default_voice");
|
||||
if (not default_language) then default_language = 'en'; end
|
||||
if (not default_dialect) then default_dialect = 'us'; end
|
||||
if (not default_voice) then default_voice = 'callie'; end
|
||||
end
|
||||
|
||||
--get record_ext
|
||||
record_ext = session:getVariable("record_ext");
|
||||
@@ -655,15 +689,11 @@ local log = require "resources.functions.log".ring_group
|
||||
or session:getVariable("originate_disposition") == "RECOVERY_ON_TIMER_EXPIRE"
|
||||
or session:getVariable("originate_disposition") == "failure"
|
||||
) then
|
||||
--send missed call notification
|
||||
missed();
|
||||
--execute the time out action
|
||||
session:execute(ring_group_timeout_app, ring_group_timeout_data);
|
||||
end
|
||||
else
|
||||
if (ring_group_timeout_app ~= nil) then
|
||||
--send missed call notification
|
||||
missed();
|
||||
--execute the time out action
|
||||
session:execute(ring_group_timeout_app, ring_group_timeout_data);
|
||||
else
|
||||
@@ -674,14 +704,13 @@ local log = require "resources.functions.log".ring_group
|
||||
freeswitch.consoleLog("notice", "[ring group] SQL:" .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
end
|
||||
dbh:query(sql, params, function(row)
|
||||
--send missed call notification
|
||||
missed();
|
||||
--execute the time out action
|
||||
session:execute(row.ring_group_timeout_app, row.ring_group_timeout_data);
|
||||
end);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--actions
|
||||
|
||||
Reference in New Issue
Block a user