From 42ec3e041e3bbf55c6e2c37bc6d62569228c5ee2 Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Tue, 8 Jan 2013 04:58:27 +0100 Subject: Change path from /opt/GS5 to /opt/gemeinschaft --- misc/freeswitch/scripts/send_fax.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/send_fax.lua') diff --git a/misc/freeswitch/scripts/send_fax.lua b/misc/freeswitch/scripts/send_fax.lua index 321a5b1..ec9a8be 100644 --- a/misc/freeswitch/scripts/send_fax.lua +++ b/misc/freeswitch/scripts/send_fax.lua @@ -2,7 +2,7 @@ -- (c) AMOOMA GmbH 2012 -- -local FAX_FILE_PATH = "/opt/GS5/public/uploads/fax_document/tiff/"; +local FAX_FILE_PATH = "/opt/gemeinschaft/public/uploads/fax_document/tiff/"; local FAX_ANSWERING_TIMEOUT = 20; -- Set logger -- cgit v1.2.3 From faabc3e5db9310727e5d8cb9cd509adeb900d6c0 Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Tue, 8 Jan 2013 19:07:24 +0100 Subject: change GS5 default directory back to /opt/GS5 --- misc/freeswitch/scripts/send_fax.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/send_fax.lua') diff --git a/misc/freeswitch/scripts/send_fax.lua b/misc/freeswitch/scripts/send_fax.lua index ec9a8be..321a5b1 100644 --- a/misc/freeswitch/scripts/send_fax.lua +++ b/misc/freeswitch/scripts/send_fax.lua @@ -2,7 +2,7 @@ -- (c) AMOOMA GmbH 2012 -- -local FAX_FILE_PATH = "/opt/gemeinschaft/public/uploads/fax_document/tiff/"; +local FAX_FILE_PATH = "/opt/GS5/public/uploads/fax_document/tiff/"; local FAX_ANSWERING_TIMEOUT = 20; -- Set logger -- cgit v1.2.3 From 8744de13516c3fc2fbf2843e85aff08707f50de1 Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Fri, 18 Jan 2013 12:54:45 +0100 Subject: adjust copyright date for 2013 --- misc/freeswitch/scripts/send_fax.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/send_fax.lua') diff --git a/misc/freeswitch/scripts/send_fax.lua b/misc/freeswitch/scripts/send_fax.lua index 321a5b1..a3de5f6 100644 --- a/misc/freeswitch/scripts/send_fax.lua +++ b/misc/freeswitch/scripts/send_fax.lua @@ -1,5 +1,5 @@ -- Gemeinschaft 5.0 --- (c) AMOOMA GmbH 2012 +-- (c) AMOOMA GmbH 2012-2013 -- local FAX_FILE_PATH = "/opt/GS5/public/uploads/fax_document/tiff/"; -- cgit v1.2.3 From 1de349a41e84981171a197546e01eab2f1d2c09e Mon Sep 17 00:00:00 2001 From: spag Date: Fri, 18 Jan 2013 14:21:03 +0100 Subject: ini dependance removed --- misc/freeswitch/scripts/send_fax.lua | 52 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'misc/freeswitch/scripts/send_fax.lua') diff --git a/misc/freeswitch/scripts/send_fax.lua b/misc/freeswitch/scripts/send_fax.lua index 321a5b1..7099223 100644 --- a/misc/freeswitch/scripts/send_fax.lua +++ b/misc/freeswitch/scripts/send_fax.lua @@ -80,36 +80,38 @@ local session = nil if phone_number then session = freeswitch.Session("[" .. table.concat(origination_variables, ",") .. "]loopback/" .. destination_number .. "/default"); else - local owner_class = common.str.downcase(fax_account.record.fax_accountable_type); - - local caller = {} - caller.caller_phone_numbers = phone_number_class:list_by_owner(fax_account.record.id, 'FaxAccount'); - caller.account = fax_account; - caller.auth_account = fax_account; - caller.caller_id_name = fax_account.record.station_id; - - if owner_class == 'user' then - require 'dialplan.user' - caller.auth_account.owner = dialplan.user.User:new{ log = log, database = database }:find_by_id(fax_account.record.fax_accountable_id); - if caller.auth_account.owner then - caller.auth_account.owner.groups = caller.auth_account.owner:list_groups(); - end - elseif owner_class == 'tenant' then - require 'dialplan.tenant' - caller.auth_account.owner = dialplan.tenant.Tenant:new{ log = log, database = database }:find_by_id(fax_account.record.fax_accountable_id); + -- local owner_class = common.str.downcase(fax_account.record.fax_accountable_type); + + local caller = { + destination_number = destination_number, + caller_id_name = fax_account.record.station_id, + account_type = 'faxaccount', + account_uuid = fax_account.uuid, + auth_account_type = 'faxaccount', + auth_account_uuid = fax_account.uuid, + } + + -- caller.caller_phone_numbers = phone_number_class:list_by_owner(fax_account.record.id, 'FaxAccount'); + + require 'dialplan.dialplan' + local dialplan = dialplan.dialplan.Dialplan:new{ log = log, caller = caller, database = database }; + local result = dialplan:retrieve_caller_data(); + + local dialplan_router = require('dialplan.router'); + local routes = dialplan_router.Router:new{ log = log, database = database, caller = caller, variables = caller }:route_run('outbound', destination_number); + + if not routes or #routes == 0 then + log:notice('SWITCH - no route - number: ', destination_number); + return { continue = false, code = 404, phrase = 'No route' } end - require 'common.configuration_file' - local routing_table = common.configuration_file.get('/opt/freeswitch/scripts/ini/routes.ini'); - require 'dialplan.route' - local routes = dialplan.route.Route:new{ log = log, database = database, routing_table = routing_table }:outbound(caller, destination_number); - for index, route in ipairs(routes) do - log:info('FAX_SEND - ', route.class, '=', route.endpoint, ', number: ', route.value); - if route.class == 'gateway' then + log:info('FAX_SEND - ', route.type, '=', route.id, '/', route.gateway,', number: ', route.destination_number); + if route.type == 'gateway' then table.insert(origination_variables, "origination_caller_id_number='" .. (route.caller_id_number or caller.caller_phone_numbers[1]) .. "'"); table.insert(origination_variables, "origination_caller_id_name='" .. (route.caller_id_name or fax_account.record.station_id) .. "'"); - session = freeswitch.Session('[' .. table.concat(origination_variables, ',') .. ']sofia/gateway/' .. route.endpoint .. '/' .. route.value); + session = freeswitch.Session('[' .. table.concat(origination_variables, ',') .. ']sofia/gateway/' .. route.gateway .. '/' .. route.destination_number); + log:notice('SESSION: ', session); break; end end -- cgit v1.2.3 From 13f3c5274a025c6cc02200ea56488770d4a23984 Mon Sep 17 00:00:00 2001 From: spag Date: Fri, 18 Jan 2013 14:21:41 +0100 Subject: comments removed --- misc/freeswitch/scripts/send_fax.lua | 4 ---- 1 file changed, 4 deletions(-) (limited to 'misc/freeswitch/scripts/send_fax.lua') diff --git a/misc/freeswitch/scripts/send_fax.lua b/misc/freeswitch/scripts/send_fax.lua index 7099223..ffb81e2 100644 --- a/misc/freeswitch/scripts/send_fax.lua +++ b/misc/freeswitch/scripts/send_fax.lua @@ -80,8 +80,6 @@ local session = nil if phone_number then session = freeswitch.Session("[" .. table.concat(origination_variables, ",") .. "]loopback/" .. destination_number .. "/default"); else - -- local owner_class = common.str.downcase(fax_account.record.fax_accountable_type); - local caller = { destination_number = destination_number, caller_id_name = fax_account.record.station_id, @@ -90,8 +88,6 @@ else auth_account_type = 'faxaccount', auth_account_uuid = fax_account.uuid, } - - -- caller.caller_phone_numbers = phone_number_class:list_by_owner(fax_account.record.id, 'FaxAccount'); require 'dialplan.dialplan' local dialplan = dialplan.dialplan.Dialplan:new{ log = log, caller = caller, database = database }; -- cgit v1.2.3 From cc16ae7cc59189468854c455bde43a2609350964 Mon Sep 17 00:00:00 2001 From: spag Date: Sun, 20 Jan 2013 16:18:19 +0100 Subject: unused variable removed --- misc/freeswitch/scripts/send_fax.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/send_fax.lua') diff --git a/misc/freeswitch/scripts/send_fax.lua b/misc/freeswitch/scripts/send_fax.lua index 35460a3..11cd1d7 100644 --- a/misc/freeswitch/scripts/send_fax.lua +++ b/misc/freeswitch/scripts/send_fax.lua @@ -94,7 +94,7 @@ else local result = dialplan:retrieve_caller_data(); local dialplan_router = require('dialplan.router'); - local routes = dialplan_router.Router:new{ log = log, database = database, caller = caller, variables = caller }:route_run('outbound', destination_number); + local routes = dialplan_router.Router:new{ log = log, database = database, caller = caller, variables = caller }:route_run('outbound'); if not routes or #routes == 0 then log:notice('SWITCH - no route - number: ', destination_number); -- cgit v1.2.3