From 1c9accfc223e8ab050f20e2ac12768e18f06dba9 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 13 Aug 2013 15:41:39 +0200 Subject: polycom resync added --- app/models/phone.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 @@ -137,6 +137,28 @@ class Phone < ActiveRecord::Base 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() + 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") -- cgit v1.2.3