summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/gateway.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/gateway.rb b/app/models/gateway.rb
index bf391fb..01b29b2 100644
--- a/app/models/gateway.rb
+++ b/app/models/gateway.rb
@@ -19,6 +19,8 @@ class Gateway < ActiveRecord::Base
after_initialize :set_defaults
before_validation :downcase_technology
+ after_create :create_default_settings
+
def to_s
name
end
@@ -65,4 +67,12 @@ class Gateway < ActiveRecord::Base
end
end
+ def create_default_settings
+ if self.technology == 'sip' then
+ GsParameter.where(:entity => 'sip_gateways', :section => 'settings').each do |default_setting|
+ self.gateway_settings.create(:name => default_setting.name, :value => default_setting.value, :class_type => default_setting.class_type, :description => default_setting.description)
+ end
+ end
+ end
+
end