<commit_before>var voicejs = require('../voice.js');

var client = new voicejs.Client({
	email: '<EMAIL>',
	password: 'password',
	tokens: require('./tokens.json')
});


// Connect to 18005551212 using one your GV forwarding phone 1234567890
client.connect({ to: '18005551212', from: '1234567890'}, function(err, res, data){
	if(err){
		return console.log(err);
	}
	console.log('Calling you.');
	
	//cancel the call after 10 seconds
	setTimeout(function(){
		client.comm('cancel', function(error, response, data){
			return error ? console.log(error) : console.log('Call cancelled.');
		})
	}, 10000);
});


// Connect to 18005551212 using Google Talk
client.connect({ to: '18005551212', from: '<EMAIL>' }, function(err, res, data){
	if(err){
		return console.log(err);
	}
	console.log('Calling you.');
	
	//cancel the call after 10 seconds
	setTimeout(function(){
		client.comm('cancel', function(error, response, data){
			return error ? console.log(error) : console.log('Call cancelled.');
		})
	}, 10000);
});


// Connect to 18005551212 using your GV forwarding phone 1234567890 and 
// a special access number that will dial directly to your outgoing number
// Note this does not appear to work with Google Talk forwarding numbers
client.call({ to: '18005551212', from: '1234567890'}, function(err, res, data){
	if(err){
		return console.log(err);
	}
	console.log('Call confirmed. Use the forwarding phone to dial', data.call_through_response.access_number);
});<commit_msg>updated call example to use convenience .cancel method<commit_after>var voicejs = require('../voice.js');

var client = new voicejs.Client({
	email: '<EMAIL>',
	password: 'password',
	tokens: require('./tokens.json')
});


// Connect to 18005551212 using your GV forwarding phone 1234567890
client.connect({ to: '18005551212', from: '1234567890'}, function(err, res, data){
	if(err){
		return console.log(err);
	}
	console.log('Calling you.');
	
	//cancel the call after 10 seconds
	setTimeout(function(){
		client.cancel(function(error, response, data){
			return error ? console.log(error) : console.log('Call cancelled.');
		})
	}, 10000);
});


// Connect to 18005551212 using Google Talk
client.connect({ to: '18005551212', from: '<EMAIL>' }, function(err, res, data){
	if(err){
		return console.log(err);
	}
	console.log('Calling you.');
	
	//cancel the call after 10 seconds
	setTimeout(function(){
		client.cancel(function(error, response, data){
			return error ? console.log(error) : console.log('Call cancelled.');
		})
	}, 10000);
});


// Connect to 18005551212 using your GV forwarding phone 1234567890 and 
// a special access number that will dial directly to your outgoing number.
// Note this does not appear to work with Google Talk forwarding numbers
client.call({ to: '18005551212', from: '1234567890'}, function(err, res, data){
	if(err){
		return console.log(err);
	}
	console.log('Call confirmed. Use the forwarding phone 1234567890 to dial', data.call_through_response.access_number);
});
{'fraction_non_alphanumeric': 0.14968259271633813, 'fraction_numerical': 0.0835282325425994, 'mean_word_length': 4.692015209125476, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6369284', 'n_tokens_mistral': 1132, 'n_tokens_neox': 910, 'n_words': 291}