summaryrefslogtreecommitdiff
path: root/misc/freeswitch
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-12 12:33:14 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-12 12:33:14 +0100
commitc30a25672edcab483f52b16523122d9d609b4913 (patch)
tree588b554bc6bf0a1cecbd3fbe807654d794fd1d6c /misc/freeswitch
parentd11a8692e742720435c4286e3752c8c136cc88cf (diff)
parent3a3f725111d1740b974596ba52ec02c87424fefc (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'misc/freeswitch')
-rw-r--r--misc/freeswitch/scripts/common/conference.lua2
-rw-r--r--misc/freeswitch/scripts/dialplan/dialplan.lua24
-rw-r--r--misc/freeswitch/scripts/dialplan/session.lua7
3 files changed, 22 insertions, 11 deletions
diff --git a/misc/freeswitch/scripts/common/conference.lua b/misc/freeswitch/scripts/common/conference.lua
index b50c134..9339bdc 100644
--- a/misc/freeswitch/scripts/common/conference.lua
+++ b/misc/freeswitch/scripts/common/conference.lua
@@ -188,7 +188,7 @@ function Conference.enter(self, caller, domain)
elseif self:check_ownership() then
self.settings.flags.moderator = true;
self.pin = nil;
- self.log:info('CONFERENCE ', self.id, ' - owner: ', self.caller.auth_account.owner.class,'=', self.caller.auth_account.owner.id, '/', self.caller.auth_account.owner.uuid, ', speaker: ', not self.settings.flags.mute, ', moderator: ', self.settings.flags.moderator);
+ self.log:info('CONFERENCE ', self.id, ' - owner authenticated: ', self.caller.auth_account.owner.class,'=', self.caller.auth_account.owner.id, '/', self.caller.auth_account.owner.uuid, ', speaker: ', not self.settings.flags.mute, ', moderator: ', self.settings.flags.moderator);
elseif not self.open_for_public then
self.log:notice('CONFERENCE ', self.id, ' - not open for public');
return { continue = false, code = 493, phrase = 'Conference closed' };
diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua
index bbf1242..e887610 100644
--- a/misc/freeswitch/scripts/dialplan/dialplan.lua
+++ b/misc/freeswitch/scripts/dialplan/dialplan.lua
@@ -165,17 +165,13 @@ end
function Dialplan.retrieve_caller_data(self)
self.caller.caller_phone_numbers_hash = {};
- -- TODO: Set auth_account on transfer initiated by calling party
- if not common.str.blank(self.caller.dialed_sip_user) then
- self.caller.auth_account = self:object_find{class = 'sipaccount', domain = self.caller.dialed_domain, auth_account = self.caller.dialed_sip_user};
- if self.caller.set_auth_account then
- self.caller:set_auth_account(self.caller.auth_account);
- end
+ if not common.str.blank(self.caller.previous_destination_type) and not common.str.blank(self.caller.previous_destination_uuid) then
+ self.log:debug('CALLER_DATA - authenticate by previous destination: ', self.caller.previous_destination_type, '=', self.caller.previous_destination_id, '/', self.caller.previous_destination_uuid);
+ self.caller.auth_account = self:object_find{class = self.caller.previous_destination_type, uuid = self.caller.previous_destination_uuid};
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{class = self.caller.auth_account_type, uuid = self.caller.auth_account_uuid};
- if self.caller.set_auth_account then
- self.caller:set_auth_account(self.caller.auth_account);
- end
+ elseif not common.str.blank(self.caller.dialed_sip_user) then
+ self.caller.auth_account = self:object_find{class = 'sipaccount', domain = self.caller.dialed_domain, auth_account = self.caller.dialed_sip_user};
end
if self.caller.auth_account then
@@ -185,6 +181,9 @@ function Dialplan.retrieve_caller_data(self)
else
self.log:error('CALLER_DATA - auth owner not found');
end
+ if self.caller.set_auth_account then
+ self.caller:set_auth_account(self.caller.auth_account);
+ end
else
self.log:info('CALLER_DATA - no data - unauthenticated call: ', self.caller.auth_account_type, '/', self.caller.auth_account_uuid);
end
@@ -304,6 +303,7 @@ function Dialplan.dial(self, destination)
destination.account = self:object_find{class = destination.type, id = destination.id};
if destination.account then
+ destination.uuid = destination.account.uuid;
if destination.account.class == 'sipaccount' then
destination.callee_id_name = destination.account.record.caller_name;
self.caller:set_callee_id(destination.number, destination.account.record.caller_name);
@@ -314,7 +314,7 @@ function Dialplan.dial(self, destination)
self.log:debug('DESTINATION_GROUPS - pickup_groups: ', table.concat(group_names, ','));
for index=1, #group_ids do
table.insert(destination.pickup_groups, 'g' .. group_ids[index]);
- end
+ end
end
if destination.account and destination.account.owner then
@@ -325,6 +325,9 @@ function Dialplan.dial(self, destination)
elseif destination.account.owner.class == 'tenant' then
tenant_id = destination.account.owner.id;
end
+ self.caller:set_variable('gs_destination_owner_type', destination.account.owner.class);
+ self.caller:set_variable('gs_destination_owner_id', destination.account.owner.id);
+ self.caller:set_variable('gs_destination_owner_uuid', destination.account.owner.uuid);
end
end
@@ -904,6 +907,7 @@ function Dialplan.run(self, destination)
self.caller:set_variable('gs_destination_uuid', destination.uuid);
self.caller:set_variable('gs_destination_number', destination.number);
self.caller:set_variable('gs_destination_node_local', destination.node_local);
+ self.caller:set_variable('gs_destination_node_id, ', destination.node_id);
result = self:switch(destination);
result = result or { continue = false, code = 502, cause = 'DESTINATION_OUT_OF_ORDER', phrase = 'Destination out of order' }
diff --git a/misc/freeswitch/scripts/dialplan/session.lua b/misc/freeswitch/scripts/dialplan/session.lua
index 04d7675..78be98e 100644
--- a/misc/freeswitch/scripts/dialplan/session.lua
+++ b/misc/freeswitch/scripts/dialplan/session.lua
@@ -58,6 +58,13 @@ function Session.init_channel_variables(self)
self.node_id = self:to_i('sip_h_X-GS_node_id');
self.loop_count = self:to_i('sip_h_X-GS_loop_count');
+ self.previous_destination_type = self:to_s('gs_destination_type');
+ self.previous_destination_id = self:to_i('gs_destination_id');
+ self.previous_destination_uuid = self:to_s('gs_destination_uuid');
+ self.previous_destination_owner_type = self:to_s('gs_destination_owner_type');
+ self.previous_destination_owner_id = self:to_i('gs_destination_owner_id');
+ self.previous_destination_owner_uuid = self:to_s('gs_destination_owner_uuid');
+
if self.node_id > 0 and self.node_id ~= self.local_node_id then
self.from_node = true;
else