Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. client.calls.create({
  2. to: "+1" + numbers[i],
  3. from: process.env.TWILIO_NUMBER,
  4. url: "https://publicly.accessable/url-of_mine",
  5. machineDetection: "Enabled",
  6. method: "GET",
  7. statusCallback: "https://another.publicly.accessible/url-of_yours?currentIndex=" + i,
  8. statusCallbackMethod: "GET"
  9. })
  10.  
  11. const params = event.queryStringParameters;
  12. if (params.CallStatus != 'completed') {
  13. let i = parseInt(params.currentIndex, 10) + 1;
  14. client.calls.create({
  15. to: "+1" + numbers[i],
  16. from: process.env.TWILIO_NUMBER,
  17. url: "https://publicly.accessable/url-of_mine",
  18. machineDetection: "Enabled"
  19. method: "GET",
  20. statusCallback: "https://another.publicly.accessible/url-of_yours?currentIndex=" + i,
  21. statusCallbackMethod: "GET"
  22. })
  23. }
  24. return Response('')
  25.  
  26. const params = event.queryStringParameters;
  27. if (params.AnsweredBy == "machine_start") {
  28. let xml = `
  29. <?xml version="1.0" encoding="UTF-8"?>
  30. <Response>
  31. <Hangup/>
  32. </Response>`
  33.  
  34. client.calls.create( callParameters )
  35.  
  36. return Response(xml, mimetype = 'text/xml')
  37. } else{ .. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement