Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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