diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/phone_numbers_controller.rb | 17 |
1 files changed, 17 insertions, 0 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 || |