0

how to make outbound calls with node.js

Hi,

So I've read the tutorial on how to make calls for nodejs.  The part that I'm confused about is:

"To then launch the code, Tropo provides you with a URL to hit, which tells Tropo to launch your application. You also get a secret API key called a “token” that ensures only you can start your code (we recommend guarding the token like you would a password, or that exclusive ability could be jeopardized). Your token is found just under the phone numbers when you view your application in the Tropo User Interface:"

My question is where in my nodejs code do I use the "token" code to start a session with Tropo in order to make an outbound call.  Here's a portion of my code for the Tropo call script:

 

socket.on('init phone', function (val) {

sess.reload(function () {

sess.phonenumber = val;

var codelength = 4; //# of digits in the verification code

sess.verify = Math.floor(Math.random() * (Math.pow(10, (codelength - 1)) * 9)) + Math.pow(10, (codelength - 1));

sess.touch().save();

socket.emit('newcode', sess.verify);

var tropo = new TropoWebAPI();

tropo.call('+1' + sess.phonenumber);

tropo.say("Welcome to test. A quest has been made to register your phone.");

// Demonstrates how to use the base Tropo action classes.

var say = new Say("Please either say approved or key in one to approve the registration");

var choices = new Choices('approved');

});

});

9 comments

Please sign in to leave a comment.