<commit_before># encoding: utf-8

module Punchblock
  module Translator
    class Asterisk
      module Component
        module Asterisk
          class AGICommand < Component
            def setup
              @agi = Punchblock::Translator::Asterisk::AGICommand.new id, @call.channel, @component_node.name, *@component_node.params_array
            end

            def execute
              @agi.execute ami_client
              send_ref
            rescue RubyAMI::Error
              set_node_response false
              terminate
            end

            def handle_ami_event(event)<commit_msg>[BUGFIX] Ensure we process AGI responses and send a ref before processing any complete events<commit_after># encoding: utf-8

module Punchblock
  module Translator
    class Asterisk
      module Component
        module Asterisk
          class AGICommand < Component
            def setup
              @agi = Punchblock::Translator::Asterisk::AGICommand.new id, @call.channel, @component_node.name, *@component_node.params_array
            end

            def execute
              @agi.execute ami_client
              send_ref
            rescue RubyAMI::Error
              set_node_response false
              terminate
            end
            exclusive :execute

            def handle_ami_event(event)
{'fraction_non_alphanumeric': 0.050642479213907785, 'fraction_numerical': 0.0015117157974300832, 'mean_word_length': 1.8230277185501067, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4556041', 'n_tokens_mistral': 338, 'n_tokens_neox': 334, 'n_words': 91}