Sha256: 631f61dccbd0d3853fbb532230abfa8980f4e5fd93dba522cc21420293032e32
Contents?: true
Size: 954 Bytes
Versions: 2
Compression:
Stored size: 954 Bytes
Contents
# frozen_string_literal: true module TwilioBase module Responses module Twiml def dial_twiml(params: {}) hangup = params[:hangup].present? ? '<Hangup/>' : '' protocol = params[:protocol].to_s.titleize play_urls = Array(params[:play_urls]).map do |play| "<Play>#{play}</Play>\n" end.join('') "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \ "\n<Response>\n" \ "#{play_urls}" \ "#{hangup}" \ "<Dial action=\"#{CGI.escapeHTML(params[:action_url])}\" "\ "callerId=\"#{params[:caller_id]}\">" \ "\n<#{protocol} " \ "statusCallback=\"#{params[:status_callback_url]}\" " \ "statusCallbackEvent=\"#{params[:status_callback_events]}\">" \ "#{params[:endpoint]}" \ "</#{protocol}>" \ "\n</Dial>\n" \ "</Response>\n" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twilio_base-1.9.0 | spec/support/twilio_base/responses/twiml.rb |
twilio_base-1.8.0 | spec/support/twilio_base/responses/twiml.rb |