Skip to content

Instantly share code, notes, and snippets.

@willawill
Created January 15, 2013 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willawill/4543312 to your computer and use it in GitHub Desktop.
Save willawill/4543312 to your computer and use it in GitHub Desktop.
post '/ivrs/:id/trigger' do
p "here #{params}"
parameters = {to: params[:To],
from: params[:From],
answer_url: "#{ENV['SERVER_NAME']}/ivrs/#{params[:id]}/play",
}
res = Plivo::RestAPI.new("#{ENV['PLIVO_AUTH_ID']}", "#{ENV['PLIVO_AUTH_TOKEN']}").make_call(parameters)
end
post '/ivrs/:id/play' do
campaign = Campaign.get(params[:id])
response = Plivo::Response.new
digit = response.addGetDigits(action: "/ivrs/#{params[:id]}/collect_digit", method: 'POST', redirect: false)
digit.addSpeak("#{campaign.ivrs.last.read_text}")
response.addSpeak('No input received')
p response.to_xml()
end
post "/ivrs/:id/collect_digit" do
p params
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment