<commit_before>'use strict';

// var config = require('../config');
// var twilio = require('twilio');
// var client = twilio(config.accountSid, config.authToken);
var fallbackCall = require('../lib/fallBackCall');

module.exports = function(app) {
  app.post('/StatusCallBack/:firstName/:lastName/:phoneNumber', function(req, res) {
    console.log('call status is: ' + req.body.CallStatus);
    if (req.body.CallStatus ===  'no-answer') {
      console.log('first call failed, time to try again.');
      res.type('text/xml');
      res.render('hangupMachine');
      fallbackCall.makeCall(req.params.firstName, req.params.lastName, req.params.phoneNumber);
    }
    console.log('call status is!: ' + req.body.CallStatus);
  });
};<commit_msg>call status wip<commit_after>'use strict';

// var config = require('../config');
// var twilio = require('twilio');
// var client = twilio(config.accountSid, config.authToken);
var fallbackCall = require('../lib/fallBackCall');

module.exports = function(app) {
  app.post('/StatusCallBack/:firstName/:lastName/:phoneNumber', function(req, res) {
    console.log('call status is: ' + req.body.CallStatus);
    console.log('call answered by: ' + req.body.AnsweredBy);
    if (req.body.CallStatus ===  'no-answer' || req.body.CallStatus === 'busy' || req.body.CallStatus === 'failed' || req.body.AnsweredBy === 'machine') {
      console.log('first call failed, time to try again.');
      res.type('text/xml');
      res.render('hangupMachine');
      fallbackCall.makeCall(req.params.firstName, req.params.lastName, req.params.phoneNumber);
    }
    console.log('call status is!: ' + req.body.CallStatus);
  });
};
{'fraction_non_alphanumeric': 0.18592057761732853, 'fraction_numerical': 0.0, 'mean_word_length': 3.9790419161676644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3069226', 'n_tokens_mistral': 528, 'n_tokens_neox': 535, 'n_words': 98}