summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan
diff options
context:
space:
mode:
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