In order to make a call from our application in
Nodejs, we can use TwilioAPI for doing so. We need to create an account on
Twilio and specify details. Once we have done that we can use the following
code:
// Twilio
Credentials
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);
client.calls.create({
url: "http://demo.twilio.com/docs/voice.xml",
to: "+1XXXXXXXXXX",
from: "+1XXXXXXXXX"
}, function(err, call) {
process.stdout.write(call.sid);
});
We need to specify to and from numbers. To is
the number that is verified under Twilio account and from is
the number that Twilio generates for you at the account setup. Also url is the property that we need to
setup so as to pick up the voice information.
Comments