From aee59991ee59c6b3a49133ca1afa080d0ead6440 Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 21 Feb 2013 14:03:47 +0100 Subject: pickup groups support added --- misc/freeswitch/scripts/dialplan/functions.lua | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'misc/freeswitch/scripts/dialplan/functions.lua') diff --git a/misc/freeswitch/scripts/dialplan/functions.lua b/misc/freeswitch/scripts/dialplan/functions.lua index eddce74..b4ebf56 100644 --- a/misc/freeswitch/scripts/dialplan/functions.lua +++ b/misc/freeswitch/scripts/dialplan/functions.lua @@ -236,16 +236,12 @@ function Functions.intercept_any_number(self, caller, destination_number) return { continue = false, code = 505, phrase = 'Incompatible destination', no_cdr = true }; end - require 'common.sip_account' - local sip_account = common.sip_account.SipAccount:new{ log = self.log, database = self.database }:find_by_id(phone_number.record.phone_numberable_id) - - if not sip_account then - self.log:notice('FUNCTION_INTERCEPT_ANY_NUMBER - no sip_account found for number: ', destination_number); - return { continue = false, code = 505, phrase = 'Incompatible destination', no_cdr = true }; - end + self.log:info('FUNCTION_INTERCEPT_ANY_NUMBER intercepting call - to: ', phone_number.record.phone_numberable_type:lower(), '=', phone_number.record.phone_numberable_id, ', number: ', destination_number); - self.log:info('FUNCTION_INTERCEPT_ANY_NUMBER intercepting call - to: ', phone_number.record.phone_numberable_type:lower(), '=', phone_number.record.phone_numberable_id, ', name: ', sip_account.record.auth_name); - return self:intercept_destination(caller, sip_account.record.auth_name); + caller:set_variable('gs_pickup_group_pick', 's' .. phone_number.record.phone_numberable_id); + caller:execute('pickup', 's' .. phone_number.record.phone_numberable_id); + + return { continue = false, code = 200, phrase = 'OK', no_cdr = true } end -- cgit v1.2.3