From 3e7b87d2839213cf5d29e2750b08a7b6cfd7d1c4 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 11 Mar 2013 07:29:24 -0400 Subject: use array module --- misc/freeswitch/scripts/dialplan/hunt_group.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/dialplan/hunt_group.lua') diff --git a/misc/freeswitch/scripts/dialplan/hunt_group.lua b/misc/freeswitch/scripts/dialplan/hunt_group.lua index fa3c05b..bff0a8e 100644 --- a/misc/freeswitch/scripts/dialplan/hunt_group.lua +++ b/misc/freeswitch/scripts/dialplan/hunt_group.lua @@ -98,7 +98,7 @@ function HuntGroup.run(self, dialplan_object, caller, destination) self.log:info('HUNTGROUP ', self.record.id, ' - name: ', self.record.name, ', strategy: ', self.record.strategy,', members: ', #hunt_group_members); - local clip_no_screening = common.str.try(caller, 'account.record.clip_no_screening'); + local clip_no_screening = common.array.try(caller, 'account.record.clip_no_screening'); 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 -- cgit v1.2.3 From 5aa4b1351d34f138365f07995d704ae4a7e46e4a Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 08:41:13 -0400 Subject: find_by_uuid method fixed --- misc/freeswitch/scripts/dialplan/hunt_group.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/freeswitch/scripts/dialplan/hunt_group.lua') diff --git a/misc/freeswitch/scripts/dialplan/hunt_group.lua b/misc/freeswitch/scripts/dialplan/hunt_group.lua index bff0a8e..8411fd5 100644 --- a/misc/freeswitch/scripts/dialplan/hunt_group.lua +++ b/misc/freeswitch/scripts/dialplan/hunt_group.lua @@ -38,7 +38,7 @@ end function HuntGroup.find_by_uuid(self, uuid) - local sql_query = 'SELECT * FROM `hunt_groups` WHERE `id`= "'.. uuid .. '" LIMIT 1'; + local sql_query = 'SELECT * FROM `hunt_groups` WHERE `uuid`= "'.. uuid .. '" LIMIT 1'; local hunt_group = nil; self.database:query(sql_query, function(entry) -- cgit v1.2.3 From 35c4fcfb947afb4d5df26fdae4a6452a0c2097ff Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 17 Mar 2013 03:13:49 -0400 Subject: destination record fixed --- misc/freeswitch/scripts/dialplan/hunt_group.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/hunt_group.lua') diff --git a/misc/freeswitch/scripts/dialplan/hunt_group.lua b/misc/freeswitch/scripts/dialplan/hunt_group.lua index 8411fd5..e66bf56 100644 --- a/misc/freeswitch/scripts/dialplan/hunt_group.lua +++ b/misc/freeswitch/scripts/dialplan/hunt_group.lua @@ -108,15 +108,17 @@ function HuntGroup.run(self, dialplan_object, caller, destination) for index, number in ipairs(caller.caller_phone_numbers) do table.insert(caller.caller_id_numbers, number); end - self.log:info('CALLER_ID_NUMBERS - clir: ', caller.clir, ', numbers: ', table.concat(caller.caller_id_numbers, ',')); - local save_destination = caller.destination; + self.log:debug('HUNTGROUP ', self.record.id, ' - auth: ', caller.auth_account.class, '=', caller.auth_account.id, '/', caller.auth_account.uuid, ', caller: ', caller.account.class, '=', caller.account.id, '/', caller.account.uuid); + self.log:info('HUNTGROUP ', self.record.id, ' - clir: ', caller.clir, ', caller_id_numbers: ', table.concat(caller.caller_id_numbers, ',')); + + local hunt_group_destination = caller.destination; local destinations = {} for index, hunt_group_member in ipairs(hunt_group_members) do local destination = dialplan_object:destination_new{ number = hunt_group_member.number }; if destination.type == 'unknown' then - + caller.destination = destination; caller.destination_number = destination.number; require 'dialplan.router' @@ -144,8 +146,8 @@ function HuntGroup.run(self, dialplan_object, caller, destination) end end - caller.destination = save_destination; - caller.destination_number = save_destination.number; + caller.destination = hunt_group_destination; + caller.destination_number = hunt_group_destination.number; local forwarding_destination = nil; if caller.forwarding_service == 'assistant' and caller.auth_account then @@ -165,7 +167,7 @@ function HuntGroup.run(self, dialplan_object, caller, destination) table.insert(recursive_destinations, forwarding_destination); end require 'dialplan.sip_call' - result = dialplan.sip_call.SipCall:new{ log = self.log, database = self.database, caller = caller }:fork( recursive_destinations, { callee_id_number = destination.number, timeout = member_timeout }); + result = dialplan.sip_call.SipCall:new{ log = self.log, database = self.database, caller = caller }:fork( recursive_destinations, { callee_id_number = hunt_group_destination.number, timeout = member_timeout }); if result.disposition == 'SUCCESS' then if result.fork_index then result.destination = recursive_destinations[result.fork_index]; -- cgit v1.2.3 From abc16da2c2afa636a928a031a540e677f4ac84f8 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 17 Mar 2013 06:57:26 -0400 Subject: add hunt group numbers to caller_id_numbers array --- misc/freeswitch/scripts/dialplan/hunt_group.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/hunt_group.lua') diff --git a/misc/freeswitch/scripts/dialplan/hunt_group.lua b/misc/freeswitch/scripts/dialplan/hunt_group.lua index e66bf56..b1728c3 100644 --- a/misc/freeswitch/scripts/dialplan/hunt_group.lua +++ b/misc/freeswitch/scripts/dialplan/hunt_group.lua @@ -98,17 +98,16 @@ function HuntGroup.run(self, dialplan_object, caller, destination) self.log:info('HUNTGROUP ', self.record.id, ' - name: ', self.record.name, ', strategy: ', self.record.strategy,', members: ', #hunt_group_members); - local clip_no_screening = common.array.try(caller, 'account.record.clip_no_screening'); 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(caller.caller_id_numbers, number); - end - end for index, number in ipairs(caller.caller_phone_numbers) do table.insert(caller.caller_id_numbers, number); end + local phone_numbers = common.phone_number.PhoneNumber:new{ log = self.log, database = self.database }:list_by_owner(self.id, self.class); + for index, number in ipairs(phone_numbers) do + table.insert(caller.caller_id_numbers, number); + end + self.log:debug('HUNTGROUP ', self.record.id, ' - auth: ', caller.auth_account.class, '=', caller.auth_account.id, '/', caller.auth_account.uuid, ', caller: ', caller.account.class, '=', caller.account.id, '/', caller.account.uuid); self.log:info('HUNTGROUP ', self.record.id, ' - clir: ', caller.clir, ', caller_id_numbers: ', table.concat(caller.caller_id_numbers, ',')); -- cgit v1.2.3