summaryrefslogtreecommitdiff
path: root/misc/freeswitch
diff options
context:
space:
mode:
Diffstat (limited to 'misc/freeswitch')
-rw-r--r--misc/freeswitch/scripts/acd_wait.lua2
-rw-r--r--misc/freeswitch/scripts/common/call_forwarding.lua2
-rw-r--r--misc/freeswitch/scripts/common/call_history.lua2
-rw-r--r--misc/freeswitch/scripts/common/conference.lua2
-rw-r--r--misc/freeswitch/scripts/common/configuration_file.lua2
-rw-r--r--misc/freeswitch/scripts/common/fapi.lua2
-rw-r--r--misc/freeswitch/scripts/common/gateway.lua21
-rw-r--r--misc/freeswitch/scripts/common/ipcalc.lua2
-rw-r--r--misc/freeswitch/scripts/common/log.lua2
-rw-r--r--misc/freeswitch/scripts/common/phone_number.lua2
-rw-r--r--misc/freeswitch/scripts/common/routing_tables.lua2
-rw-r--r--misc/freeswitch/scripts/common/sip_account.lua2
-rw-r--r--misc/freeswitch/scripts/common/str.lua2
-rw-r--r--misc/freeswitch/scripts/common/sync_log.lua2
-rw-r--r--misc/freeswitch/scripts/configuration.lua11
-rw-r--r--misc/freeswitch/scripts/configuration/sip.lua8
-rw-r--r--misc/freeswitch/scripts/dialplan/acd.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/cdr.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/dialplan.lua29
-rw-r--r--misc/freeswitch/scripts/dialplan/fax.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/geo_number.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/hunt_group.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/phone_book.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/presence.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/route.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/router.lua11
-rw-r--r--misc/freeswitch/scripts/dialplan/session.lua5
-rw-r--r--misc/freeswitch/scripts/dialplan/sip_call.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/tenant.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/user.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/voicemail.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan_default.lua2
-rw-r--r--misc/freeswitch/scripts/event/call_history_save.lua2
-rw-r--r--misc/freeswitch/scripts/event/cdr_save.lua2
-rw-r--r--misc/freeswitch/scripts/event/event.lua2
-rw-r--r--misc/freeswitch/scripts/event/perimeter.lua2
-rw-r--r--misc/freeswitch/scripts/event_manager.lua5
-rw-r--r--misc/freeswitch/scripts/fax_daemon.lua2
-rw-r--r--misc/freeswitch/scripts/ini/gateways.ini.example23
-rw-r--r--misc/freeswitch/scripts/ini/routes.ini80
-rw-r--r--misc/freeswitch/scripts/phones/phone.lua2
-rw-r--r--misc/freeswitch/scripts/phones/siemens.lua2
-rw-r--r--misc/freeswitch/scripts/phones/snom.lua2
-rw-r--r--misc/freeswitch/scripts/send_fax.lua50
44 files changed, 111 insertions, 200 deletions
diff --git a/misc/freeswitch/scripts/acd_wait.lua b/misc/freeswitch/scripts/acd_wait.lua
index fd16bea..c05cc24 100644
--- a/misc/freeswitch/scripts/acd_wait.lua
+++ b/misc/freeswitch/scripts/acd_wait.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5: acd call handler
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
local caller_uuid = argv[1];
diff --git a/misc/freeswitch/scripts/common/call_forwarding.lua b/misc/freeswitch/scripts/common/call_forwarding.lua
index 3942d05..400fcde 100644
--- a/misc/freeswitch/scripts/common/call_forwarding.lua
+++ b/misc/freeswitch/scripts/common/call_forwarding.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: call forwarding class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/call_history.lua b/misc/freeswitch/scripts/common/call_history.lua
index 7a9ac07..7e1e22b 100644
--- a/misc/freeswitch/scripts/common/call_history.lua
+++ b/misc/freeswitch/scripts/common/call_history.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: call_history class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/conference.lua b/misc/freeswitch/scripts/common/conference.lua
index a7b21c3..ca5fa62 100644
--- a/misc/freeswitch/scripts/common/conference.lua
+++ b/misc/freeswitch/scripts/common/conference.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: conference class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/configuration_file.lua b/misc/freeswitch/scripts/common/configuration_file.lua
index 67e1f3b..3b3efbc 100644
--- a/misc/freeswitch/scripts/common/configuration_file.lua
+++ b/misc/freeswitch/scripts/common/configuration_file.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: configuration file
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/fapi.lua b/misc/freeswitch/scripts/common/fapi.lua
index 0a05155..5b96633 100644
--- a/misc/freeswitch/scripts/common/fapi.lua
+++ b/misc/freeswitch/scripts/common/fapi.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: FS api class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/gateway.lua b/misc/freeswitch/scripts/common/gateway.lua
index 5c76aba..e50c763 100644
--- a/misc/freeswitch/scripts/common/gateway.lua
+++ b/misc/freeswitch/scripts/common/gateway.lua
@@ -52,6 +52,27 @@ function Gateway.find_by_id(self, id)
end
+function Gateway.find_by_name(self, name)
+ local gateway_name = name:gsub('([^%a%d%._%+])', '');
+
+ local sql_query = 'SELECT * FROM `gateways` WHERE `name`= "' .. gateway_name .. '" LIMIT 1';
+
+ local gateway = nil;
+ self.database:query(sql_query, function(entry)
+ gateway = Gateway:new(self);
+ gateway.record = entry;
+ gateway.id = tonumber(entry.id);
+ gateway.name = entry.name;
+ end)
+
+ if gateway then
+ gateway.settings = self:config_table_get('gateway_settings', gateway.id);
+ end
+
+ return gateway;
+end
+
+
function Gateway.authenticate(self, technology, caller)
local sql_query = 'SELECT `c`.`name`, `c`.`id`, `a`.`value` `auth_source`, `b`.`value` `auth_pattern` \
FROM `gateway_settings` `a` \
diff --git a/misc/freeswitch/scripts/common/ipcalc.lua b/misc/freeswitch/scripts/common/ipcalc.lua
index 5c19d20..49cb56c 100644
--- a/misc/freeswitch/scripts/common/ipcalc.lua
+++ b/misc/freeswitch/scripts/common/ipcalc.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: ip calculation functions
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/log.lua b/misc/freeswitch/scripts/common/log.lua
index d0d13dc..5aff2b8 100644
--- a/misc/freeswitch/scripts/common/log.lua
+++ b/misc/freeswitch/scripts/common/log.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: log
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/phone_number.lua b/misc/freeswitch/scripts/common/phone_number.lua
index 4df0d57..6635296 100644
--- a/misc/freeswitch/scripts/common/phone_number.lua
+++ b/misc/freeswitch/scripts/common/phone_number.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: phone number class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/routing_tables.lua b/misc/freeswitch/scripts/common/routing_tables.lua
index 34d0143..f28b5c5 100644
--- a/misc/freeswitch/scripts/common/routing_tables.lua
+++ b/misc/freeswitch/scripts/common/routing_tables.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: routing table functions
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/sip_account.lua b/misc/freeswitch/scripts/common/sip_account.lua
index 28a00df..8dd432b 100644
--- a/misc/freeswitch/scripts/common/sip_account.lua
+++ b/misc/freeswitch/scripts/common/sip_account.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: sip account class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/str.lua b/misc/freeswitch/scripts/common/str.lua
index c366fda..32f054e 100644
--- a/misc/freeswitch/scripts/common/str.lua
+++ b/misc/freeswitch/scripts/common/str.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: string functions
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/common/sync_log.lua b/misc/freeswitch/scripts/common/sync_log.lua
index 05b0dcf..3fdb646 100644
--- a/misc/freeswitch/scripts/common/sync_log.lua
+++ b/misc/freeswitch/scripts/common/sync_log.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: sync log class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/configuration.lua b/misc/freeswitch/scripts/configuration.lua
index 1162e97..9e62bb6 100644
--- a/misc/freeswitch/scripts/configuration.lua
+++ b/misc/freeswitch/scripts/configuration.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 dynamic freeswitch configuration
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
function nodes(database, local_node_id)
@@ -312,10 +312,9 @@ function directory_sip_account(database)
if string.len(auth_name) > 3 and auth_name:sub(1, 3) == 'gw+' then
local gateway_name = auth_name:sub(4);
domain = domain or freeswitch.API():execute('global_getvar', 'domain');
- require 'configuration.sip'
- log:notice('DATABASE: ', database);
- local sip_gateway = configuration.sip.Sip:new{ log = log, database = database}:find_gateway_by_name(gateway_name);
- if sip_gateway ~= nil and next(sip_gateway) ~= nil then
+ require 'common.gateway'
+ local sip_gateway = common.gateway.Gateway:new{ log = self.log, database = self.database }:find_by_name(gateway_name);
+ if sip_gateway then
log:debug('DIRECTORY_GATEWAY - name: ', gateway_name, ', auth_name: ', auth_name);
local user_variables = {
@@ -332,7 +331,7 @@ function directory_sip_account(database)
'params',
xml:element{
'param',
- password = sip_gateway.password,
+ password = sip_gateway.record.password,
}
},
xml:element{
diff --git a/misc/freeswitch/scripts/configuration/sip.lua b/misc/freeswitch/scripts/configuration/sip.lua
index 78143bc..6f5b204 100644
--- a/misc/freeswitch/scripts/configuration/sip.lua
+++ b/misc/freeswitch/scripts/configuration/sip.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: sip configuration class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
@@ -18,12 +18,6 @@ function Sip.new(self, arg)
return object;
end
--- find gateway by name
-function Sip.find_gateway_by_name(self, name)
- require 'common.configuration_file'
- return common.configuration_file.get('/opt/freeswitch/scripts/ini/gateways.ini', name);
-end
-
-- list sip domains
function Sip.domains(self)
local sql_query = 'SELECT * FROM `sip_domains`';
diff --git a/misc/freeswitch/scripts/dialplan/acd.lua b/misc/freeswitch/scripts/dialplan/acd.lua
index 563d836..f4b298e 100644
--- a/misc/freeswitch/scripts/dialplan/acd.lua
+++ b/misc/freeswitch/scripts/dialplan/acd.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: acd class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/cdr.lua b/misc/freeswitch/scripts/dialplan/cdr.lua
index 55a7889..d0fdede 100644
--- a/misc/freeswitch/scripts/dialplan/cdr.lua
+++ b/misc/freeswitch/scripts/dialplan/cdr.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: cdr class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua
index e90354c..3fcb2bd 100644
--- a/misc/freeswitch/scripts/dialplan/dialplan.lua
+++ b/misc/freeswitch/scripts/dialplan/dialplan.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: dialplan class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
@@ -7,7 +7,6 @@ module(...,package.seeall)
Dialplan = {}
-- local constants
-local CONFIG_FILE_NAME = '/opt/freeswitch/scripts/ini/dialplan.ini';
local DIAL_TIMEOUT = 120;
local MAX_LOOPS = 20;
local DIALPLAN_FUNCTION_PATTERN = '^f[_%-].*';
@@ -235,19 +234,21 @@ end
function Dialplan.retrieve_caller_data(self)
- self.caller.caller_phone_numbers_hash = {}
-
require 'common.str'
- local dialed_sip_user = self.caller:to_s('dialed_user');
+ self.caller.caller_phone_numbers_hash = {}
-- TODO: Set auth_account on transfer initiated by calling party
- if not common.str.blank(dialed_sip_user) then
- self.caller.auth_account = self:object_find('sipaccount', self.caller:to_s('dialed_domain'), dialed_sip_user);
- self.caller:set_auth_account(self.caller.auth_account);
+ if not common.str.blank(self.caller.dialed_sip_user) then
+ self.caller.auth_account = self:object_find('sipaccount', self.caller.dialed_domain, dialed_sip_user);
+ if self.caller.set_auth_account then
+ self.caller:set_auth_account(self.caller.auth_account);
+ end
elseif not common.str.blank(self.caller.auth_account_type) and not common.str.blank(self.caller.auth_account_uuid) then
self.caller.auth_account = self:object_find(self.caller.auth_account_type, self.caller.auth_account_uuid);
- self.caller:set_auth_account(self.caller.auth_account);
+ if self.caller.set_auth_account then
+ self.caller:set_auth_account(self.caller.auth_account);
+ end
end
if self.caller.auth_account then
@@ -276,7 +277,7 @@ function Dialplan.retrieve_caller_data(self)
self.log:error('CALLER_DATA - caller owner not found');
end
- if not self.caller.clir then
+ if not self.caller.clir and self.caller.set_caller_id then
self.caller:set_caller_id(self.caller.caller_phone_numbers[1], self.caller.account.record.caller_name or self.caller.account.record.name);
end
else
@@ -624,7 +625,7 @@ function Dialplan.callthrough(self, destination)
end
require 'dialplan.router'
- local route = dialplan.router.Router:new{ log = self.log, database = self.database, caller = self.caller }:route_run('prerouting', destination_number, true);
+ local route = dialplan.router.Router:new{ log = self.log, database = self.database, caller = self.caller, variables = self.caller }:route_run('prerouting', destination_number, true);
if route and route.destination_number then
destination_number = route.destination_number;
@@ -773,7 +774,7 @@ function Dialplan.switch(self, destination)
destination.callee_id_name = nil;
require 'dialplan.router'
- local routes = dialplan.router.Router:new{ log = self.log, database = self.database, caller = self.caller }:route_run('outbound', destination.number);
+ local routes = dialplan.router.Router:new{ log = self.log, database = self.database, caller = self.caller, variables = self.caller }:route_run('outbound', destination.number);
if not routes or #routes == 0 then
self.log:notice('SWITCH - no route - number: ', destination.number);
@@ -878,7 +879,7 @@ function Dialplan.run(self, destination)
self.caller.destination_number = self.caller:to_s(self.caller.gateway.settings.number_source);
end
- route = dialplan.router.Router:new{ log = self.log, database = self.database, caller = self.caller }:route_run('inbound', self.caller.destination_number, true);
+ route = dialplan.router.Router:new{ log = self.log, database = self.database, caller = self.caller, variables = self.caller }:route_run('inbound', self.caller.destination_number, true);
if route then
local ignore_keys = {
id = true,
@@ -898,7 +899,7 @@ function Dialplan.run(self, destination)
self.log:notice('INBOUND - no route');
end
else
- route = dialplan.router.Router:new{ log = self.log, database = self.database, caller = self.caller }:route_run('prerouting', self.caller.destination_number, true);
+ route = dialplan.router.Router:new{ log = self.log, database = self.database, caller = self.caller, variables = self.caller }:route_run('prerouting', self.caller.destination_number, true);
if route then
local ignore_keys = {
id = true,
diff --git a/misc/freeswitch/scripts/dialplan/fax.lua b/misc/freeswitch/scripts/dialplan/fax.lua
index 2a40620..aa29ff6 100644
--- a/misc/freeswitch/scripts/dialplan/fax.lua
+++ b/misc/freeswitch/scripts/dialplan/fax.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: fax class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/geo_number.lua b/misc/freeswitch/scripts/dialplan/geo_number.lua
index 06bfd62..76cc01b 100644
--- a/misc/freeswitch/scripts/dialplan/geo_number.lua
+++ b/misc/freeswitch/scripts/dialplan/geo_number.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: geonumber class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/hunt_group.lua b/misc/freeswitch/scripts/dialplan/hunt_group.lua
index 87f86f1..44c2bb8 100644
--- a/misc/freeswitch/scripts/dialplan/hunt_group.lua
+++ b/misc/freeswitch/scripts/dialplan/hunt_group.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: hunt group class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/phone_book.lua b/misc/freeswitch/scripts/dialplan/phone_book.lua
index 089f115..6653789 100644
--- a/misc/freeswitch/scripts/dialplan/phone_book.lua
+++ b/misc/freeswitch/scripts/dialplan/phone_book.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: phone book class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/presence.lua b/misc/freeswitch/scripts/dialplan/presence.lua
index 234b908..0f63ce9 100644
--- a/misc/freeswitch/scripts/dialplan/presence.lua
+++ b/misc/freeswitch/scripts/dialplan/presence.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: presence class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/route.lua b/misc/freeswitch/scripts/dialplan/route.lua
index 2243cbe..a12b5f9 100644
--- a/misc/freeswitch/scripts/dialplan/route.lua
+++ b/misc/freeswitch/scripts/dialplan/route.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: routing class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua
index 6c5b9f1..5f427ac 100644
--- a/misc/freeswitch/scripts/dialplan/router.lua
+++ b/misc/freeswitch/scripts/dialplan/router.lua
@@ -52,21 +52,20 @@ function Router.read_table(self, table_name)
end
-function Router.expand_variables(self, line)
- return (line:gsub('{([%a%d_]+)}', function(captured)
- return variables[captured] or '';
+function Router.expand_variables(self, line, variables)
+ return (line:gsub('{([%a%d%._]+)}', function(captured)
+ return common.str.try(variables, captured) or '';
end))
end
function Router.element_match(self, pattern, search_string, replacement)
- local variables_list = {};
local success, result = pcall(string.find, search_string, pattern);
if not success then
self.log:error('ELEMENT_MATCH - table error - pattern: ', pattern, ', search_string: ', search_string);
elseif result then
- return true, search_string:gsub(pattern, self:expand_variables(replacement, variables_list));
+ return true, search_string:gsub(pattern, self:expand_variables(replacement, self.variables));
end
return false;
@@ -109,7 +108,7 @@ function Router.route_match(self, route)
if element.action ~= 'none' then
if common.str.blank(element.var_in) or common.str.blank(element.pattern) and element.action == 'set' then
result = true;
- replacement = element.replacement;
+ replacement = self:expand_variables(element.replacement, self.variables);
else
local command, variable_name = common.str.partition(element.var_in, ':');
diff --git a/misc/freeswitch/scripts/dialplan/session.lua b/misc/freeswitch/scripts/dialplan/session.lua
index 20fef88..7de85ca 100644
--- a/misc/freeswitch/scripts/dialplan/session.lua
+++ b/misc/freeswitch/scripts/dialplan/session.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: caller session class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
@@ -43,6 +43,9 @@ function Session.init_channel_variables(self)
self.from_gateway = true;
end
+ self.dialed_sip_user = self:to_s('dialed_user');
+ self.dialed_domain = self:to_s('dialed_domain');
+
self.account_uuid = self:to_s('gs_account_uuid');
self.account_type = self:to_s('gs_account_type');
self.sip_contact_host = self:to_s('sip_contact_host');
diff --git a/misc/freeswitch/scripts/dialplan/sip_call.lua b/misc/freeswitch/scripts/dialplan/sip_call.lua
index 0b799e5..3f56753 100644
--- a/misc/freeswitch/scripts/dialplan/sip_call.lua
+++ b/misc/freeswitch/scripts/dialplan/sip_call.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: sip call class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall);
diff --git a/misc/freeswitch/scripts/dialplan/tenant.lua b/misc/freeswitch/scripts/dialplan/tenant.lua
index 8d6436c..904609e 100644
--- a/misc/freeswitch/scripts/dialplan/tenant.lua
+++ b/misc/freeswitch/scripts/dialplan/tenant.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: user class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/user.lua b/misc/freeswitch/scripts/dialplan/user.lua
index 0a2e0dd..b536600 100644
--- a/misc/freeswitch/scripts/dialplan/user.lua
+++ b/misc/freeswitch/scripts/dialplan/user.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: user class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan/voicemail.lua b/misc/freeswitch/scripts/dialplan/voicemail.lua
index fe20128..5d79ba3 100644
--- a/misc/freeswitch/scripts/dialplan/voicemail.lua
+++ b/misc/freeswitch/scripts/dialplan/voicemail.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: voicemail class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/dialplan_default.lua b/misc/freeswitch/scripts/dialplan_default.lua
index eb80ae4..7caff57 100644
--- a/misc/freeswitch/scripts/dialplan_default.lua
+++ b/misc/freeswitch/scripts/dialplan_default.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 default dialplan
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
diff --git a/misc/freeswitch/scripts/event/call_history_save.lua b/misc/freeswitch/scripts/event/call_history_save.lua
index 057ca16..ba7a8f6 100644
--- a/misc/freeswitch/scripts/event/call_history_save.lua
+++ b/misc/freeswitch/scripts/event/call_history_save.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: call_history event handler class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/event/cdr_save.lua b/misc/freeswitch/scripts/event/cdr_save.lua
index ed53aa3..e7ac64a 100644
--- a/misc/freeswitch/scripts/event/cdr_save.lua
+++ b/misc/freeswitch/scripts/event/cdr_save.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: cdr event handler class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/event/event.lua b/misc/freeswitch/scripts/event/event.lua
index c57b32a..08d8bfe 100644
--- a/misc/freeswitch/scripts/event/event.lua
+++ b/misc/freeswitch/scripts/event/event.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: event manager class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/event/perimeter.lua b/misc/freeswitch/scripts/event/perimeter.lua
index 86c50d4..5bbb032 100644
--- a/misc/freeswitch/scripts/event/perimeter.lua
+++ b/misc/freeswitch/scripts/event/perimeter.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: cdr event handler class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/event_manager.lua b/misc/freeswitch/scripts/event_manager.lua
index 0e3c0e0..4e78ccf 100644
--- a/misc/freeswitch/scripts/event_manager.lua
+++ b/misc/freeswitch/scripts/event_manager.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5.0 event handler
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
-- Set logger
@@ -17,10 +17,9 @@ if not database:connected() then
end
require "configuration.sip"
-local sip = configuration.sip.Sip:new{ log = log, database = database }
+local domains = configuration.sip.Sip:new{ log = log, database = database }:domains();
local domain = '127.0.0.1';
-local domains = sip:domains();
if domains[1] then
domain = domains[1]['host'];
else
diff --git a/misc/freeswitch/scripts/fax_daemon.lua b/misc/freeswitch/scripts/fax_daemon.lua
index cfe7c4e..6609fe6 100644
--- a/misc/freeswitch/scripts/fax_daemon.lua
+++ b/misc/freeswitch/scripts/fax_daemon.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5.0 fax daemon
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
local MAIN_LOOP_SLEEP_TIME = 30;
diff --git a/misc/freeswitch/scripts/ini/gateways.ini.example b/misc/freeswitch/scripts/ini/gateways.ini.example
deleted file mode 100644
index b6ae018..0000000
--- a/misc/freeswitch/scripts/ini/gateways.ini.example
+++ /dev/null
@@ -1,23 +0,0 @@
-; Gemeinschaft 5 gateways configuration file
-; (c) AMOOMA GmbH 2012
-;
-
-[gateway1]
-profile = gemeinschaft
-name = gateway1
-username = gateway1
-realm = gemeinschaft
-password = freeswitch
-extension = default
-proxy = 192.168.0.1
-expire-seconds = 600
-register = true
-
-[gateway2]
-profile = gemeinschaft
-name = sipgate
-username = 1234567e0
-password = ABCdeF
-proxy = sipgate.com
-register = true
-extension = {sip_to_user}
diff --git a/misc/freeswitch/scripts/ini/routes.ini b/misc/freeswitch/scripts/ini/routes.ini
deleted file mode 100644
index 33d2f38..0000000
--- a/misc/freeswitch/scripts/ini/routes.ini
+++ /dev/null
@@ -1,80 +0,0 @@
-; Gemeinschaft 5 routing configuration file
-; (c) AMOOMA GmbH 2012
-;
-
-[general]
-
-
-[prerouting]
-^%*0%*$ , f-li
-^%*0%*(%d+)#*$ , f-li-%1
-^%*0%*(%d+)%*(%d+)#*$ , f-li-%1-%2
-^#0#$ , f-lo
-^%*5%*(%d+)#$ , f-acdmtg-0-%1
-^%*30#$ , f-clipon
-^#30#$ , f-clipoff
-^%*31#$ , f-cliroff
-^#31#$ , f-cliron
-^%*31#(%d+)$ , f-dcliroff-%1
-^#31#(%d+)$ , f-dcliron-%1
-^%*43#$ , f-cwaon
-^#43#$ , f-cwaoff
-^#002#$ , f-cfoff
-^##002#$ , f-cfdel
-^%*21#$ , f-cfu
-^%*21%*(%d+)#$ , f-cfu-%1
-^%*%*21%*(%d+)#$ , f-cfu-%1
-^#21#$ , f-cfuoff
-^##21#$ , f-cfudel
-^%*61#$ , f-cfn
-^%*61%*(%d+)#$ , f-cfn-%1
-^%*%*61%*(%d+)#$ , f-cfn-%1
-^%*61%*(%d+)%*(%d+)#$ , f-cfn-%1-%2
-^%*%*61%*(%d+)%*(%d+)#$ , f-cfn-%1-%2
-^#61#$ , f-cfnoff
-^##61#$ , f-cfndel
-^%*62#$ , f-cfo
-^%*62%*(%d+)#$ , f-cfo-%1
-^%*%*62%*(%d+)#$ , f-cfo-%1
-^#62#$ , f-cfooff
-^##62#$ , f-cfodel
-^%*67#$ , f-cfb
-^%*67%*(%d+)#$ , f-cfb-%1
-^%*%*67%*(%d+)#$ , f-cfb-%1
-^#67#$ , f-cfboff
-^##67#$ , f-cfbdel
-^%*66#$ , f-redial
-^%*98$ , f-vmcheck
-^%*98#$ , f-vmcheck
-^%*98%*(%d+)#$ , f-vmcheck-%1
-^%*1337%*1%*1#$ , f-loaon
-^%*1337%*1%*0#$ , f-loaoff
-
-^00(%d+)$ , +%1
-^0(%d+)$ , +49%1
-
-
-[outbound]
-^%+(%d+)$ , class=gateway, endpoint=gateway1, group=users, %1
-
-
-[failover]
-UNALLOCATED_NUMBER = true
-NORMAL_TEMPORARY_FAILURE = true
-
-
-[outbound_cid_number]
-
-
-[outbound_cid_name]
-
-
-[inbound]
-^00(%d+)$ , +%1
-^0(%d+)$ , +49%1
-
-[inbound_cid_number]
-^00(%d+)$ , +%1
-^0(%d+)$ , +49%1
-
-[inbound_cid_name]
diff --git a/misc/freeswitch/scripts/phones/phone.lua b/misc/freeswitch/scripts/phones/phone.lua
index bc2aa3d..856398b 100644
--- a/misc/freeswitch/scripts/phones/phone.lua
+++ b/misc/freeswitch/scripts/phones/phone.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: phone class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/phones/siemens.lua b/misc/freeswitch/scripts/phones/siemens.lua
index 71bb40a..ad2447a 100644
--- a/misc/freeswitch/scripts/phones/siemens.lua
+++ b/misc/freeswitch/scripts/phones/siemens.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: general siemens model class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/phones/snom.lua b/misc/freeswitch/scripts/phones/snom.lua
index 80d1fce..096ccb7 100644
--- a/misc/freeswitch/scripts/phones/snom.lua
+++ b/misc/freeswitch/scripts/phones/snom.lua
@@ -1,5 +1,5 @@
-- Gemeinschaft 5 module: general snom model class
--- (c) AMOOMA GmbH 2012
+-- (c) AMOOMA GmbH 2012-2013
--
module(...,package.seeall)
diff --git a/misc/freeswitch/scripts/send_fax.lua b/misc/freeswitch/scripts/send_fax.lua
index 321a5b1..35460a3 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/";
@@ -80,36 +80,34 @@ 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);
- end
+ 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,
+ }
- 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);
+ 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
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