Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: New nat handling mechanism #513

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions app/admin/equipment/gateways.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
:orig_use_outbound_proxy, :orig_force_outbound_proxy,
[:orig_proxy_transport_protocol_name, proc { |row| row.orig_proxy_transport_protocol.try(:name) }],
:orig_outbound_proxy,
:dialog_nat_handling, # :transparent_dialog_id,
[:nat_handling_mode_name, proc { |row| row.nat_handling_mode.try(:name) }],
[:orig_disconnect_policy_name, proc { |row| row.orig_disconnect_policy.try(:name) }],
[:transport_protocol_name, proc { |row| row.transport_protocol.try(:name) }],
[:sip_schema_name, proc { |row| row.sip_schema.try(:name) }],
Expand Down Expand Up @@ -86,7 +86,7 @@
:sip_timer_b, :dns_srv_failover_timer,
[:sdp_c_location_name, proc { |row| row.sdp_c_location.try(:name) }],
[:codec_group_name, proc { |row| row.codec_group.try(:name) }],
:anonymize_sdp, :proxy_media, :single_codec_in_200ok, :transparent_seqno, :transparent_ssrc, :force_symmetric_rtp, :symmetric_rtp_nonstop, :symmetric_rtp_ignore_rtcp, :force_dtmf_relay, :rtp_ping,
:proxy_media, :single_codec_in_200ok, :force_symmetric_rtp, :symmetric_rtp_nonstop, :symmetric_rtp_ignore_rtcp, :force_dtmf_relay, :rtp_ping,
:rtp_timeout,
:filter_noaudio_streams,
:rtp_relay_timestamp_aligning,
Expand Down Expand Up @@ -116,7 +116,7 @@
:transport_protocol, :term_proxy_transport_protocol, :orig_proxy_transport_protocol,
:rel100_mode, :rx_inband_dtmf_filtering_mode, :tx_inband_dtmf_filtering_mode,
:network_protocol_priority, :media_encryption_mode, :sip_schema,
:termination_src_numberlist, :termination_dst_numberlist, :lua_script
:termination_src_numberlist, :termination_dst_numberlist, :lua_script, :nat_handling_mode

controller do
def resource_params
Expand Down Expand Up @@ -226,8 +226,8 @@ def resource_params
column :orig_force_outbound_proxy
column :orig_proxy_transport_protocol
column :orig_outbound_proxy
column :transparent_dialog_id
column :dialog_nat_handling

column :nat_handling_mode
column :orig_disconnect_policy

column :resolve_ruri
Expand Down Expand Up @@ -279,8 +279,6 @@ def resource_params
column :anonymize_sdp
column :proxy_media
column :single_codec_in_200ok
column :transparent_seqno
column :transparent_ssrc
column :force_symmetric_rtp
column :symmetric_rtp_nonstop
column :symmetric_rtp_ignore_rtcp
Expand Down Expand Up @@ -322,6 +320,7 @@ def resource_params
filter :external_id
filter :radius_accounting_profile, input_html: { class: 'chosen' }
filter :lua_script, input_html: { class: 'chosen' }
filter :nat_handling_mode

form do |f|
f.semantic_errors *f.object.errors.keys
Expand Down Expand Up @@ -384,6 +383,7 @@ def resource_params
f.input :sip_interface_name
f.input :incoming_auth_username
f.input :incoming_auth_password, as: :string, input_html: { autocomplete: 'off' }
f.input :nat_handling_mode
end

f.inputs 'Origination' do
Expand All @@ -393,8 +393,6 @@ def resource_params
f.input :orig_force_outbound_proxy
f.input :orig_proxy_transport_protocol, as: :select, include_blank: false
f.input :orig_outbound_proxy
f.input :transparent_dialog_id
f.input :dialog_nat_handling
f.input :orig_disconnect_policy
end
end
Expand Down Expand Up @@ -458,11 +456,8 @@ def resource_params
f.inputs 'Media settings' do
f.input :sdp_c_location, as: :select, include_blank: false
f.input :codec_group, input_html: { class: 'chosen' }
f.input :anonymize_sdp
f.input :proxy_media
f.input :single_codec_in_200ok
f.input :transparent_seqno
f.input :transparent_ssrc
f.input :force_symmetric_rtp
f.input :symmetric_rtp_nonstop
f.input :symmetric_rtp_ignore_rtcp
Expand Down Expand Up @@ -550,6 +545,7 @@ def resource_params
row :transit_headers_from_origination
row :transit_headers_from_termination
row :sip_interface_name
row :nat_handling_mode
end
end
panel 'Origination' do
Expand All @@ -560,8 +556,6 @@ def resource_params
row :orig_force_outbound_proxy
row :orig_proxy_transport_protocol
row :orig_outbound_proxy
row :transparent_dialog_id
row :dialog_nat_handling
row :orig_disconnect_policy

row :incoming_auth_username
Expand Down Expand Up @@ -628,11 +622,8 @@ def resource_params
attributes_table_for s do
row :sdp_c_location
row :codec_group, input_html: { class: 'chosen' }
row :anonymize_sdp
row :proxy_media
row :single_codec_in_200ok
row :transparent_seqno
row :transparent_ssrc
row :force_symmetric_rtp
row :symmetric_rtp_nonstop
row :symmetric_rtp_ignore_rtcp
Expand Down
8 changes: 4 additions & 4 deletions app/admin/routing/lnp_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

acts_as_export :id, :dst, :lrn, :tag, :created_at, :expires_at

includes :database
includes :database, :routing_tag

index do
selectable_column
id_column
actions
column :dst
column :lrn
column :tag
column :routing_tag
column :data
column :database
column :created_at
Expand All @@ -28,7 +28,7 @@
filter :id
filter :dst
filter :lrn
filter :tag
filter :routing_tag
filter :data
filter :database

Expand All @@ -37,7 +37,7 @@
row :id
row :dst
row :lrn
row :tag
row :routing_tag
row :data
row :database
row :created_at
Expand Down
1 change: 1 addition & 0 deletions app/admin/system/country.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

index do
id_column
actions
column :name
column :iso2
end
Expand Down
1 change: 1 addition & 0 deletions app/admin/system/lnp_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

index do
id_column
actions
column :name
column :address
column :port
Expand Down
1 change: 1 addition & 0 deletions app/admin/system/load_balancer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

index do
id_column
actions
column :name
column :signalling_ip
end
Expand Down
1 change: 1 addition & 0 deletions app/admin/system/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

index do
id_column
actions
column :name
end

Expand Down
1 change: 1 addition & 0 deletions app/admin/system/network_prefix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def scoped_collection

index do
id_column
actions
column :prefix
column :country, sortable: 'countries.name'
column :network, sortable: 'networks.name'
Expand Down
1 change: 1 addition & 0 deletions app/admin/system/sensor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def build_resource_params

index do
id_column
actions
column :name
column :mode
column :source_interface
Expand Down
1 change: 1 addition & 0 deletions app/admin/system/smtp_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

index do
id_column
actions
column :name
column :host
column :port
Expand Down
13 changes: 13 additions & 0 deletions app/models/equipment/gateway_nat_handling_mode.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

# == Schema Information
#
# Table name: class4.gateway_nat_handling_modes
#
# id :integer not null, primary key
# name :string not null
#

class Equipment::GatewayNatHandlingMode < Yeti::ActiveRecord
self.table_name = 'class4.gateway_nat_handling_modes'
end
4 changes: 3 additions & 1 deletion app/models/gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
# termination_dst_numberlist_id :integer
# lua_script_id :integer
# use_registered_aor :boolean default(FALSE), not null
# nat_handling_mode_id :integer default(1), not null
#

require 'resolv'
Expand Down Expand Up @@ -153,6 +154,7 @@ class Gateway < Yeti::ActiveRecord
belongs_to :termination_dst_numberlist, class_name: 'Routing::Numberlist', foreign_key: :termination_dst_numberlist_id
belongs_to :termination_src_numberlist, class_name: 'Routing::Numberlist', foreign_key: :termination_src_numberlist_id
belongs_to :lua_script, class_name: 'System::LuaScript', foreign_key: :lua_script_id
belongs_to :nat_handling_mode, class_name: 'Equipment::GatewayNatHandlingMode', foreign_key: :nat_handling_mode_id

has_many :customers_auths, class_name: 'CustomersAuth', dependent: :restrict_with_error
has_many :dialpeers, class_name: 'Dialpeer', dependent: :restrict_with_error
Expand Down Expand Up @@ -182,7 +184,7 @@ class Gateway < Yeti::ActiveRecord

validates_numericality_of :fake_180_timer, greater_than: 0, less_than_or_equal_to: PG_MAX_SMALLINT, allow_nil: true, only_integer: true
validates_presence_of :transport_protocol, :term_proxy_transport_protocol, :orig_proxy_transport_protocol,
:network_protocol_priority, :media_encryption_mode, :sdp_c_location, :sip_schema
:network_protocol_priority, :media_encryption_mode, :sdp_c_location, :sip_schema, :nat_handling_mode

validates_presence_of :incoming_auth_username, :incoming_auth_password,
if: proc { |gw|
Expand Down
20 changes: 11 additions & 9 deletions app/models/lnp/cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
#
# Table name: class4.lnp_cache
#
# id :integer not null, primary key
# dst :string not null
# lrn :string not null
# created_at :datetime
# updated_at :datetime
# expires_at :datetime
# database_id :integer
# data :string
# tag :string
# id :integer not null, primary key
# dst :string not null
# lrn :string not null
# created_at :datetime
# updated_at :datetime
# expires_at :datetime
# database_id :integer
# data :string
# tag :string
# routing_tag_id :integer
#

class Lnp::Cache < Yeti::ActiveRecord
self.table_name = 'class4.lnp_cache'

belongs_to :database, class_name: 'Lnp::Database', foreign_key: :database_id
belongs_to :routing_tag, class_name: 'Routing::RoutingTag', foreign_key: :routing_tag_id
end
3 changes: 2 additions & 1 deletion config/initializers/pg_dump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
'-T', 'auth_log.auth_log_2*',
'-T', 'rtp_statistics.streams_*',
'-T', 'pgq.*',
'-T', 'pgq_ext.*'
'-T', 'pgq_ext.*',
'-T', 'logs.api_requests_2*'
]
Loading