diff --git a/index.js b/index.js index 5db5e78..cce366d 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,7 @@ app.get('/', (req, res) => { app.post('/voice', (req, res) => { // Generate a TwiML response - let twiml = new twilio.TwimlResponse(); + let twiml = new twilio.twiml.VoiceResponse(); // Talk in a robot voice over the phone. twiml.say('Call progress events are rad'); @@ -47,10 +47,10 @@ app.post('/voice', (req, res) => { }); app.post('/events', (req, res) => { - let to = req.body.To; - let fromNumber = req.body.From; + let to = req.body.to; + let fromNumber = req.body.from; let callStatus = req.body.CallStatus; - let callSid = req.body.CallSid; + let callSid = req.body.callSid; console.log(fromNumber) io.emit('status update', { to, fromNumber, callStatus, callSid }); diff --git a/makeCall.js b/makeCall.js index d722bba..f9e4476 100644 --- a/makeCall.js +++ b/makeCall.js @@ -1,9 +1,9 @@ "use strict"; const twilio = require('twilio'); -const client = twilio(); +const client = new twilio(); -client.makeCall({ +client.calls.create({ url: '', to: '', from: '', diff --git a/package.json b/package.json index d9ca7c8..e086494 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "react": "^0.14.0", "react-dom": "^0.14.0", "socket.io": "^1.3.6", - "twilio": "^2.3.0" + "twilio": "^3.6.1" }, "devDependencies": { "babel-core": "^6.0.12",