summaryrefslogtreecommitdiff
path: root/app/models/phone.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/phone.rb')
-rw-r--r--app/models/phone.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/models/phone.rb b/app/models/phone.rb
index 93553a2..f8b7750 100644
--- a/app/models/phone.rb
+++ b/app/models/phone.rb
@@ -116,6 +116,35 @@ class Phone < ActiveRecord::Base
end
return false
+ elsif self.phone_model.manufacturer.ieee_name == 'XIAMEN YEALINK NETWORK TECHNOLOGY CO.,LTD'
+ 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
+ require 'open-uri'
+ begin
+ if open("http://#{self.ip_address}/cgi-bin/ConfigManApp.com?key=Reboot", :http_basic_authentication=>['admin', self.http_password], :proxy => nil)
+ return true
+ end
+ rescue
+ return false
+ end
+ 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