<commit_before>class DialEvent < Struct.new(:call_id, :from, :to, :reason)

  def handle_message
    publish_to_agents
  end


  def publish_to_agents
    AmqpManager.push_publish(
      user_ids: online_user_ids, data: self.to_json
    )
  end


  def related_agent_ids
    User.where(name: related_agent_names).pluck(:id)
  end


  def related_agent_names
    [from, to].map { |num|
      num[%r{SIP/(\d\d\d)(\D|$)}, 1]
    }.uniq.compact
  end


  def online_user_ids
    User.all_online_ids & related_agent_ids
  end
end<commit_msg>wrap dial events for ember<commit_after>class DialEvent < Struct.new(:call_id, :from, :to, :reason)

  def handle_message
    publish_to_agents
  end


  def publish_to_agents
    AmqpManager.push_publish(
      user_ids: online_user_ids, data: {dialevent: self}.to_json
    )
  end


  def related_agent_ids
    User.where(name: related_agent_names).pluck(:id)
  end


  def related_agent_names
    [from, to].map { |num|
      num[%r{SIP/(\d\d\d)(\D|$)}, 1]
    }.uniq.compact
  end


  def online_user_ids
    User.all_online_ids & related_agent_ids
  end
end
{'fraction_non_alphanumeric': 0.10837887067395265, 'fraction_numerical': 0.0018214936247723133, 'mean_word_length': 3.326771653543307, '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': '4298396', 'n_tokens_mistral': 441, 'n_tokens_neox': 409, 'n_words': 80}