From d323e95480e675c01c1c5c9fdfb25083c448de7f Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Fri, 24 May 2013 16:45:28 +0200 Subject: switchboard calls --- app/models/switchboard.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/models') diff --git a/app/models/switchboard.rb b/app/models/switchboard.rb index cf8c708..095f878 100644 --- a/app/models/switchboard.rb +++ b/app/models/switchboard.rb @@ -35,6 +35,10 @@ class Switchboard < ActiveRecord::Base self.name.to_s end + def active_calls + self.switchboard_entries.where(:switchable => true).map{|se| se.sip_account}.uniq.map{|sip_account| sip_account.calls}.flatten + end + private def convert_0_to_nil if self.reload_interval == 0 -- cgit v1.2.3