<commit_before>#Class that pulls from a database table to generate a dialing list, then dials
class Robodialer
  def self.fetch_customers
    customers = Customer.find(:all, :conditions => ["status = ?", "TODIAL"])
    return customers
  end
  
  def self.dial_customer(phone_number)
    #Need to figure out the correct value here
    channel = $HELPERS["robodialer"]["channel"] + phone_number
    response = PBX.rami_client.originate({'Channel' => channel,
                                          'Context' =>  $HELPERS["robodialer"]["context"],
                                          'Exten' =>  $HELPERS["robodialer"]["extension"],
                                          'Priority' => $HELPERS["robodialer"]["priority"],
                                          'CallerID' => $HELPERS["robodialer"]["callerid"],
                                          'ActionID' => $HELPERS["robodialer"]["actionid"],
                                          'Timeout' => $HELPERS["robodialer"]["timeout"],
					                                'Async' => $HELPERS["robodialer"]["async"]})
    return response
  end
  
  def self.update_customer
    log 'Update record'
  end
  
  customers = self.fetch_customers

  customers.each do |customer|
    log 'Dialing: ' + customer.inspect
    response = self.dial_customer customer.phone<commit_msg>Changed comment to reflect IAX2 dialing<commit_after>#Class that pulls from a database table to generate a dialing list, then dials
class Robodialer
  def self.fetch_customers
    customers = Customer.find(:all, :conditions => ["status = ?", "TODIAL"])
    return customers
  end
  
  def self.dial_customer(phone_number)
    #Currently set to dial via IAX2
    channel = $HELPERS["robodialer"]["channel"] + phone_number
    response = PBX.rami_client.originate({'Channel' => channel,
                                          'Context' =>  $HELPERS["robodialer"]["context"],
                                          'Exten' =>  $HELPERS["robodialer"]["extension"],
                                          'Priority' => $HELPERS["robodialer"]["priority"],
                                          'CallerID' => $HELPERS["robodialer"]["callerid"],
                                          'ActionID' => $HELPERS["robodialer"]["actionid"],
                                          'Timeout' => $HELPERS["robodialer"]["timeout"],
					                                'Async' => $HELPERS["robodialer"]["async"]})
    return response
  end
  
  def self.update_customer
    log 'Update record'
  end
  
  customers = self.fetch_customers

  customers.each do |customer|
    log 'Dialing: ' + customer.inspect
    response = self.dial_customer customer.phone
{'fraction_non_alphanumeric': 0.12143650499814883, 'fraction_numerical': 0.0007404664938911515, 'mean_word_length': 1.9369565217391305, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3703197', 'n_tokens_mistral': 732, 'n_tokens_neox': 728, 'n_words': 154}