From 29ac1a26b5d78c3d8570928df73610de0a361297 Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 28 Jan 2013 09:26:47 +0100 Subject: render route endpoint --- app/models/call_route.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/models') diff --git a/app/models/call_route.rb b/app/models/call_route.rb index 28120c1..b4496ab 100644 --- a/app/models/call_route.rb +++ b/app/models/call_route.rb @@ -238,4 +238,15 @@ class CallRoute < ActiveRecord::Base end end end + + def endpoint + if self.endpoint_id.to_i > 0 + begin + return self.endpoint_type.camelize.constantize.where(:id => self.endpoint_id.to_i).first + rescue + return nil + end + end + end + end -- cgit v1.2.3 From 7f751576ae36f387bafa63e900fa21353a2ce3fb Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 28 Jan 2013 10:11:39 +0100 Subject: sip_registration model added --- app/models/sip_registration.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 app/models/sip_registration.rb (limited to 'app/models') diff --git a/app/models/sip_registration.rb b/app/models/sip_registration.rb new file mode 100644 index 0000000..b668301 --- /dev/null +++ b/app/models/sip_registration.rb @@ -0,0 +1,21 @@ +class SipRegistration < ActiveRecord::Base + # Makes sure that this is a readonly model. + def readonly? + return true + end + + # Prevent objects from being destroyed + def before_destroy + raise ActiveRecord::ReadOnlyRecord + end + + # Prevent objects from being deleted + def self.delete_all + raise ActiveRecord::ReadOnlyRecord + end + + # Prevent objects from being deleted + def delete + raise ActiveRecord::ReadOnlyRecord + end +end -- cgit v1.2.3 From 3e66e066c2f19a8b27233dff1abdf3908debae36 Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 28 Jan 2013 10:12:40 +0100 Subject: use sip_registration in sip_views --- app/models/sip_account.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb index d35f9b4..444eb12 100644 --- a/app/models/sip_account.rb +++ b/app/models/sip_account.rb @@ -133,7 +133,7 @@ class SipAccount < ActiveRecord::Base end def registration - return FreeswitchRegistration.where(:reg_user => self.auth_name).first + return SipRegistration.where(:sip_user => self.auth_name).first end def call( phone_number ) -- cgit v1.2.3