Search code examples
twiliotwilio-api

How to handle issue with connecting participants in a twilio conference?


Generally when I do direct call via <Dial><Number> Twiml, I used to listen the ringing and network message if the caller is busy or not answering or switched off. Maybe that's because I had used answerOnBridge=true?

Now I am starting a call from web client, putting myself in a conference, then creates a REST call to the caller. At that time, I only get to listen the wait music of the conference since I am alone in the conference. Nothing happens when the caller doesn't pickup or hang up without answering, it just keeps playing the music. I am using REST call with url to link the conference but that only happens when the user picks up.

  return client.calls
    .create({
      from: from,
      to: to,
      url: callbackUrl,
      statusCallback: 'https://xx.m.pipedream.net/',
      statusCallbackEvent: ['initiated',
        'ringing', 'answered',
        'completed']
    });

I know I can use the statusCallback to get the status and broadcast a message probably, but is there any other way to make this feel more natural and get the real network message that we usually get when we call via cellphone? Thanks!

Note: I have intention to add or transfer to users, so I need to use conference.


Solution

  • Don't use the /Call resource, use the conference participants end-point (Create A Participant) to be able to listen to the call progress tones (earlyMedia).

    enter image description here