diff options
author | Peter Kozak <spag@golwen.net> | 2013-04-18 08:30:06 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-04-18 08:30:06 +0200 |
commit | 75047661f380c62dae7bab4942c9e8a8cf39501a (patch) | |
tree | b919a17aa0f75e398e2208d5b2b7bf0245a7357e /misc/freeswitch/scripts/dialplan/router.lua | |
parent | ccb2ccc255218ec44a1694431cfbccd6308be6d5 (diff) |
logging
Diffstat (limited to 'misc/freeswitch/scripts/dialplan/router.lua')
-rw-r--r-- | misc/freeswitch/scripts/dialplan/router.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua index d6d00de..dde527c 100644 --- a/misc/freeswitch/scripts/dialplan/router.lua +++ b/misc/freeswitch/scripts/dialplan/router.lua @@ -156,6 +156,13 @@ function Router.route_match(self, route) table.insert(arguments, common.array.expand_variables(argument, destination, self.variables)); end result, replacement = self['fun_' .. variable_name](self, unpack(arguments)) + if self.log_details or true then + if result then + self.log:debug('ELEMENT_MATCH - function: ', variable_name, '(', table.concat(arguments, ', '), ') => ', replacement); + else + self.log:debug('ELEMENT_NO_MATCH - function: ', variable_name, '(', table.concat(arguments, ', '), ') => ', tostring(replacement)); + end + end end end end @@ -233,7 +240,7 @@ function Router.fun_speeddial(self, number, name) if tostring(owner_class) == 'user' then user_id = owner_id; - tenant_id = common.array.try(self, 'caller.auth_account.owner.record.current_nenant_id'); + tenant_id = common.array.try(self, 'caller.auth_account.owner.record.current_tenant_id'); elseif tostring(owner_class) == 'tenant' then tenant_id = owner_id; @@ -243,10 +250,12 @@ function Router.fun_speeddial(self, number, name) local phone_book_class = dialplan.phone_book.PhoneBook:new{ log = self.log, database = self.database } local phone_book_entry = phone_book_class:find_entry_by_number_user_tenant({number}, user_id, tenant_id, 'speeddial'); + self.log:debug('SPEEDDIAL - user=', user_id, ', tenant=', tenant_id, ', entry: "', common.array.try(phone_book_entry, 'phone_book_name'), '" => "', common.array.try(phone_book_entry, 'caller_id_name'), '"'); + if phone_book_entry then local phone_numbers = phone_book_class:numbers(phone_book_entry.id, name, 'speeddial'); for index, phone_number in ipairs(phone_numbers) do - self.log:info('SPEEDDIAL: ', number, ' => ', phone_number.number) + self.log:info('SPEEDDIAL - ', number, ' => ', phone_number.number) return true, phone_number.number; end end |