I'm trying to add the option of adding a spoken message before a prerecorded message plays in my outbound calls. The closest question of this this type I could find was this Does Twilio Ruby Gem Take Other Params
I currently have a form where you enter the number you want to call and field for the message you'd like to
<form action="calls" method="post">
<input type="text" name="number" placeholder="number e.g. 2124095555" />
<input type="text" name="message" placeholder="add a message" />
<input type="submit" value="Roll em!">
</form>
In my call's controller I have:
def create
data = {
:from => CALLER_ID,
:to => params['number'],
:say => params['message'],
:url => 'http://howenstine.co/rick_roll.mp3',
:if_machine => 'Continue'
}
begin
client = Twilio::REST::Client.new(ACCOUNT_SID, ACCOUNT_TOKEN)
client.account.calls.create(data)
rescue StandardError => bang
redirect_to :action => '.', 'msg' => "Error #{bang}"
return
end
redirect_to root_path
end
Obviously the :say param is not working. I've something like this for inbound calls, but I don't believe that will work for an outbound call
def voice
response = Twilio::TwiML::Response.new do |r|
r.Say 'fooo bar', :voice => 'alice'
r.Play 'http://linode.rabasa.com/cantina.mp3'
end
render_twiml response
end
Any help or guidance would be greatly appreciated.