summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-07-04 13:33:03 +0200
committerPeter Kozak <spag@golwen.net>2013-07-04 13:33:03 +0200
commit59fddbdd5e07b7e9aa39d4504b0c1f02a3f6d031 (patch)
tree0777c5bb282967b1c27e9f76eab960f690fe8c7f /misc/freeswitch/scripts
parentfca31c4f47a04e7d21a9c6db69b2ff77d842aa23 (diff)
authenticate by previous_destination (transfer)
Diffstat (limited to 'misc/freeswitch/scripts')
-rw-r--r--misc/freeswitch/scripts/dialplan/dialplan.lua12
-rw-r--r--misc/freeswitch/scripts/dialplan_default.lua2
2 files changed, 8 insertions, 6 deletions
diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua
index 913d7a5..7473a33 100644
--- a/misc/freeswitch/scripts/dialplan/dialplan.lua
+++ b/misc/freeswitch/scripts/dialplan/dialplan.lua
@@ -124,16 +124,18 @@ function Dialplan.auth_node(self)
end
-function Dialplan.auth_sip_account(self)
+function Dialplan.auth_account(self)
if not common.str.blank(self.caller.auth_account_type) then
- self.log:info('AUTH_SIP_ACCOUNT - ', self.caller.auth_account_type, '=', self.caller.account_id, '/', self.caller.account_uuid);
+ self.log:info('AUTH auth_account - ', self.caller.auth_account_type, '=', self.caller.account_id, '/', self.caller.account_uuid);
return true;
+ elseif not common.str.blank(self.caller.previous_destination_type) and not common.str.blank(self.caller.previous_destination_uuid) then
+ self.log:info('AUTH previous_destination - ', self.caller.previous_destination_type, '=', self.caller.previous_destination_id, '/', self.caller.previous_destination_uuid);
end
end
function Dialplan.auth_gateway(self)
- require 'common.gateway'
+ require 'common.gateway';
local gateway_class = common.gateway.Gateway:new{ log = self.log, database = self.database};
local gateway = false;
@@ -143,14 +145,14 @@ function Dialplan.auth_gateway(self)
name = self.caller:to_s('gs_gateway_name'),
id = self.caller:to_i('gs_gateway_id'),
}
- log:info('AUTH_GATEWAY - authenticaded by password and username: ', self.caller:to_s('username'), ', gateway=', gateway.id, '|', gateway.name, ', ip: ', self.caller.sip_contact_host);
+ log:info('AUTH gateway - authenticaded by password and username: ', self.caller:to_s('username'), ', gateway=', gateway.id, '|', gateway.name, ', ip: ', self.caller.sip_contact_host);
return gateway_class:find_by_id(gateway.id);
else
gateway = gateway_class:authenticate(self.caller);
end
if gateway then
- log:info('AUTH_GATEWAY - ', gateway.auth_source, ' ~ ', gateway.auth_pattern, ', gateway=', gateway.id, '|', gateway.name, ', ip: ', self.caller.sip_contact_host);
+ log:info('AUTH gateway - ', gateway.auth_source, ' ~ ', gateway.auth_pattern, ', gateway=', gateway.id, '|', gateway.name, ', ip: ', self.caller.sip_contact_host);
return gateway_class:find_by_id(gateway.id);
end
end
diff --git a/misc/freeswitch/scripts/dialplan_default.lua b/misc/freeswitch/scripts/dialplan_default.lua
index 32789cb..eeeb5c2 100644
--- a/misc/freeswitch/scripts/dialplan_default.lua
+++ b/misc/freeswitch/scripts/dialplan_default.lua
@@ -74,7 +74,7 @@ if start_caller.from_node and not start_dialplan:auth_node() then
log:debug('DIALPLAN_DEFAULT - node unauthorized - node_id: ', start_caller.node_id, ', domain: ', start_dialplan.domain);
start_dialplan:hangup(401, start_dialplan.domain);
else
- if not start_dialplan:auth_sip_account() then
+ if not start_dialplan:auth_account() then
local gateway = start_dialplan:auth_gateway()
if gateway then