summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-27 12:15:12 +0100
committerPeter Kozak <spag@golwen.net>2013-03-27 12:15:12 +0100
commit15d961291513ec240f683552f5b547df443beed9 (patch)
treed29a227feca5ad1a85d83efe08cf650ddc590b2e
parentc27a8d084d84240aee90f460104fdab9be41fbff (diff)
email notifications mailer
-rw-r--r--app/mailers/notifications.rb15
-rw-r--r--app/views/notifications/new_voicemail.text.erb2
2 files changed, 4 insertions, 13 deletions
diff --git a/app/mailers/notifications.rb b/app/mailers/notifications.rb
index 5b46f23..44a6a7a 100644
--- a/app/mailers/notifications.rb
+++ b/app/mailers/notifications.rb
@@ -42,20 +42,11 @@ class Notifications < ActionMailer::Base
mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_pin_change_email, to: "#{user.email}", :subject => "Password recovery")
end
- def new_voicemail(freeswitch_voicemail_msg, attach_file = false)
- sip_account = SipAccount.find_by_auth_name(freeswitch_voicemail_msg.username)
- user = sip_account.sip_accountable
-
+ def new_voicemail(freeswitch_voicemail_msg, account, email, attach_file = false)
@voicemail = Hash.new()
- if ! user.first_name.blank?
- @voicemail[:greeting] = user.first_name
- else
- @voicemail[:greeting] = user.user_name
- end
-
@voicemail[:destination] = freeswitch_voicemail_msg.in_folder
@voicemail[:from] = "#{freeswitch_voicemail_msg.cid_number} #{freeswitch_voicemail_msg.cid_name}"
- @voicemail[:to] = sip_account.to_s
+ @voicemail[:to] = account.to_s
@voicemail[:date] = Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.to_s
@voicemail[:duration] = Time.at(freeswitch_voicemail_msg.message_len).utc.strftime('%T')
@@ -67,7 +58,7 @@ class Notifications < ActionMailer::Base
attachments["#{Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.strftime('%Y%m%d-%H%M%S')}-#{caller_number}.wav"] = File.read(freeswitch_voicemail_msg.file_path)
end
- mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_voicemail_email, to: "#{user.email}", :subject => "New Voicemail from #{@voicemail[:from]}, received #{Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.to_s}")
+ mail(from: Tenant.find(GsParameter.get('DEFAULT_API_TENANT_ID')).from_field_voicemail_email, to: email, :subject => "New Voicemail from #{@voicemail[:from]}, received #{Time.at(freeswitch_voicemail_msg.created_epoch).getlocal.to_s}")
end
def new_fax(fax_document)
diff --git a/app/views/notifications/new_voicemail.text.erb b/app/views/notifications/new_voicemail.text.erb
index adeabda..926610b 100644
--- a/app/views/notifications/new_voicemail.text.erb
+++ b/app/views/notifications/new_voicemail.text.erb
@@ -1,4 +1,4 @@
-Hello <%= @voicemail[:greeting] %>,
+Hello,
You've just received a voicemail on your Gemeinschaft account <%= @voicemail[:destination] %>.