def build_response(from, commands) | |
response = Plivo::Response.new | |
commands.map do |c| | |
case c[:cmd] | |
when :reject | |
response.addHangup(reason: 'busy') | |
when :ivr | |
response.addHangup(reason: 'busy') | |
dial = response.addDial(callerId: from) | |
dial.addNumber(c[:to]) | |
digit = response.addGetDigits(action: '/', method: 'GET', redirect: false) | |
digit.addSpeak("#{c[:text]}") | |
response.addSpeak('No input received') | |
when :record | |
response.addSpeak("#{c[:promt]}") | |
response.addRecord(action: "#{c[:voicemail].plivo_callback}", callbackUrl: "#{c[:voicemail].plivo_callback}") | |
end | |
end | |
p response | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment