Skip to content

Instantly share code, notes, and snippets.

@kreas
Created July 29, 2016 14:19
Show Gist options
  • Save kreas/1ef561866ceff6b115fbbef474582787 to your computer and use it in GitHub Desktop.
Save kreas/1ef561866ceff6b115fbbef474582787 to your computer and use it in GitHub Desktop.
# From the rails productio console
# Set up the client connection to Twilio
client = Twilio::REST::Client.new TWILIO_SID, TWILIO_TOKEN
# Get the "main" queue, or the queue where a call is stuck.
main = Twilio::CallQueue.get_queue("main")
# You can see how many calls are in the queue by running
main.current_size
# Now, here's where it gets pretty rad.
# Loop through all of the calls in the main queue and redirect them to a twimlet.
redirect_url = "http://twimlets.com/[email protected]&Transcribe=true&Message=Please+Leave+A+Message"
main.members.list.each { |m| client.account.calls.get(m.call_sid).redirect_to(redirect_url) }
# Give that command a couple of seconds to complete and you should be good.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment