Reputation: 435
I need to add user as a outbound caller ID. By using the following code
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));
Then I get the following error message like
.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
The above code is got from the documentation of twillio twilio
Actualy my requirement is to send voice calls to defferent users. So I need to add the users in to my outbound caller ID's.
Upvotes: 3
Views: 87
Reputation: 3811
It seems likely, especially if you did a fresh npm install twilio
that you would have installed the latest 3.x version of the node helper library. The page you linked to above still defaults to 2.x version code. You can click 3.x in the upper right of the sandbox to find:
client.api.accounts(accountSid)
.outgoingCallerIds('OutgoingCallerIdSid')
.fetch()
.then((callerId) => console.log(callerId.phoneNumber));
Upvotes: 2