From efb96cfaa79b98fa5eb3c2ca704e83af31e77730 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 7 Mar 2013 15:58:22 -0500 Subject: voicemail honors destination number --- misc/freeswitch/scripts/dialplan/dialplan.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index ffad4da..4cc2245 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -579,13 +579,17 @@ end function Dialplan.voicemail(self, destination) - if not self.caller.auth_account or self.caller.auth_account.class ~= 'sipaccount' then - self.log:error('VOICEMAIL - incompatible destination'); - return { continue = false, code = 404, phrase = 'Mailbox not found' } - end - + require 'common.str'; require 'dialplan.voicemail' - local voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database }:find_by_sip_account_id(self.caller.auth_account.id); + + local voicemail_account = nil; + + local sip_account_id + if not common.str.blank(destination.number) and false then + voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database }:find_by_number(destination.number); + elseif self.caller.auth_account and self.caller.auth_account.class == 'sipaccount' then + voicemail_account = dialplan.voicemail.Voicemail:new{ log = self.log, database = self.database }:find_by_sip_account_id(self.caller.auth_account.id); + end if not voicemail_account then self.log:error('VOICEMAIL - no mailbox'); -- cgit v1.2.3 From dd5afe31149f7100c4a7fbce100b292b33e2c348 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 11 Mar 2013 02:34:11 -0400 Subject: gateway authentication by username/password --- misc/freeswitch/scripts/dialplan/dialplan.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 4cc2245..6d75d8d 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -135,10 +135,22 @@ end function Dialplan.auth_gateway(self) require 'common.gateway' local gateway_class = common.gateway.Gateway:new{ log = self.log, database = self.database}; - local gateway = gateway_class:authenticate(self.caller); + + local gateway = false; + + if self.caller:to_b('gs_from_gateway') then + gateway = { + 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); + 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, ', name: ', 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 -- cgit v1.2.3 From 8bfb2cfdb320b6fce5c0223f186d769b7bf1658c Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 11 Mar 2013 07:29:11 -0400 Subject: use array module --- misc/freeswitch/scripts/dialplan/dialplan.lua | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 6d75d8d..fabc5af 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -22,6 +22,9 @@ local CALL_FORWARDING_SERVICES = { -- create dialplan object function Dialplan.new(self, arg) + require 'common.str'; + require 'common.array'; + arg = arg or {} object = arg.object or {} setmetatable(object, self); @@ -35,7 +38,6 @@ end function Dialplan.domain_get(self, domain) - require 'common.str' local global_domain = freeswitch.API():execute('global_getvar', 'domain'); if common.str.blank(global_domain) then @@ -74,7 +76,6 @@ end function Dialplan.configuration_read(self) - require 'common.str' require 'common.configuration_table' -- dialplan configuration @@ -124,7 +125,6 @@ end function Dialplan.auth_sip_account(self) - require 'common.str' 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); return true; @@ -163,7 +163,6 @@ end function Dialplan.retrieve_caller_data(self) - require 'common.str' self.caller.caller_phone_numbers_hash = {}; -- TODO: Set auth_account on transfer initiated by calling party @@ -219,8 +218,6 @@ end function Dialplan.destination_new(self, arg) - require 'common.str' - local destination = { number = arg.number or '', type = arg.type or 'unknown', @@ -300,7 +297,6 @@ function Dialplan.dial(self, destination) local user_id = nil; local tenant_id = nil; - require 'common.str' destination.caller_id_number = destination.caller_id_number or self.caller.caller_phone_numbers[1]; if destination.node_local and destination.type == 'sipaccount' then @@ -334,7 +330,6 @@ function Dialplan.dial(self, destination) if not self.caller.clir then if user_id or tenant_id then - require 'common.str' if self.phonebook_number_lookup then require 'dialplan.phone_book' @@ -591,7 +586,6 @@ end function Dialplan.voicemail(self, destination) - require 'common.str'; require 'dialplan.voicemail' local voicemail_account = nil; @@ -625,7 +619,6 @@ end function Dialplan.switch(self, destination) - require 'common.str' local result = nil; self.dial_timeout_active = self.dial_timeout; @@ -719,7 +712,7 @@ function Dialplan.switch(self, destination) elseif not common.str.blank(destination.number) then local result = { continue = false, code = 404, phrase = 'No route' } - local clip_no_screening = common.str.try(self.caller, 'account.record.clip_no_screening'); + local clip_no_screening = common.array.try(self.caller, 'account.record.clip_no_screening'); self.caller.caller_id_numbers = {} if not common.str.blank(clip_no_screening) then for index, number in ipairs(common.str.strip_to_a(clip_no_screening, ',')) do @@ -743,9 +736,8 @@ function Dialplan.switch(self, destination) end if self.phonebook_number_lookup then - require 'common.str' - local user_id = common.str.try(self.caller, 'account.owner.id'); - local tenant_id = common.str.try(self.caller, 'account.owner.record.current_tenant_id'); + local user_id = common.array.try(self.caller, 'account.owner.id'); + local tenant_id = common.array.try(self.caller, 'account.owner.record.current_tenant_id'); if user_id or tenant_id then require 'dialplan.phone_book' @@ -761,7 +753,6 @@ function Dialplan.switch(self, destination) require 'dialplan.geo_number' local geo_number = dialplan.geo_number.GeoNumber:new{ log = self.log, database = self.database }:find(destination.number); if geo_number then - require 'common.str' self.log:info('GEO_NUMBER - found: ', geo_number.name, ', ', geo_number.country); if geo_number.name then destination.callee_id_name = common.str.to_ascii(geo_number.name) .. ', ' .. common.str.to_ascii(geo_number.country); @@ -812,7 +803,6 @@ end function Dialplan.run(self, destination) - require 'common.str'; require 'dialplan.router'; self.caller:set_variable('hangup_after_bridge', false); @@ -897,7 +887,7 @@ function Dialplan.run(self, destination) end self.caller:set_variable('default_language', self.caller.language); - self.caller:set_variable('sound_prefix', common.str.try(self.config, 'sounds.' .. tostring(self.caller.language))); + 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); local result = { continue = false }; -- cgit v1.2.3 From 2eacac2c8db953054278fdc0ddc0f0de46435861 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 12 Mar 2013 04:21:06 -0400 Subject: return status record --- misc/freeswitch/scripts/dialplan/dialplan.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index fabc5af..bbf1242 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -76,7 +76,7 @@ end function Dialplan.configuration_read(self) - require 'common.configuration_table' + require 'common.configuration_table'; -- dialplan configuration self.config = common.configuration_table.get(self.database, 'dialplan'); @@ -462,16 +462,14 @@ end function Dialplan.conference(self, destination) - -- call local conference - require 'common.conference' - conference = common.conference.Conference:new{ log = self.log, database = self.database }:find_by_id(destination.id); + require 'common.conference'; + local conference = common.conference.Conference:new{ log = self.log, database = self.database }:find_by_id(destination.id); if not conference then return { continue = false, code = 404, phrase = 'Conference not found' } end - local cause = conference:enter(self.caller, self.domain); - return { continue = false, cause = cause } + return conference:enter(self.caller, self.domain); end -- cgit v1.2.3 From 27a3c9b2917061c8cca08ab334624cdba727745d Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 12 Mar 2013 06:55:26 -0400 Subject: save last destination --- misc/freeswitch/scripts/dialplan/dialplan.lua | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index bbf1242..8d69a3d 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -166,16 +166,13 @@ 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 - elseif not common.str.blank(self.caller.auth_account_type) and not common.str.blank(self.caller.auth_account_uuid) then + if 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.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.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 +182,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 @@ -315,6 +315,9 @@ function Dialplan.dial(self, destination) for index=1, #group_ids do table.insert(destination.pickup_groups, 'g' .. group_ids[index]); end + self.caller:set_variable('gs_destination_type', destination.account.class); + self.caller:set_variable('gs_destination_id', destination.account.id); + self.caller:set_variable('gs_destination_uuid', destination.account.uuid); end if destination.account and destination.account.owner then @@ -325,6 +328,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 -- cgit v1.2.3 From e8e513c9e980a6444fb3ba468a763926100b16ca Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 12 Mar 2013 07:00:18 -0400 Subject: order matters --- misc/freeswitch/scripts/dialplan/dialplan.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 8d69a3d..59c75aa 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -165,12 +165,11 @@ 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.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}; - elseif not common.str.blank(self.caller.previous_destination_type) and not common.str.blank(self.caller.previous_destination_uuid) then + 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}; 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 -- cgit v1.2.3 From 3a3f725111d1740b974596ba52ec02c87424fefc Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 12 Mar 2013 07:31:26 -0400 Subject: save uuid to destination record --- misc/freeswitch/scripts/dialplan/dialplan.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 59c75aa..e887610 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -303,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); @@ -313,10 +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 - self.caller:set_variable('gs_destination_type', destination.account.class); - self.caller:set_variable('gs_destination_id', destination.account.id); - self.caller:set_variable('gs_destination_uuid', destination.account.uuid); + end end if destination.account and destination.account.owner then @@ -909,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' } -- cgit v1.2.3 From 8b4c7759dc4b589dd68ea96bfebdd51051526c9d Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 08:41:58 -0400 Subject: display auth_account_id --- misc/freeswitch/scripts/dialplan/dialplan.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index e887610..ac564d9 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -185,7 +185,7 @@ function Dialplan.retrieve_caller_data(self) 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); + self.log:info('CALLER_DATA - no data - unauthenticated call: ', self.caller.auth_account_type, '=', self.caller.auth_account_id, '/', self.caller.auth_account_uuid); end if not common.str.blank(self.caller.account_type) and not common.str.blank(self.caller.account_uuid) then -- cgit v1.2.3 From 1702b51b05ca73751bd52c715dd453f98d9b578f Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 17 Mar 2013 02:06:28 -0400 Subject: clip/clir flags fixed --- misc/freeswitch/scripts/dialplan/dialplan.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index ac564d9..b3d6c47 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -191,6 +191,9 @@ function Dialplan.retrieve_caller_data(self) if not common.str.blank(self.caller.account_type) and not common.str.blank(self.caller.account_uuid) then self.caller.account = self:object_find{class = self.caller.account_type, uuid = self.caller.account_uuid}; if self.caller.account then + self.caller.clir = common.str.to_b(common.array.try(self.caller, 'account.record.clir')); + self.caller.clip = common.str.to_b(common.array.try(self.caller, 'account.record.clip')); + require 'common.phone_number' self.caller.caller_phone_numbers = common.phone_number.PhoneNumber:new{ log = self.log, database = self.database }:list_by_owner(self.caller.account.id, self.caller.account.class); for index, caller_number in ipairs(self.caller.caller_phone_numbers) do -- cgit v1.2.3 From df9869a82253d0482eaf2166865a75876aef77b3 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 17 Mar 2013 03:11:45 -0400 Subject: logging --- misc/freeswitch/scripts/dialplan/dialplan.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index b3d6c47..9abd3d2 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -626,6 +626,8 @@ function Dialplan.switch(self, destination) local result = nil; self.dial_timeout_active = self.dial_timeout; + self.log:debug('SWITCH - auth: ', self.caller.auth_account.class, '=', self.caller.auth_account.id, '/', self.caller.auth_account.uuid, ', caller: ', self.caller.account.class, '=', self.caller.account.id, '/', self.caller.account.uuid); + if not destination.node_local then return self:dial(destination); end @@ -726,8 +728,8 @@ function Dialplan.switch(self, destination) for index, number in ipairs(self.caller.caller_phone_numbers) do table.insert(self.caller.caller_id_numbers, number); end - self.log:info('CALLER_ID_NUMBERS - clir: ', self.caller.clir, ', numbers: ', table.concat(self.caller.caller_id_numbers, ',')); + self.log:info('SWITCH - clir: ', self.caller.clir, ', caller_id_numbers: ', table.concat(self.caller.caller_id_numbers, ',')); destination.callee_id_number = destination.number; destination.callee_id_name = nil; -- cgit v1.2.3 From 208c0bbb9b7b744febbf288f56a3926561cd001b Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 18 Mar 2013 01:54:40 -0400 Subject: log line removed --- misc/freeswitch/scripts/dialplan/dialplan.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 9abd3d2..63158d9 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -626,8 +626,6 @@ function Dialplan.switch(self, destination) local result = nil; self.dial_timeout_active = self.dial_timeout; - self.log:debug('SWITCH - auth: ', self.caller.auth_account.class, '=', self.caller.auth_account.id, '/', self.caller.auth_account.uuid, ', caller: ', self.caller.account.class, '=', self.caller.account.id, '/', self.caller.account.uuid); - if not destination.node_local then return self:dial(destination); end -- cgit v1.2.3 From c60844ed7d0cbc2c1fa417e41d0c7be90adf68cd Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Thu, 21 Mar 2013 15:25:03 +0100 Subject: preserve caller_id --- misc/freeswitch/scripts/dialplan/dialplan.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'misc/freeswitch/scripts/dialplan/dialplan.lua') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 63158d9..5335328 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -894,11 +894,18 @@ 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; + local result = { continue = false }; local loop = self.caller.loop_count; while self.caller:ready() and loop < self.max_loops do loop = loop + 1; self.caller.loop_count = loop; + + self.caller.caller_id_number = self.caller.static_caller_id_number; + self.caller.caller_id_name = self.caller.static_caller_id_name; self.log:info('LOOP ', loop, ' - destination: ', destination.type, '=', destination.id, '/', destination.uuid,'@', destination.node_id, -- cgit v1.2.3