FutoRicky FutoRicky - 1 year ago 153
Ruby Question

Twilio Say when putting conference on hold

I am able to put the conference call on hold, but I would like Twilio to say something like 'This call has been put on hold' to all participants before the music starts playing.

I've been trying to do something like this, but it's not working:

response = Twilio::TwiML::Response.new do |r|

# Loop over participants and print out a property for each one
@client.account.conferences.get(@conference_sid).participants.list.each do |participant|
participant.update(:hold => false) if !params[:hold]
if params[:hold]
participant.update(:hold => true)
r.Say 'This call has been put on hold.'

Anyone know how to achieve this? Thanks.

Answer Source

I'm not a Ruby developer but I'm a expert.

Besides the Hold attribute, you should update the HoldUrl attribute to

  • Say that the call is being put on hold
  • Redirect to the default Twilio Hold Music (or create your own file)

The HoldUrl twiml will look like the following.

<?xml version="1.0" encoding="UTF-8"?>
    <Say>This call has been put on hold</Say>

Reference : Twilio documentation

The 'HoldUrl' attribute lets you specify a URL for music that plays when a participant is held. The URL may be an MP3, a WAV or a TwiML document that uses Play, Say or Redirect.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download