From b67c3f5ff6474ba117c75eb81c7d2d9371e8a103 Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 8 Jan 2013 14:11:54 +0100 Subject: Click to dial in phone book --- app/controllers/phone_numbers_controller.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/controllers/phone_numbers_controller.rb') 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 || -- cgit v1.2.3