Skip to content

Instantly share code, notes, and snippets.

@TomckySan
Created May 20, 2014 14:21
Show Gist options
  • Save TomckySan/9933f1d58ccb96097d48 to your computer and use it in GitHub Desktop.
Save TomckySan/9933f1d58ccb96097d48 to your computer and use it in GitHub Desktop.
twilio-nodeでワン切りするサンプルコード
// twilio-node sample code "One-ring Call"
var twilio = require('twilio');
var client = twilio('1234567890', '0987654321');
client.calls.create({
to: '+81xxxxxxxxxx',
from: '+81zzzzzzzzzz',
url: 'http://twilio-sample.com'
}, function (err, call) {
if(err) {
console.log(err);
throw err;
}
setTimeout(function() {
client.calls(call.sid).update({
status: 'canceled'
}, function(err, call) {
console.log(call.direction);
});
}, 6000);
console.log('calling!!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment