Skip to content

Instantly share code, notes, and snippets.

@bertolo1988
Last active August 3, 2016 15:24
Show Gist options
  • Save bertolo1988/199325baeabdc5df17f8138874b8fc9d to your computer and use it in GitHub Desktop.
Save bertolo1988/199325baeabdc5df17f8138874b8fc9d to your computer and use it in GitHub Desktop.
app.get('/voice', function(req, res) {
var resp = new twilio.TwimlResponse();
res.writeHead(200, {
'Content-Type': 'text/xml'
});
var phone = req.query.phone;
var userName = req.query.user;
if (phone != null) {
resp.dial({ callerId: config.CLIENT_NAME }, () => {
this.number(phone);
});
console.log("Dialing " + str);
} else if (userName != null) {
resp.dial({ callerId: config.CLIENT_NAME }, () => {
this.client(phone);
});
} else {
resp.say('Wrong arguments! Try adding a phone or a user to your query string!', {
voice: 'woman',
language: 'en-gb'
});
console.log('Wrong arguments!');
}
res.end(resp.toString());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment