summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-08-07 15:35:45 +0200
committerPeter Kozak <spag@golwen.net>2013-08-07 15:35:45 +0200
commit07aaab02e8bead8e142a680b5fa024b1ab215a08 (patch)
treea67ce2986403f3172578124caf8b33089b0aaa6f /app
parent09a01fa6d9db89c20417fc4e71bb818501ce09df (diff)
create all supported header_types
Diffstat (limited to 'app')
-rw-r--r--app/models/gateway.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/app/models/gateway.rb b/app/models/gateway.rb
index 437d3af..f3523fb 100644
--- a/app/models/gateway.rb
+++ b/app/models/gateway.rb
@@ -73,14 +73,16 @@ class Gateway < ActiveRecord::Base
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
- GsParameter.where(:entity => 'sip_gateways', :section => 'headers_default').each do |default_header|
- self.gateway_headers.create(:name => default_header.name, :value => default_header.value, :header_type => 'default', :description => default_header.description)
- end
- GsParameter.where(:entity => 'sip_gateways', :section => 'headers_default_clir_off').each do |default_header|
- self.gateway_headers.create(:constraint_value => 'clir=false', :name => default_header.name, :value => default_header.value, :header_type => 'default', :description => default_header.description)
- end
- GsParameter.where(:entity => 'sip_gateways', :section => 'headers_default_clir_on').each do |default_header|
- self.gateway_headers.create(:constraint_value => 'clir=true', :name => default_header.name, :value => default_header.value, :header_type => 'default', :description => default_header.description)
+ GatewayHeader::HEADER_TYPES.each do |header_type|
+ GsParameter.where(:entity => 'sip_gateways', :section => 'headers_' + header_type).each do |default_header|
+ self.gateway_headers.create(:name => default_header.name, :value => default_header.value, :header_type => header_type, :description => default_header.description)
+ end
+ GsParameter.where(:entity => 'sip_gateways', :section => 'headers_' + header_type + '_clir_off').each do |default_header|
+ self.gateway_headers.create(:constraint_value => 'clir=false', :name => default_header.name, :value => default_header.value, :header_type => header_type, :description => default_header.description)
+ end
+ GsParameter.where(:entity => 'sip_gateways', :section => 'headers_' + header_type + '_clir_on').each do |default_header|
+ self.gateway_headers.create(:constraint_value => 'clir=true', :name => default_header.name, :value => default_header.value, :header_type => header_type, :description => default_header.description)
+ end
end
end
end