summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-04-30 11:44:07 +0200
committerPeter Kozak <spag@golwen.net>2013-04-30 11:44:07 +0200
commitf9168c5a5b132eca327833613d04fef66fb8b8bd (patch)
tree73b96adb6d782ad04d60823bbabe504b9025e742 /app/controllers
parent4b118eb90f6b87d3346c77efd6d6c2d37ef0e6d1 (diff)
call method fixed
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/voicemail_messages_controller.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/controllers/voicemail_messages_controller.rb b/app/controllers/voicemail_messages_controller.rb
index 3c75a64..5c28572 100644
--- a/app/controllers/voicemail_messages_controller.rb
+++ b/app/controllers/voicemail_messages_controller.rb
@@ -39,6 +39,8 @@ class VoicemailMessagesController < ApplicationController
:per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE')
)
end
+
+ @available_sip_account = available_sip_account()
end
def show
@@ -94,10 +96,20 @@ class VoicemailMessagesController < ApplicationController
end
end
+ def available_sip_account
+ voicemail_accountable = @voicemail_account.voicemail_accountable
+ if voicemail_accountable.class == SipAccount
+ return voicemail_accountable
+ elsif voicemail_accountable.class == User
+ return voicemail_accountable.sip_accounts.first
+ end
+ end
+
def call
phone_number = @voicemail_message.cid_number
- if ! phone_number.blank? && @voicemail_account.registration
- @voicemail_account.call(phone_number)
+ sip_account = self.available_sip_account
+ if ! phone_number.blank? && sip_account && sip_account.registration
+ sip_account.call(phone_number)
end
redirect_to(:back)
end