1

I have the following code which using Twilio automatically places calls from a number, to a number, which I set manually. My problem is that I need it to place calls to different numbers, from different numbers, at random.

I want the to: and from: to choose at random between a list of pre-set numbers. These numbers will change often. While I can do it manually in the code, I think ideally it would pull those values from a different file - one for to: and one for from:.

Thanks for the help.


var accountId = 'your acount sid here'
var accountToken = 'your account token here'

var client = twilio(accountId, accountToken)
var INTERVAL = 10000 // 10 seconds

var count = 0

var call = function() {
  return client.calls.create({
    url: 'https://<lin>',
    to: '+<target number>',
    from: '+1<source number>'
  }, function (err, res) {
    if (err) return console.error(err)
    count++
    console.log('number ', count, 'status: ', res.status)
  })
}

call()
setInterval(call, INTERVAL)
4

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.