summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-28 11:09:39 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-28 11:09:39 +0100
commitbcdd0a3584f23438257619ee4081949c1e653c91 (patch)
tree3dbdf93b00b39ab77ff520fe68f05847d59e46bb /app/models
parentcdde455a50df5de70ee3d84ce66733e8769db05f (diff)
parent553115fd50ef3c35d961fa98abfd593386da5c94 (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'app/models')
-rw-r--r--app/models/call_route.rb11
-rw-r--r--app/models/sip_account.rb2
-rw-r--r--app/models/sip_registration.rb21
3 files changed, 33 insertions, 1 deletions
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
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 )
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