summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan/functions.lua
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-21 14:03:47 +0100
committerspag <spag@golwen.net>2013-02-21 14:03:47 +0100
commitaee59991ee59c6b3a49133ca1afa080d0ead6440 (patch)
treee3c388e620f334851d9bd35aa5083b235f531f66 /misc/freeswitch/scripts/dialplan/functions.lua
parent4d73d669131d06e6a4827b70de037ab2c2c65b1b (diff)
pickup groups support added
Diffstat (limited to 'misc/freeswitch/scripts/dialplan/functions.lua')
-rw-r--r--misc/freeswitch/scripts/dialplan/functions.lua14
1 files changed, 5 insertions, 9 deletions
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