summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-07-09 12:11:16 +0200
committerPeter Kozak <spag@golwen.net>2013-07-09 12:11:16 +0200
commite1b8a3961833f66f03659d16b2737ab62efd999c (patch)
treeffa3a2e0ea10752e1be5da571650e4df3b6ad1dd /misc/freeswitch/scripts/dialplan
parente59fda6f6dd64dfe0bd2cdea66b19e3ba1fa4f90 (diff)
parent3def6156141c1235d1ab0782900d43c097676243 (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'misc/freeswitch/scripts/dialplan')
-rw-r--r--misc/freeswitch/scripts/dialplan/dialplan.lua3
-rw-r--r--misc/freeswitch/scripts/dialplan/session.lua10
2 files changed, 6 insertions, 7 deletions
diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua
index 370aa0b..ac8a07d 100644
--- a/misc/freeswitch/scripts/dialplan/dialplan.lua
+++ b/misc/freeswitch/scripts/dialplan/dialplan.lua
@@ -896,9 +896,10 @@ function Dialplan.run(self, destination)
self.caller:set_variable('sound_prefix', common.array.try(self.config, 'sounds.' .. tostring(self.caller.language)));
self.log:info('DIALPLAN start - caller_id: ',self.caller.caller_id_number, ' "', self.caller.caller_id_name, '" , number: ', destination.number, ', language: ', self.caller.language);
-
self.caller.static_caller_id_number = self.caller.caller_id_number;
self.caller.static_caller_id_name = self.caller.caller_id_name;
+ self.caller:set_variable('gs_caller_id_number', self.caller.caller_id_number);
+ self.caller:set_variable('gs_caller_id_name', self.caller.caller_id_name);
local result = { continue = false };
local loop = self.caller.loop_count;
diff --git a/misc/freeswitch/scripts/dialplan/session.lua b/misc/freeswitch/scripts/dialplan/session.lua
index 1d907c5..7023c5e 100644
--- a/misc/freeswitch/scripts/dialplan/session.lua
+++ b/misc/freeswitch/scripts/dialplan/session.lua
@@ -8,6 +8,8 @@ Session = {}
-- create session object
function Session.new(self, arg)
+ require 'common.str';
+
arg = arg or {}
object = arg.object or {}
setmetatable(object, self);
@@ -29,8 +31,8 @@ function Session.init_channel_variables(self)
self.destination_number = self:expand_variables(self:to_s('destination_number'));
self.called_number = self.destination_number;
- self.caller_id_number = self:to_s('caller_id_number');
- self.caller_id_name = self:to_s('caller_id_name');
+ self.caller_id_number = self.session:getVariable('gs_caller_id_number') or self:to_s('caller_id_number');
+ self.caller_id_name = self.session:getVariable('gs_caller_id_name') or self:to_s('caller_id_name');
self.caller_phone_number = self.caller_id_number;
self.caller_phone_numbers = {self.caller_id_number};
@@ -93,25 +95,21 @@ end
-- Cast channel variable to string
function Session.to_s(self, variable_name)
- require 'common.str'
return common.str.to_s(self.session:getVariable(variable_name));
end
-- Cast channel variable to integer
function Session.to_i(self, variable_name)
- require 'common.str'
return common.str.to_i(self.session:getVariable(variable_name));
end
-- Cast channel variable to boolean
function Session.to_b(self, variable_name)
- require 'common.str'
return common.str.to_b(self.session:getVariable(variable_name));
end
-- Split channel variable to table
function Session.to_a(self, variable_name)
- require 'common.str'
return common.str.to_a(self.session:getVariable(variable_name));
end