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

config to control the behavior of the CallsMonitoring job #1527

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

Ivanov-Anton
Copy link
Collaborator

@Ivanov-Anton Ivanov-Anton commented Aug 9, 2024

Description

add config to control the behavior of the CallsMonitoring job

introduces new configuration options in yeti_web.yml to control
the behavior of the CallsMonitoring job when dealing with
disabled customer authentication and both origination/termination gateways:

- calls_monitoring.teardown_on_disabled_customer_auth
- calls_monitoring.teardown_on_disabled_term_gw
- calls_monitoring.teardown_on_disabled_orig_gw

The CallsMonitoring class has been updated to use these
configurations in the relevant methods. If the configs
are not present, the current flow should not be changed.

Additional links

closes #1526

@Ivanov-Anton Ivanov-Anton marked this pull request as draft August 9, 2024 14:57
@Ivanov-Anton Ivanov-Anton force-pushed the 1526-CallsMonitoring-teardown-rules branch from e1067f2 to c98a95d Compare August 9, 2024 18:55
@Ivanov-Anton Ivanov-Anton self-assigned this Aug 9, 2024
@Ivanov-Anton Ivanov-Anton added the JSON RPC tasks related to JSON RPC calls label Aug 9, 2024
@Ivanov-Anton Ivanov-Anton force-pushed the 1526-CallsMonitoring-teardown-rules branch 4 times, most recently from be8f6e7 to 7a2d9cd Compare August 10, 2024 08:19
@Ivanov-Anton Ivanov-Anton marked this pull request as ready for review August 10, 2024 08:22
@Ivanov-Anton Ivanov-Anton added the Waiting for code review It means that the owner or member of the repositor can do a code review. label Aug 10, 2024
@Ivanov-Anton
Copy link
Collaborator Author

@dmitry-sinina this PR is ready to code review

@Ivanov-Anton Ivanov-Anton removed the request for review from dmitry-sinina August 13, 2024 14:35
@Ivanov-Anton Ivanov-Anton force-pushed the 1526-CallsMonitoring-teardown-rules branch 2 times, most recently from 689c997 to f1778a9 Compare August 14, 2024 05:10
@Ivanov-Anton Ivanov-Anton removed the Waiting for code review It means that the owner or member of the repositor can do a code review. label Aug 14, 2024
@Ivanov-Anton
Copy link
Collaborator Author

@dmitry-sinina this PR is ready to code review

if disabled_orig_gw_active_calls.key?(call[:orig_gw_id])
terminate_calls_for_disabled_orig_gw(call)
elsif disabled_term_gw_active_calls.key?(call[:term_gw_id])
terminate_calls_for_disabled_term_gw(call)
end
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think better would be to split detect_gateway_calls_to_reject into 2 methods: detect_orig_gateway_calls_to_reject and detect_term_gateway_calls_to_reject and use same approach that was used in detect_customers_auth_calls_to_reject

P.S. also please refactor adding calls to @terminate_calls, they all should use terminate_calls method

    def detect_orig_gateway_calls_to_reject
      return unless teardown_enabled?(:teardown_on_disabled_orig_gw)

      calls_to_terminate = flatten_calls.select do |call|
        disabled_orig_gw_active_calls.key?(call[:orig_gw_id])
      end
      terminate_calls(calls_to_terminate)
    end

    def detect_term_gateway_calls_to_reject
      return unless teardown_enabled?(:teardown_on_disabled_term_gw)

      # same
    end

    def terminate_calls(calls)
      @terminate_calls.merge!(calls.index_by { |c| c[:local_tag] })
    end

@Ivanov-Anton Ivanov-Anton force-pushed the 1526-CallsMonitoring-teardown-rules branch 2 times, most recently from 0fc61bf to 5edfe3c Compare August 19, 2024 10:57
@Ivanov-Anton
Copy link
Collaborator Author

Ivanov-Anton commented Aug 19, 2024

@senid231 just appliyed your last suggestion.

@Ivanov-Anton Ivanov-Anton added the Waiting for code review It means that the owner or member of the repositor can do a code review. label Aug 22, 2024
@dmitry-sinina
Copy link
Contributor

new config variables should be described there:

https://github.com/yeti-switch/yeti-web/blob/master/config/initializers/_config.rb#L25

introduces new configuration options in yeti_web.yml to control
the behavior of the CallsMonitoring job when dealing with
disabled customer authentication and both origination/termination gateways:

- calls_monitoring.teardown_on_disabled_customer_auth
- calls_monitoring.teardown_on_disabled_term_gw
- calls_monitoring.teardown_on_disabled_orig_gw

The CallsMonitoring class has been updated to use these
configurations in the relevant methods. If the configs
are not present, the current flow should not be changed.
@Ivanov-Anton Ivanov-Anton force-pushed the 1526-CallsMonitoring-teardown-rules branch from 5edfe3c to 31cb475 Compare September 3, 2024 14:44
@Ivanov-Anton
Copy link
Collaborator Author

just appliyed your last suggestion

@dmitry-sinina dmitry-sinina merged commit 3be8897 into master Sep 3, 2024
11 of 12 checks passed
@Ivanov-Anton Ivanov-Anton deleted the 1526-CallsMonitoring-teardown-rules branch September 3, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON RPC tasks related to JSON RPC calls Waiting for code review It means that the owner or member of the repositor can do a code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CallsMonitoring teardown rules
3 participants