From bc530494cca59845b5896ae4b0900ca1b9691827 Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 17 Jan 2013 10:05:49 +0100 Subject: set caller id numbers array --- misc/freeswitch/scripts/dialplan/dialplan.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'misc') diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 32f59c2..704728a 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -757,6 +757,21 @@ 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(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 + table.insert(self.caller.caller_id_numbers, number); + end + end + 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, ',')); + + destination.callee_id_number = destination.number; + destination.callee_id_name = nil; + require 'dialplan.router' local routes = dialplan.router.Router:new{ log = self.log, database = self.database, caller = self.caller }:route_run('outbound', destination.number); @@ -765,9 +780,6 @@ function Dialplan.switch(self, destination) return { continue = false, code = 404, phrase = 'No route' } end - destination.callee_id_number = destination.number; - destination.callee_id_name = nil; - if self.phonebook_number_lookup then require 'common.str' local user_id = common.str.try(self.caller, 'account.owner.id'); -- cgit v1.2.3