【问题标题】:Twillio outbount user creationTwilio 出站用户创建
【发布时间】:2017-08-11 05:49:05
【问题描述】:

我需要将用户添加为出站呼叫者 ID。通过使用以下代码

const accountSid = 'ACeae3abf5038c91052c27aa2a04969457';
const authToken = 'AUTH_TOKEN';
const client = require('twilio')(accountSid, authToken);

client.outgoingCallerIds
.create({
friendlyName: '918606488880',
phoneNumber: '+919020044692',
})
.then((callerId) => process.stdout.write(callerId.sid));

然后我收到以下错误消息,例如

 .create({
 ^
TypeError: client.outgoingCallerIds.create is not a function
at Object.<anonymous> (/home/jose/test/twillio/callerid.js:6:4)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:505:3

以上代码来源于twilliotwilio的文档

实际上我的要求是向不同的用户发送语音呼叫。所以我需要将用户添加到我的出站呼叫者 ID 中。

【问题讨论】:

  • 您使用的是哪个版本的 Twilio Node 模块?
  • 节点版本 6.9.4
  • Twilio npm 模块的版本是多少?

标签: twilio twilio-api


【解决方案1】:

看起来很可能,特别是如果您执行新的npm install twilio,您将安装最新的 3.x 版本的node helper library。您在上面链接到的页面仍默认为 2.x 版本代码。可以点击沙箱右上角的3.x找到:

client.api.accounts(accountSid)
  .outgoingCallerIds('OutgoingCallerIdSid')
  .fetch()
  .then((callerId) => console.log(callerId.phoneNumber));

【讨论】:

  • 更新节点版本一切正常。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-09-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-02
  • 1970-01-01
相关资源
最近更新 更多