diff options
author | Peter Kozak <spag@golwen.net> | 2013-04-30 11:44:07 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-04-30 11:44:07 +0200 |
commit | f9168c5a5b132eca327833613d04fef66fb8b8bd (patch) | |
tree | 73b96adb6d782ad04d60823bbabe504b9025e742 /app/controllers | |
parent | 4b118eb90f6b87d3346c77efd6d6c2d37ef0e6d1 (diff) |
call method fixed
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/voicemail_messages_controller.rb | 16 |
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 |