From 4b96a024bf77d96220ff06b3074556fbfa41bd7d Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Thu, 14 Mar 2013 22:22:06 +0100 Subject: improved voicemail greeting for recorded names --- misc/freeswitch/conf/freeswitch.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/misc/freeswitch/conf/freeswitch.xml b/misc/freeswitch/conf/freeswitch.xml index b322ff5..ac20962 100644 --- a/misc/freeswitch/conf/freeswitch.xml +++ b/misc/freeswitch/conf/freeswitch.xml @@ -272,8 +272,10 @@ + + @@ -796,8 +798,10 @@ + + -- cgit v1.2.3 From 2cdfba74605ed69d53572d50ec575e56deedd36e Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 05:05:25 -0400 Subject: set account and auth_account on b_leg --- misc/freeswitch/scripts/dialplan/sip_call.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/misc/freeswitch/scripts/dialplan/sip_call.lua b/misc/freeswitch/scripts/dialplan/sip_call.lua index 5c98792..0cde601 100644 --- a/misc/freeswitch/scripts/dialplan/sip_call.lua +++ b/misc/freeswitch/scripts/dialplan/sip_call.lua @@ -135,6 +135,17 @@ function SipCall.fork(self, destinations, arg ) if destination.alert_info then table.insert(origination_variables, "alert_info='" .. destination.alert_info .. "'"); end + if destination.account then + table.insert(origination_variables, "gs_account_type='" .. common.str.to_s(destination.account.class) .. "'"); + table.insert(origination_variables, "gs_account_id='" .. common.str.to_i(destination.account.id) .. "'"); + table.insert(origination_variables, "gs_account_uuid='" .. common.str.to_s(destination.account.uuid) .. "'"); + end + if self.caller.auth_account then + table.insert(origination_variables, "gs_auth_account_type='" .. common.str.to_s(self.caller.auth_account.class) .. "'"); + table.insert(origination_variables, "gs_auth_account_id='" .. common.str.to_i(self.caller.auth_account.id) .. "'"); + table.insert(origination_variables, "gs_auth_account_uuid='" .. common.str.to_s(self.caller.auth_account.uuid) .. "'"); + end + table.insert(dial_strings, '[' .. table.concat(origination_variables , ',') .. ']sofia/' .. sip_account.record.profile_name .. '/' .. sip_account.record.auth_name .. '%' .. sip_account.record.sip_host); if destination.pickup_groups and #destination.pickup_groups > 0 then for key=1, #destination.pickup_groups do -- cgit v1.2.3 From bac61b330fd9daa41eeba63f82790fba59c1f19d Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 05:05:49 -0400 Subject: tweaking calls_active view --- db/migrate/20130315074600_change_calls_active2.rb | 86 +++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 db/migrate/20130315074600_change_calls_active2.rb diff --git a/db/migrate/20130315074600_change_calls_active2.rb b/db/migrate/20130315074600_change_calls_active2.rb new file mode 100644 index 0000000..378ffde --- /dev/null +++ b/db/migrate/20130315074600_change_calls_active2.rb @@ -0,0 +1,86 @@ +class ChangeCallsActive2 < ActiveRecord::Migration + def self.up + execute "DROP VIEW IF EXISTS calls_active" + if ActiveRecord::Base.connection_config[:adapter] != 'sqlite3' + execute <<-SQL + CREATE VIEW calls_active AS SELECT + a.uuid AS uuid, + a.direction AS direction, + a.created_epoch AS start_stamp, + a.cid_name AS caller_id_name, + a.cid_num AS caller_id_number, + a.dest AS destination, + c.id AS sip_account_id, + c.caller_name AS sip_caller_name, + a.callee_name AS callee_name, + a.callee_num AS callee_number, + a.callstate AS callstate, + a.read_codec AS read_codec, + a.read_rate AS read_rate, + a.read_bit_rate AS read_bit_rate, + a.write_codec AS write_codec, + a.write_rate AS write_rate, + a.write_bit_rate AS write_bit_rate, + a.secure AS secure, + b.uuid AS b_uuid, + b.cid_name AS b_caller_id_name, + b.cid_num AS b_caller_id_number, + b.callstate AS b_callstate, + d.id AS b_sip_account_id, + d.caller_name AS b_sip_caller_name, + b.callee_name AS b_callee_name, + b.callee_num AS b_callee_number, + b.secure AS b_secure + FROM channels a + LEFT JOIN channels b ON (a.uuid = b.call_uuid AND a.uuid != b.uuid) + LEFT JOIN sip_accounts c ON a.presence_id LIKE CONCAT(c.auth_name, "@%") + LEFT JOIN sip_accounts d ON b.presence_id LIKE CONCAT(d.auth_name, "@%") + WHERE (a.uuid = b.call_uuid AND a.uuid != b.uuid) + OR a.call_uuid IS NULL + OR a.call_uuid = a.uuid + SQL + else + execute <<-SQL + CREATE VIEW calls_active AS SELECT + a.uuid AS uuid, + a.direction AS direction, + a.created_epoch AS start_stamp, + a.cid_name AS caller_id_name, + a.cid_num AS caller_id_number, + a.dest AS destination, + c.id AS sip_account_id, + c.caller_name AS sip_caller_name, + a.callee_name AS callee_name, + a.callee_num AS callee_number, + a.callstate AS callstate, + a.read_codec AS read_codec, + a.read_rate AS read_rate, + a.read_bit_rate AS read_bit_rate, + a.write_codec AS write_codec, + a.write_rate AS write_rate, + a.write_bit_rate AS write_bit_rate, + a.secure AS secure, + b.uuid AS b_uuid, + b.cid_name AS b_caller_id_name, + b.cid_num AS b_caller_id_number, + b.callstate AS b_callstate, + d.id AS b_sip_account_id, + d.caller_name AS b_sip_caller_name, + b.callee_name AS b_callee_name, + b.callee_num AS b_callee_number, + b.secure AS b_secure + FROM channels a + LEFT JOIN channels b ON (a.uuid = b.call_uuid AND a.uuid != b.uuid) + LEFT JOIN sip_accounts c ON a.presence_id LIKE (c.auth_name || "@%") + LEFT JOIN sip_accounts d ON b.presence_id LIKE (d.auth_name || "@%") + WHERE (a.uuid = b.call_uuid AND a.uuid != b.uuid) + OR a.call_uuid IS NULL + OR a.call_uuid = a.uuid + SQL + end + end + + def self.down + + end +end \ No newline at end of file -- cgit v1.2.3 From 2263e14ac12376da9be363823732f493cbc0f44c Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Fri, 15 Mar 2013 10:14:26 +0100 Subject: whitespace --- misc/freeswitch/conf/freeswitch.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/freeswitch/conf/freeswitch.xml b/misc/freeswitch/conf/freeswitch.xml index ac20962..97e027d 100644 --- a/misc/freeswitch/conf/freeswitch.xml +++ b/misc/freeswitch/conf/freeswitch.xml @@ -275,7 +275,7 @@ - + @@ -801,7 +801,7 @@ - + -- cgit v1.2.3 From 910fcee54d7ce3460815d4535556d497a343ea99 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 05:29:49 -0400 Subject: status fixed --- app/models/sip_account.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb index cea5f0e..50124e9 100644 --- a/app/models/sip_account.rb +++ b/app/models/sip_account.rb @@ -188,25 +188,30 @@ class SipAccount < ActiveRecord::Base def status states = Array.new - SipAccount.last.call_legs.each do |call_leg| + self.call_legs.each do |call_leg| states << { - :status => call_leg.callstate, + :status => call_leg.b_callstate || call_leg.callstate, + :status_channel => call_leg.callstate, :caller => true, :endpoint_name => call_leg.callee_name, :endpoint_number => call_leg.destination, :endpoint_sip_account_id => call_leg.b_sip_account_id, :start_stamp => call_leg.start_stamp, + :secure => call_leg.secure, } end - SipAccount.last.b_call_legs.each do |call_leg| + self.b_call_legs.each do |call_leg| + call_status = states << { - :status => call_leg.callstate, + :status => call_leg.b_callstate, + :status_channel => call_leg.b_callstate, :caller => false, :endpoint_name => call_leg.caller_id_name, :endpoint_number => call_leg.caller_id_number, :endpoint_sip_account_id => call_leg.sip_account_id, :start_stamp => call_leg.start_stamp, + :secure => call_leg.b_secure, } end -- cgit v1.2.3 From baf86f285be7c02535c3bc1cd25bf8c69b3b2051 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 06:02:44 -0400 Subject: Germans are serious about call progress tones --- app/controllers/gemeinschaft_setups_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index a62df99..4949fa7 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -62,6 +62,11 @@ class GemeinschaftSetupsController < ApplicationController GsParameter.where(:name => 'ringtone_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}") GsParameter.where(:name => 'user_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/user/image") + # Set ringback_tone + if @gemeinschaft_setup.country.country_code.to_s == '49' + GsParameter.where(:entity => 'dialplan', :section => 'variables', :name => 'ringback').first.update_attributes(:value => '%(1000,4000,425.0)') + end + # Restart FreeSWITCH if Rails.env.production? require 'freeswitch_event' -- cgit v1.2.3 From a6b3a069c2723e321ebfb79a06026bfe97cec9e6 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 08:40:36 -0400 Subject: prefer destination variables --- misc/freeswitch/scripts/dialplan/router.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/misc/freeswitch/scripts/dialplan/router.lua b/misc/freeswitch/scripts/dialplan/router.lua index 751d24f..c335186 100644 --- a/misc/freeswitch/scripts/dialplan/router.lua +++ b/misc/freeswitch/scripts/dialplan/router.lua @@ -83,11 +83,16 @@ function Router.element_match(self, pattern, search_string, replacement, route_v end -function Router.element_match_group(self, pattern, groups, replacement, use_key, route_variables) +function Router.element_match_group(self, pattern, groups, replacement, use_key, route_variables, variable_name) if type(groups) ~= 'table' then + self.log:debug('ELEMENT_FIND_IN_ARRAY - no such array: ', variable_name, ', use_keys: ', tostring(use_key)); return false; end + if self.log_details then + self.log:debug('ELEMENT_FIND_IN_ARRAY - array: ', variable_name, ', use_keys: ', tostring(use_key)); + end + for key, value in pairs(groups) do if use_key then value = key; @@ -136,8 +141,8 @@ function Router.route_match(self, route) local search_string = tostring(common.array.try(self.caller, element.var_in)); result, replacement = self:element_match(tostring(element.pattern), search_string, tostring(element.replacement)); elseif command == 'key' or command == 'val' then - local groups = common.array.try(self.caller, variable_name); - result, replacement = self:element_match_group(tostring(element.pattern), groups, tostring(element.replacement), command == 'key'); + local groups = common.array.try(destination, variable_name) or common.array.try(self.caller, variable_name); + result, replacement = self:element_match_group(tostring(element.pattern), groups, tostring(element.replacement), command == 'key', destination, variable_name); elseif command == 'chv' then local search_string = self.caller:to_s(variable_name); result, replacement = self:element_match(tostring(element.pattern), search_string, tostring(element.replacement)); -- 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(-) 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 8b4c7759dc4b589dd68ea96bfebdd51051526c9d Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 08:41:58 -0400 Subject: display auth_account_id --- misc/freeswitch/scripts/dialplan/dialplan.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index e887610..ac564d9 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -185,7 +185,7 @@ function Dialplan.retrieve_caller_data(self) self.caller:set_auth_account(self.caller.auth_account); end else - self.log:info('CALLER_DATA - no data - unauthenticated call: ', self.caller.auth_account_type, '/', self.caller.auth_account_uuid); + self.log:info('CALLER_DATA - no data - unauthenticated call: ', self.caller.auth_account_type, '=', self.caller.auth_account_id, '/', self.caller.auth_account_uuid); end if not common.str.blank(self.caller.account_type) and not common.str.blank(self.caller.account_uuid) then -- cgit v1.2.3 From 5f909eb79791c7ab232a8693712cce2583a6ee0b Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 08:42:30 -0400 Subject: display label --- app/views/softkeys/show.html.haml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/softkeys/show.html.haml b/app/views/softkeys/show.html.haml index 7c068ae..64adbe6 100644 --- a/app/views/softkeys/show.html.haml +++ b/app/views/softkeys/show.html.haml @@ -1,5 +1,8 @@ - content_for :title, t("softkeys.show.page_title") +%p + %strong= t("softkeys.show.label") + ":" + =@softkey.label %p %strong= t("softkeys.functions.#{@softkey.softkey_function}") + ":" =@softkey.to_s -- cgit v1.2.3 From 5fdcf4e66f1b9d926ace0ab4a78db177b7487ad6 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 15 Mar 2013 08:43:29 -0400 Subject: test action --- app/controllers/call_routes_controller.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 50e7849..819b593 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -88,10 +88,17 @@ class CallRoutesController < ApplicationController end def test - sip_account = SipAccount.where(:id => params[:sip_account_id]).first; - destination_number = params[:destination_number] - routing_table = params[:routing_table] - @route_test = CallRoute.test_route(routing_table, {'caller.destination_number' => destination_number, 'caller.auth_account_type' => 'SipAccount', 'caller.auth_account_uuid' => sip_account.uuid}) + if !params[:sip_account_id].blank? + account = SipAccount.where(:id => params[:sip_account_id]).first + elsif !params[:hunt_group_id].blank? + account = HuntGroup.where(:id => params[:hunt_group_id]).first + end + + if account + destination_number = params[:destination_number] + routing_table = params[:routing_table] + @route_test = CallRoute.test_route(routing_table, {'caller.destination_number' => destination_number, 'caller.auth_account_type' => account.class.name, 'caller.auth_account_id' => account.id, 'caller.auth_account_uuid' => account.try(:uuid)}) + end end private -- cgit v1.2.3 From 1702b51b05ca73751bd52c715dd453f98d9b578f Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 17 Mar 2013 02:06:28 -0400 Subject: clip/clir flags fixed --- misc/freeswitch/scripts/dialplan/dialplan.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index ac564d9..b3d6c47 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -191,6 +191,9 @@ function Dialplan.retrieve_caller_data(self) if not common.str.blank(self.caller.account_type) and not common.str.blank(self.caller.account_uuid) then self.caller.account = self:object_find{class = self.caller.account_type, uuid = self.caller.account_uuid}; if self.caller.account then + self.caller.clir = common.str.to_b(common.array.try(self.caller, 'account.record.clir')); + self.caller.clip = common.str.to_b(common.array.try(self.caller, 'account.record.clip')); + require 'common.phone_number' self.caller.caller_phone_numbers = common.phone_number.PhoneNumber:new{ log = self.log, database = self.database }:list_by_owner(self.caller.account.id, self.caller.account.class); for index, caller_number in ipairs(self.caller.caller_phone_numbers) do -- cgit v1.2.3 From 87655b8f02c5cdefc44abbacea8e60deefaf77c4 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 17 Mar 2013 02:08:18 -0400 Subject: set caller account --- app/controllers/call_routes_controller.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 819b593..e5cf56a 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -97,7 +97,15 @@ class CallRoutesController < ApplicationController if account destination_number = params[:destination_number] routing_table = params[:routing_table] - @route_test = CallRoute.test_route(routing_table, {'caller.destination_number' => destination_number, 'caller.auth_account_type' => account.class.name, 'caller.auth_account_id' => account.id, 'caller.auth_account_uuid' => account.try(:uuid)}) + @route_test = CallRoute.test_route(routing_table, { + 'caller.destination_number' => destination_number, + 'caller.auth_account_type' => account.class.name, + 'caller.auth_account_id' => account.id, + 'caller.auth_account_uuid' => account.try(:uuid), + 'caller.account_type' => account.class.name, + 'caller.account_id' => account.id, + 'caller.account_uuid' => account.try(:uuid), + }) end end -- cgit v1.2.3 From df9869a82253d0482eaf2166865a75876aef77b3 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 17 Mar 2013 03:11:45 -0400 Subject: logging --- misc/freeswitch/scripts/dialplan/dialplan.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index b3d6c47..9abd3d2 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -626,6 +626,8 @@ function Dialplan.switch(self, destination) local result = nil; self.dial_timeout_active = self.dial_timeout; + self.log:debug('SWITCH - auth: ', self.caller.auth_account.class, '=', self.caller.auth_account.id, '/', self.caller.auth_account.uuid, ', caller: ', self.caller.account.class, '=', self.caller.account.id, '/', self.caller.account.uuid); + if not destination.node_local then return self:dial(destination); end @@ -726,8 +728,8 @@ function Dialplan.switch(self, destination) 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, ',')); + self.log:info('SWITCH - clir: ', self.caller.clir, ', caller_id_numbers: ', table.concat(self.caller.caller_id_numbers, ',')); destination.callee_id_number = destination.number; destination.callee_id_name = nil; -- 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(-) 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 e5cf06103f5d2256767530c9f3ddc2ae803926f8 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 17 Mar 2013 06:56:04 -0400 Subject: log enhancements --- misc/freeswitch/scripts/common/log.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/misc/freeswitch/scripts/common/log.lua b/misc/freeswitch/scripts/common/log.lua index f224070..b9893ac 100644 --- a/misc/freeswitch/scripts/common/log.lua +++ b/misc/freeswitch/scripts/common/log.lua @@ -24,6 +24,7 @@ function Log.new(self, arg) self.level_notice = arg.level_notice or 5; self.level_info = arg.level_info or 6; self.level_debug = arg.level_debug or 7; + self.level_devel = arg.level_devel or 4; return object; end @@ -35,7 +36,12 @@ function Log.message(self, log_level, message_arguments ) local message = tostring(self.prefix); for index, value in pairs(message_arguments) do if type(index) == 'number' then - message = message .. tostring(value); + if type(value) == 'table' then + require 'common.array'; + message = message .. common.array.to_json(value); + else + message = message .. tostring(value); + end end end if self.buffer then @@ -76,3 +82,9 @@ end function Log.debug(self, ...) self:message(self.level_debug, {...}); end + +function Log.devel(self, ...) + local arguments = {...}; + table.insert(arguments, 1, '**'); + self:message(self.level_devel, arguments); +end -- 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(-) 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