2017-08-11 7 views
2

発信発信者IDとしてユーザーを追加する必要があります。Twillio outbount user creation

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 

のように上記のコードはActualy私の要件は、音声通話を送信することですtwillio twilio

の文書から得ている取得しますユーザーを絞り込むだから、私の発信者IDにユーザーを追加する必要があります。

+0

使用しているTwilioノードモジュールのバージョンはどれですか? – philnash

+0

ノードバージョン6.9.4 – jjamt

+0

Twilio npmモジュールのバージョンは何ですか? – philnash

答えて

2

最新の3.xバージョンのnode helper libraryをインストールした場合は、新鮮なnpm install twilioを実行した場合は特にそうです。上記にリンクしたページのデフォルトは2.xのバージョンコードです。サンドボックスの右上にある3.xをクリックすると、次のページが表示されます。

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

ノードのバージョンを更新するとすべてうまく動作します。 – jjamt