From 5f603012881517483df0c9e4473d0aacdde66655 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 29 Jan 2013 09:11:16 +0100 Subject: Add a mail_to for the user's e-mail address. --- app/views/users/show.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 639a52a..c63c791 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -16,14 +16,14 @@ %tbody %tr %td - %strong= t('users.show.user_name') + ":" + %strong= truncate(t('users.show.user_name'), :length => 7) + ":" %td = truncate(@user.user_name, :length => 14) %tr %td - %strong= t('users.show.email') + ":" + %strong= truncate(t('users.show.email'), :length => 7) + ":" %td - = truncate(@user.email, :length => 14) + = mail_to @user.email, (Haml::Engine.new("%i.icon-envelope").render + ' ' + truncate(@user.email, :length => 16)) %p.controls = render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @tenant, :child => @user } -- cgit v1.2.3 From b68e56c4d6fc8c8edd3b9afe1e85886f0e54d436 Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 29 Jan 2013 09:31:17 +0100 Subject: log level on failures --- misc/freeswitch/scripts/http_request.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/misc/freeswitch/scripts/http_request.lua b/misc/freeswitch/scripts/http_request.lua index 8acdcb6..1d6f791 100644 --- a/misc/freeswitch/scripts/http_request.lua +++ b/misc/freeswitch/scripts/http_request.lua @@ -28,4 +28,9 @@ if user and password then end local success, result, response_headers = http.request{url = url, headers = headers }; -log:debug('HTTP_REQUEST - url: ', url, ', auth: ', tostring(headers.Authorization ~= nil), ', result: ', result); + +if success then + log:debug('HTTP_REQUEST - url: ', url, ', auth: ', tostring(headers.Authorization ~= nil), ', result: ', result); +else + log:notice('HTTP_REQUEST - url: ', url, ', auth: ', tostring(headers.Authorization ~= nil), ', result: ', result); +end -- cgit v1.2.3 From c890f7c5927a1edb2a32dd94ff9c6c08a1af6047 Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 29 Jan 2013 09:31:40 +0100 Subject: set caller_id --- misc/freeswitch/scripts/send_fax.lua | 49 ++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/misc/freeswitch/scripts/send_fax.lua b/misc/freeswitch/scripts/send_fax.lua index e3dc4cc..9b6ffce 100644 --- a/misc/freeswitch/scripts/send_fax.lua +++ b/misc/freeswitch/scripts/send_fax.lua @@ -74,25 +74,42 @@ local origination_variables = { 'gs_auth_account_uuid=' .. fax_account.record.uuid, 'gs_auth_account_type=' .. 'faxaccount', } - + +local caller = { + destination_number = destination_number, + account_type = 'faxaccount', + account_uuid = fax_account.uuid, + auth_account_type = 'faxaccount', + auth_account_uuid = fax_account.uuid, +} + +require 'dialplan.dialplan' +local dialplan = dialplan.dialplan.Dialplan:new{ log = log, caller = caller, database = database }; +local result = dialplan:retrieve_caller_data(); + +caller.caller_id_numbers = {} +if not caller.clir then + for index, number in ipairs(caller.caller_phone_numbers) do + table.insert(caller.caller_id_numbers, number); + end + caller.caller_id_name = fax_account.record.station_id; + caller.caller_id_number = caller.caller_id_numbers[1]; + table.insert(origination_variables, "sip_h_Privacy='none'"); +else + caller.caller_id_name = 'anonymous'; + caller.caller_id_number = 'anonymous'; + table.insert(origination_variables, "sip_h_Privacy='id'"); +end + +log:info('CALLER_ID_NUMBERS - clir: ', caller.clir, ', numbers: ', table.concat(caller.caller_id_numbers, ',')); + local session = nil if phone_number then + table.insert(origination_variables, "origination_caller_id_number='" .. caller.caller_id_number .. "'"); + table.insert(origination_variables, "origination_caller_id_name='" .. caller.caller_id_name .. "'"); session = freeswitch.Session("[" .. table.concat(origination_variables, ",") .. "]loopback/" .. destination_number .. "/default"); else - local caller = { - destination_number = destination_number, - caller_id_name = fax_account.record.station_id, - account_type = 'faxaccount', - account_uuid = fax_account.uuid, - auth_account_type = 'faxaccount', - auth_account_uuid = fax_account.uuid, - } - - require 'dialplan.dialplan' - local dialplan = dialplan.dialplan.Dialplan:new{ log = log, caller = caller, database = database }; - local result = dialplan:retrieve_caller_data(); - local dialplan_router = require('dialplan.router'); local routes = dialplan_router.Router:new{ log = log, database = database, caller = caller, variables = caller }:route_run('outbound'); @@ -104,8 +121,8 @@ else for index, route in ipairs(routes) do log:info('FAX_SEND - ', route.type, '=', route.id, '/', route.gateway,', number: ', route.destination_number); if route.type == 'gateway' then - table.insert(origination_variables, "origination_caller_id_number='" .. (route.caller_id_number or caller.caller_phone_numbers[1]) .. "'"); - table.insert(origination_variables, "origination_caller_id_name='" .. (route.caller_id_name or fax_account.record.station_id) .. "'"); + table.insert(origination_variables, "origination_caller_id_number='" .. (route.caller_id_number or caller.caller_id_number) .. "'"); + table.insert(origination_variables, "origination_caller_id_name='" .. (route.caller_id_name or caller.caller_id_name) .. "'"); session = freeswitch.Session('[' .. table.concat(origination_variables, ',') .. ']sofia/gateway/' .. route.gateway .. '/' .. route.destination_number); log:notice('SESSION: ', session); break; -- cgit v1.2.3 From 53a98b21f031b429f14a9cd9ec2feeb040a633db Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 29 Jan 2013 09:32:39 +0100 Subject: log file access errors --- app/controllers/trigger_controller.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb index ac43832..2b491be 100644 --- a/app/controllers/trigger_controller.rb +++ b/app/controllers/trigger_controller.rb @@ -97,8 +97,16 @@ class TriggerController < ApplicationController if fax_document.save Notifications.new_fax(fax_document).deliver - File.delete("#{TMP_DIR}#{tiff_file}"); - File.delete(pdf_file); + begin + File.delete("#{TMP_DIR}#{tiff_file}"); + rescue => e + logger.error "Raw fax file could not be deleted: #{TMP_DIR}#{tiff_file} => #{e.inspect}" + end + begin + File.delete(pdf_file); + rescue => e + logger.error "PDF fax file could not be deleted: #{TMP_DIR}#{pdf_file} => #{e.inspect}" + end fax_document.tiff = nil fax_document.save fax_document.render_thumbnails -- cgit v1.2.3