diff options
-rw-r--r-- | app/models/call_history.rb | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/app/models/call_history.rb b/app/models/call_history.rb index 81342bd..8ccf4e3 100644 --- a/app/models/call_history.rb +++ b/app/models/call_history.rb @@ -133,19 +133,14 @@ class CallHistory < ActiveRecord::Base end - def voicemail_message? - begin - return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).any? - rescue - return nil - end - end - def voicemail_message - begin - return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).first - rescue - return nil + if self.callee_account_type.downcase == 'voicemailaccount' + voicemail_account = VoicemailAccount.where(:id => self.callee_account_id).first + if voicemail_account + return voicemail_account.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).first + else + return nil + end end end |