Zach
Zach

Reputation: 13

Twilio Outbound Conference Call API callbacks

I am trying to set up a call transfer workflow using Twilio's Outbound Conference Call API. I want the flow to be as follows:

  1. Call PersonA
  2. Initiate a timer via callback when PersonA answers
  3. After introducing myself to PersonA, put them on hold and dial PersonB
  4. Talk to PersonB and let them know I'll be connecting them with PersonA
  5. Merge PersonA and PersonB call together
  6. Leave the phone call and let PersonA and PersonB continue talking.

Looking at the docs here: https://www.twilio.com/docs/api/rest/participant#list-post it appears that this should be doable with a StatusCallback. I am having some trouble getting the callback to work and was wondering if anyone has an example of setting up a call using the Outbound Conference Call API.

Currently I am trying to start the call like so (from and to are the from and to numbers):

params = {
  'From' => from,
  'To' => to,
  'EarlyMedia' => true,
  'ConferenceStatusCallbackEvent' => 'start',
  'ConferenceStatusCallback' => Rails.application.routes.url_helpers.call_twilio_conference_callback_url(@call, sid: @call.call_sid, host: DEFAULT_DOMAIN)
}

HTTParty.post("https://api.twilio.com/2010-04-01/Accounts/#{TWILIO['account_sid']}/Conferences/#{@call.browser_call_room_key}/Participants",
               body: URI.encode_www_form(params),
               basic_auth: {username: TWILIO['account_sid'], password: TWILIO['auth_token']})

When I check the twilio debugger I see:

15003 Call Progress: Error Response to Callback URL

If anyone has an example of using the Outbound Conference API and with a callback to your own endpoint that would be awesome! It is a pretty new feature and there does not seem to be much out there as far as examples of it being used.

Upvotes: 1

Views: 367

Answers (1)

philnash
philnash

Reputation: 73027

Twilio developer evangelist here.

Twilio error 15003 means that Twilio received a 4xx or 5xx response from your application. So, Twilio is making a request to your application but it can't reach it for some reason.

Are you having these problems in development because you haven't exposed your local application to Twilio? Have you tried using ngrok for example?

If you have opened up your application, are you seeing errors in your Rails log when the callback occurs?

Upvotes: 1

Related Questions