diff --git a/app/models/cdr/auth_log.rb b/app/models/cdr/auth_log.rb index d05e3c746..169eb35a3 100644 --- a/app/models/cdr/auth_log.rb +++ b/app/models/cdr/auth_log.rb @@ -16,7 +16,7 @@ # origination_proto_id :integer # username :string # realm :string -# request_method :string +# method :string # ruri :string # from_uri :string # to_uri :string diff --git a/db/migrate/20180620093010_switch16_dtmf_filtering.rb b/db/migrate/20180620093010_switch16_dtmf_filtering.rb index aebb0c5ad..75a7cbeda 100644 --- a/db/migrate/20180620093010_switch16_dtmf_filtering.rb +++ b/db/migrate/20180620093010_switch16_dtmf_filtering.rb @@ -23,6 +23,8 @@ def down drop schema switch16 cascade; + delete from class4.disconnect_code where id=8005; + } end @@ -30,6 +32,8 @@ def down def up execute %q{ + INSERT INTO class4.disconnect_code (id, namespace_id, stop_hunting, pass_reason_to_originator, code, reason, success, successnozerolen,store_cdr,silently_drop) VALUES (8005,0,true,true,403,'Origination gateway is disabled',false,false,true,false); + create table class4.gateway_inband_dtmf_filtering_modes( id smallint primary key, name varchar not null unique @@ -2211,28 +2215,28 @@ def up i_profile.aleg_rtp_filter_inband_dtmf=false; - i_profile.false_rtp_filter_inband_dtmf=false; + i_profile.bleg_rtp_filter_inband_dtmf=false; if i_customer_gw.rx_inband_dtmf_filtering_mode_id=3 then -- enable filtering i_profile.aleg_rtp_filter_inband_dtmf=true; elsif i_customer_gw.rx_inband_dtmf_filtering_mode_id=1 then -- inherit if i_vendor_gw.tx_inband_dtmf_filtering_mode_id in (1,2) then -- inherit or disable filtering - i_profile.aleg_rtp_filter_inband_dtmf=false - elsif i_vendor_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering - i_profile.aleg_rtp_filter_inband_dtmf=true + i_profile.aleg_rtp_filter_inband_dtmf=false; + elsif i_vendor_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering + i_profile.aleg_rtp_filter_inband_dtmf=true; end if; - endif; + end if; if i_vendor_gw.rx_inband_dtmf_filtering_mode_id=3 then -- enable filtering i_profile.bleg_rtp_filter_inband_dtmf=true; elsif i_vendor_gw.rx_inband_dtmf_filtering_mode_id=1 then -- inherit if i_customer_gw.tx_inband_dtmf_filtering_mode_id in (1,2) then -- inherit or disable filtering - i_profile.bleg_rtp_filter_inband_dtmf=false - elsif i_customer_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering - i_profile.bleg_rtp_filter_inband_dtmf=true + i_profile.bleg_rtp_filter_inband_dtmf=false; + elsif i_customer_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering + i_profile.bleg_rtp_filter_inband_dtmf=true; end if; - endif; + end if; i_profile.rtprelay_force_dtmf_relay=i_vendor_gw.force_dtmf_relay; @@ -2524,6 +2528,12 @@ def up SELECT into v_orig_gw * from class4.gateways WHERE id=v_customer_auth_normalized.gateway_id; + if not v_orig_gw.enabled then + v_ret.disconnect_code_id=8005; -- Origination gateway is disabled + RETURN NEXT v_ret; + RETURN; + end if; + v_ret.resources:=''; if v_c_acc.origination_capacity is not null then v_ret.resources:=v_ret.resources||'1:'||v_c_acc.id::varchar||':'||v_c_acc.origination_capacity::varchar||':1;'; diff --git a/db/seeds/main/class4.sql b/db/seeds/main/class4.sql index f4939165d..bb691fe52 100644 --- a/db/seeds/main/class4.sql +++ b/db/seeds/main/class4.sql @@ -338,6 +338,7 @@ INSERT INTO disconnect_code (id, namespace_id, stop_hunting, pass_reason_to_orig INSERT INTO disconnect_code (id, namespace_id, stop_hunting, pass_reason_to_originator, code, reason, rewrited_code, rewrited_reason, success, successnozerolen, store_cdr, silently_drop) VALUES (8002, 0, true, true, 403, 'Source number blacklisted', NULL, NULL, false, false, true, false); INSERT INTO disconnect_code (id, namespace_id, stop_hunting, pass_reason_to_originator, code, reason, rewrited_code, rewrited_reason, success, successnozerolen, store_cdr, silently_drop) VALUES (8003, 0, true, true, 503, 'No response from LNP DB', NULL, NULL, false, false, true, false); INSERT INTO disconnect_code (id, namespace_id, stop_hunting, pass_reason_to_originator, code, reason, success, successnozerolen,store_cdr,silently_drop) VALUES (8004,0,true,true,403,'Rejected by Auth record',false,false,true,false); +INSERT INTO disconnect_code (id, namespace_id, stop_hunting, pass_reason_to_originator, code, reason, success, successnozerolen,store_cdr,silently_drop) VALUES (8005,0,true,true,403,'Origination gateway is disabled',false,false,true,false); INSERT INTO disconnect_code (id, namespace_id, stop_hunting, pass_reason_to_originator, code, reason, rewrited_code, rewrited_reason, success, successnozerolen, store_cdr, silently_drop) VALUES (1505, 1, false, false, 487, 'Ringing timeout', NULL, NULL, false, false, true, false); INSERT INTO disconnect_code (id, namespace_id, stop_hunting, pass_reason_to_originator, code, reason, rewrited_code, rewrited_reason, success, successnozerolen, store_cdr, silently_drop) VALUES (2001, 3, true, false, 503, 'Radius response timeout', NULL, NULL, false, false, true, false); diff --git a/db/structure.sql b/db/structure.sql index 8df50a2cf..d6800c726 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -21215,28 +21215,28 @@ BEGIN i_profile.aleg_rtp_filter_inband_dtmf=false; - i_profile.false_rtp_filter_inband_dtmf=false; + i_profile.bleg_rtp_filter_inband_dtmf=false; if i_customer_gw.rx_inband_dtmf_filtering_mode_id=3 then -- enable filtering i_profile.aleg_rtp_filter_inband_dtmf=true; elsif i_customer_gw.rx_inband_dtmf_filtering_mode_id=1 then -- inherit if i_vendor_gw.tx_inband_dtmf_filtering_mode_id in (1,2) then -- inherit or disable filtering - i_profile.aleg_rtp_filter_inband_dtmf=false - elsif i_vendor_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering - i_profile.aleg_rtp_filter_inband_dtmf=true + i_profile.aleg_rtp_filter_inband_dtmf=false; + elsif i_vendor_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering + i_profile.aleg_rtp_filter_inband_dtmf=true; end if; - endif; + end if; if i_vendor_gw.rx_inband_dtmf_filtering_mode_id=3 then -- enable filtering i_profile.bleg_rtp_filter_inband_dtmf=true; elsif i_vendor_gw.rx_inband_dtmf_filtering_mode_id=1 then -- inherit if i_customer_gw.tx_inband_dtmf_filtering_mode_id in (1,2) then -- inherit or disable filtering - i_profile.bleg_rtp_filter_inband_dtmf=false - elsif i_customer_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering - i_profile.bleg_rtp_filter_inband_dtmf=true + i_profile.bleg_rtp_filter_inband_dtmf=false; + elsif i_customer_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering + i_profile.bleg_rtp_filter_inband_dtmf=true; end if; - endif; + end if; i_profile.rtprelay_force_dtmf_relay=i_vendor_gw.force_dtmf_relay; @@ -21625,28 +21625,28 @@ BEGIN i_profile.aleg_rtp_filter_inband_dtmf=false; - i_profile.false_rtp_filter_inband_dtmf=false; + i_profile.bleg_rtp_filter_inband_dtmf=false; if i_customer_gw.rx_inband_dtmf_filtering_mode_id=3 then -- enable filtering i_profile.aleg_rtp_filter_inband_dtmf=true; elsif i_customer_gw.rx_inband_dtmf_filtering_mode_id=1 then -- inherit if i_vendor_gw.tx_inband_dtmf_filtering_mode_id in (1,2) then -- inherit or disable filtering - i_profile.aleg_rtp_filter_inband_dtmf=false - elsif i_vendor_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering - i_profile.aleg_rtp_filter_inband_dtmf=true + i_profile.aleg_rtp_filter_inband_dtmf=false; + elsif i_vendor_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering + i_profile.aleg_rtp_filter_inband_dtmf=true; end if; - endif; + end if; if i_vendor_gw.rx_inband_dtmf_filtering_mode_id=3 then -- enable filtering i_profile.bleg_rtp_filter_inband_dtmf=true; elsif i_vendor_gw.rx_inband_dtmf_filtering_mode_id=1 then -- inherit if i_customer_gw.tx_inband_dtmf_filtering_mode_id in (1,2) then -- inherit or disable filtering - i_profile.bleg_rtp_filter_inband_dtmf=false - elsif i_customer_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering - i_profile.bleg_rtp_filter_inband_dtmf=true + i_profile.bleg_rtp_filter_inband_dtmf=false; + elsif i_customer_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering + i_profile.bleg_rtp_filter_inband_dtmf=true; end if; - endif; + end if; i_profile.rtprelay_force_dtmf_relay=i_vendor_gw.force_dtmf_relay; @@ -22015,28 +22015,28 @@ BEGIN i_profile.aleg_rtp_filter_inband_dtmf=false; - i_profile.false_rtp_filter_inband_dtmf=false; + i_profile.bleg_rtp_filter_inband_dtmf=false; if i_customer_gw.rx_inband_dtmf_filtering_mode_id=3 then -- enable filtering i_profile.aleg_rtp_filter_inband_dtmf=true; elsif i_customer_gw.rx_inband_dtmf_filtering_mode_id=1 then -- inherit if i_vendor_gw.tx_inband_dtmf_filtering_mode_id in (1,2) then -- inherit or disable filtering - i_profile.aleg_rtp_filter_inband_dtmf=false - elsif i_vendor_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering - i_profile.aleg_rtp_filter_inband_dtmf=true + i_profile.aleg_rtp_filter_inband_dtmf=false; + elsif i_vendor_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering + i_profile.aleg_rtp_filter_inband_dtmf=true; end if; - endif; + end if; if i_vendor_gw.rx_inband_dtmf_filtering_mode_id=3 then -- enable filtering i_profile.bleg_rtp_filter_inband_dtmf=true; elsif i_vendor_gw.rx_inband_dtmf_filtering_mode_id=1 then -- inherit if i_customer_gw.tx_inband_dtmf_filtering_mode_id in (1,2) then -- inherit or disable filtering - i_profile.bleg_rtp_filter_inband_dtmf=false - elsif i_customer_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering - i_profile.bleg_rtp_filter_inband_dtmf=true + i_profile.bleg_rtp_filter_inband_dtmf=false; + elsif i_customer_gw.tx_inband_dtmf_filtering_mode_id = 3 then -- enable filtering + i_profile.bleg_rtp_filter_inband_dtmf=true; end if; - endif; + end if; i_profile.rtprelay_force_dtmf_relay=i_vendor_gw.force_dtmf_relay; @@ -22323,6 +22323,12 @@ CREATE FUNCTION switch16.route(i_node_id integer, i_pop_id integer, i_protocol_i SELECT into v_orig_gw * from class4.gateways WHERE id=v_customer_auth_normalized.gateway_id; + if not v_orig_gw.enabled then + v_ret.disconnect_code_id=8005; -- Origination gateway is disabled + RETURN NEXT v_ret; + RETURN; + end if; + v_ret.resources:=''; if v_c_acc.origination_capacity is not null then v_ret.resources:=v_ret.resources||'1:'||v_c_acc.id::varchar||':'||v_c_acc.origination_capacity::varchar||':1;'; @@ -23319,6 +23325,12 @@ CREATE FUNCTION switch16.route_debug(i_node_id integer, i_pop_id integer, i_prot SELECT into v_orig_gw * from class4.gateways WHERE id=v_customer_auth_normalized.gateway_id; + if not v_orig_gw.enabled then + v_ret.disconnect_code_id=8005; -- Origination gateway is disabled + RETURN NEXT v_ret; + RETURN; + end if; + v_ret.resources:=''; if v_c_acc.origination_capacity is not null then v_ret.resources:=v_ret.resources||'1:'||v_c_acc.id::varchar||':'||v_c_acc.origination_capacity::varchar||':1;'; @@ -24287,6 +24299,12 @@ CREATE FUNCTION switch16.route_release(i_node_id integer, i_pop_id integer, i_pr SELECT into v_orig_gw * from class4.gateways WHERE id=v_customer_auth_normalized.gateway_id; + if not v_orig_gw.enabled then + v_ret.disconnect_code_id=8005; -- Origination gateway is disabled + RETURN NEXT v_ret; + RETURN; + end if; + v_ret.resources:=''; if v_c_acc.origination_capacity is not null then v_ret.resources:=v_ret.resources||'1:'||v_c_acc.id::varchar||':'||v_c_acc.origination_capacity::varchar||':1;'; @@ -33237,8 +33255,7 @@ ALTER TABLE ONLY sys.sensors -- PostgreSQL database dump complete -- -SET search_path TO gui, public, switch, billing, class4, runtime_stats, sys, logs, data_import -; +SET search_path TO gui, public, switch, billing, class4, runtime_stats, sys, logs, data_import; INSERT INTO "public"."schema_migrations" (version) VALUES ('20170822151410'),