node.js - how to connect two anonymous callers together using twilio -
i doing using node js twilio module functionality in project working on client. server going initiate phone call using twilio api phone call person connect him person b. new twilio still noob, code have written far. please need u guys input on how accomplish this. cheers
var client = require('twilio')(twilio_account_sid, twilio_auth_token); exports.makecall = function(calldetails, cb) { client.makecall({ to:'+16515556677', // number twilio can phone call from: twilio_caller_id, url: 'https://demo.twilio.com/welcome/voice' // url produces xml document (twiml) contains instructions phone call }, function(err, responsedata) { //executed when phone call has been initiated. console.log(responsedata.from); // outputs "+14506667788" var resp = new client.twimlresponse(); resp.say('welcome acme client service!') .gather({ action:'http://www.example.com/callfinished.php', finishonkey:'*' }, function() { this.say('press 1 client service') .say('press 2 british client service', { language:'en-gb' }); }); }); };
twilio developer evangelist here.
you're part way there this, don't want creating twiml response in callback phone call client.makecall
. responsedata
there representation of phone call in twilio's system.
what need provide url makecall
function hosts twiml connects phone call phone number. have demo url in place, you'll need point url own.
there's in depth tutorial on how accomplish of on twilio site might find helps out. you can find tutorial here, give go , allow me know if helps.
node.js twilio twilio-click-to-call
No comments:
Post a Comment