Last active
August 3, 2016 15:24
-
-
Save bertolo1988/199325baeabdc5df17f8138874b8fc9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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