summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-08-13 15:41:39 +0200
committerPeter Kozak <spag@golwen.net>2013-08-13 15:41:39 +0200
commit1c9accfc223e8ab050f20e2ac12768e18f06dba9 (patch)
tree43b913f210adaf114bb614b90f853a1c37313e1a
parentda6ecd6f922a2fead39b49db3c2bec1ad9d6bb9f (diff)
polycom resync added
-rw-r--r--app/models/phone.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/models/phone.rb b/app/models/phone.rb
index f8b7750..033251a 100644
--- a/app/models/phone.rb
+++ b/app/models/phone.rb
@@ -145,6 +145,28 @@ class Phone < ActiveRecord::Base
event.add_header("host", sip_account.sip_domain.host)
event.add_header("content-type", "application/simple-message-summary")
return event.fire()
+ elsif self.phone_model.manufacturer.ieee_name == 'Polycom'
+ if !sip_account
+ self.sip_accounts.where(:sip_accountable_type => self.phoneable_type).each do |sip_account_associated|
+ if sip_account_associated.registration
+ sip_account = sip_account_associated
+ break
+ end
+ end
+ end
+
+ if ! sip_account or ! sip_account.registration
+ return false
+ end
+
+ require 'freeswitch_event'
+ event = FreeswitchEvent.new("NOTIFY")
+ event.add_header("profile", "gemeinschaft")
+ event.add_header("event-string", "check-sync;reboot=#{reboot.to_s}")
+ event.add_header("user", sip_account.auth_name)
+ event.add_header("host", sip_account.sip_domain.host)
+ event.add_header("content-type", "application/simple-message-summary")
+ return event.fire()
end