2017-07-01 37 views
1

我知道这是一个完整的n00b问题,但我很难过。twilio节点语音输出快速启动失败默默

我已经创建了一个帐户并将节点快速启动代码剪切/粘贴到make_call.js文件中。我已经输入了我的帐户信息和正确的(我的twilio号码)和(我家)的电话号码。

当我通过'节点make_call.js'运行有轻微的暂停,然后shell提示符,没有输出,没有电话。

如果我修改帐户字段,以便他们是错误的,无论是哪一种,我得到相同的结果,因此它似乎代码没有与twilio服务器进行通信?

关于如何弄清楚发生了什么的任何指针?

这是我的代码,从字面上复制/粘贴4个字段的示例更改。

// Download the Node helper library from twilio.com/docs/node/install 
// These consts are your accountSid and authToken from twilio.com/user/account 
const accountSid = 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; 
const authToken = '0bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; 
const Twilio = require('twilio'); 
const client = new Twilio(accountSid, authToken); 

client.api.calls 
    .create({ 
    url: 'http://demo.twilio.com/docs/voice.xml', 
    to: '+1212xxxxxxx', 
    from: '+1929xxxxxxx', 
    }) 
    .then((call) => console.log(call.sid)); 

回答

0

看起来像快速入门指南和节点的REST API文档是不同的。如果您尝试使用REST docs的出站呼叫的代码,会发生什么情况?

// Download the Node helper library from twilio.com/docs/node/install 
// These identifiers are your accountSid and authToken from 
// https://www.twilio.com/console 
const accountSid = 'accountSid'; 
const authToken = 'your_auth_token'; 
const client = require('twilio')(accountSid, authToken); 

client.calls.create({ 
    url: 'http://demo.twilio.com/docs/voice.xml', 
    to: '+14155551212', 
    from: '+15017250604', 
}) 
.then((call) => process.stdout.write(call.sid)); 
+0

不确切地说,这个代码块和我发布的代码块之间有什么不同,不过我仍然尝试过。剪下并粘贴我的acct和电话号码。同样的结果,运行一两秒钟,然后静静地退回到shell。没有电话,没有输出。我很想弄清楚如何在那里粘贴一些代码,看看它在做什么 – jdkullmann

0

我不知道为什么这个代码不工作,静静昨天没有,但我只是跑的(不变)代码今天再次和它的工作(和输出的SID底。)