diff options
author | spag <spag@golwen.net> | 2013-01-08 14:11:54 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-01-08 14:11:54 +0100 |
commit | b67c3f5ff6474ba117c75eb81c7d2d9371e8a103 (patch) | |
tree | 592400434bd1aceb16aeaa9a8f06f771944af296 /app/controllers | |
parent | 70ef0ee8e668b0f620ec74afc8347e43bcfebb87 (diff) |
Click to dial in phone book
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 || |