diff options
-rw-r--r-- | app/controllers/phone_numbers_controller.rb | 17 | ||||
-rw-r--r-- | app/views/phone_book_entries/show.html.haml | 15 | ||||
-rw-r--r-- | config/locales/views/phone_numbers/de.yml | 3 | ||||
-rw-r--r-- | config/locales/views/phone_numbers/en.yml | 1 | ||||
-rw-r--r-- | config/routes.rb | 1 | ||||
-rw-r--r-- | misc/freeswitch/scripts/dialplan/dialplan.lua | 1 | ||||
-rw-r--r-- | misc/freeswitch/scripts/dialplan/sip_call.lua | 7 |
7 files changed, 37 insertions, 8 deletions
diff --git a/app/controllers/phone_numbers_controller.rb b/app/controllers/phone_numbers_controller.rb index 065934c..c562954 100644 --- a/app/controllers/phone_numbers_controller.rb +++ b/app/controllers/phone_numbers_controller.rb @@ -77,6 +77,23 @@ class PhoneNumbersController < ApplicationController redirect_to :back end + def call + sip_account = nil + current_user.sip_accounts.each do |user_sip_account| + if user_sip_account.registration + sip_account = user_sip_account + break + end + end + + if can?(:call, @phone_number) && sip_account + if ! @phone_number.number.blank? + sip_account.call(@phone_number.number) + end + end + redirect_to(:back) + end + private def set_and_authorize_parent @parent = @phone_book_entry || @sip_account || @conference || @fax_account || diff --git a/app/views/phone_book_entries/show.html.haml b/app/views/phone_book_entries/show.html.haml index a9e1e8f..ff43b8a 100644 --- a/app/views/phone_book_entries/show.html.haml +++ b/app/views/phone_book_entries/show.html.haml @@ -67,27 +67,28 @@ = @phone_book_entry.description .widget.phones - @phone_book_entry.phone_numbers.each do |phone_number| - - case phone_number.name + - case phone_number.name.to_s.downcase - when /fax/ .fax - %a= phone_number + = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call') %span= phone_number.name - when /home/ .home - %a= phone_number - %span= phone_number.name + = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call') + %span - when /mobile/ .cellphone - %a= phone_number + = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call') %span= phone_number.name - when /office/ .office - %a= phone_number + = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call') %span= phone_number.name - else .phone - %a= phone_number + = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call') %span= phone_number.name + = link_to t('phone_book_entries.show.manage_phone_numbers'), phone_book_entry_phone_numbers_path(@phone_book_entry) .widget.adresses diff --git a/config/locales/views/phone_numbers/de.yml b/config/locales/views/phone_numbers/de.yml index 40fc7f8..e801ab4 100644 --- a/config/locales/views/phone_numbers/de.yml +++ b/config/locales/views/phone_numbers/de.yml @@ -34,7 +34,8 @@ de: confirm: 'Sind Sie sicher, dass Sie diese Telefonnummer löschen möchten?' destroy: 'Löschen' edit: 'Bearbeiten' - view_all: 'View all phone numbers' + view_all: 'Alle anzeigen' + call: 'Anrufen' new: page_title: 'Neue Telefonnummer' edit: diff --git a/config/locales/views/phone_numbers/en.yml b/config/locales/views/phone_numbers/en.yml index 31af5c8..be3b4f5 100644 --- a/config/locales/views/phone_numbers/en.yml +++ b/config/locales/views/phone_numbers/en.yml @@ -35,6 +35,7 @@ en: destroy: 'Delete' edit: 'Edit' view_all: 'View all phone numbers' + call: 'Call' new: page_title: 'New Phone number' edit: diff --git a/config/routes.rb b/config/routes.rb index a0ad6aa..6d45f9f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -304,6 +304,7 @@ Gemeinschaft42c::Application.routes.draw do member do put 'move_higher' put 'move_lower' + put 'call' end end end diff --git a/misc/freeswitch/scripts/dialplan/dialplan.lua b/misc/freeswitch/scripts/dialplan/dialplan.lua index 391f5bf..69cccf1 100644 --- a/misc/freeswitch/scripts/dialplan/dialplan.lua +++ b/misc/freeswitch/scripts/dialplan/dialplan.lua @@ -476,6 +476,7 @@ function Dialplan.dial(self, destination) { timeout = self.dial_timeout_active, send_ringing = ( self.send_ringing_to_gateways and self.caller.from_gateway ), bypass_media_network = self.config.parameters.bypass_media_network, + update_callee_display = self.config.parameters.update_callee_display, } ); end diff --git a/misc/freeswitch/scripts/dialplan/sip_call.lua b/misc/freeswitch/scripts/dialplan/sip_call.lua index ab6a471..95ab0f3 100644 --- a/misc/freeswitch/scripts/dialplan/sip_call.lua +++ b/misc/freeswitch/scripts/dialplan/sip_call.lua @@ -79,6 +79,8 @@ function SipCall.fork(self, destinations, arg ) local dial_strings = {} require 'common.sip_account' + require 'common.str' + local sip_account_class = common.sip_account.SipAccount:new{ log = self.log, database = self.database }; local call_result = { code = 404, phrase = 'No destination' }; @@ -88,6 +90,11 @@ function SipCall.fork(self, destinations, arg ) local origination_variables = { 'gs_fork_index=' .. index } self.log:info('FORK ', index, '/', #destinations, ' - ', destination.type, '=', destination.id, '/', destination.gateway or destination.uuid, '@', destination.node_id, ', number: ', destination.number); + + if not common.str.to_b(arg.update_callee_display) then + table.insert(origination_variables, 'ignore_display_updates=true'); + end + if not destination.node_local or destination.type == 'node' then require 'common.node' local node = nil; |