3

I'm trying to have the ability to update a call to dial it into a conference, and then I want to keep track of which phone numbers are in the conference. I'll already have the phone number before updating the call, so my plan was to add it as parameter to the statusCallback, then when someone joins, I'll know which phone number has joined (or left). Here is the Twiml I'm using to update the call into the conference.

let conferenceTwiml = function(conferenceName, phoneNumber) {
    let voiceResponse = new VoiceResponse();
    let options = {
        startConferenceOnEnter: true,
        endConferenceOnExit: false,
        waitUrl: <myWaitUrl>,
        statusCallbackEvent: "join leave",
        statusCallback: <myStatusCallBackUrl> + '?phoneNumber=' + phoneNumber,
        statusCallbackMethod:"POST",
    };

    voiceResponse.dial().conference(options, conferenceName);

    return voiceResponse.toString();
}

The body sent to the statusCallback looks like this:

{
    Coaching: 'false',
    FriendlyName: 'Room 123',
    SequenceNumber: '4',
    ConferenceSid: 'CF1c7a162ba5d0587f390a0d7e7c6eb9a5',
    EndConferenceOnExit: 'false',
    CallSid: 'CA5244195567afec7327bb24d65a2d2b15',
    StatusCallbackEvent: 'participant-join',
    Timestamp: 'Wed, 17 Jul 2019 18:18:27 +0000',
    StartConferenceOnEnter: 'true',
    Hold: 'false',
    AccountSid: <myAccountSid>,
    Muted: 'false' 
}

So you can see there's not really any identifying information, without the additional query parameter.

The problem I've run into is that, according to the docs:

The statusCallback URL is set by the first Participant to join the conference, subsequent statusCallbacks will be ignored.

So in essence I can't dynamically set the phoneNumber parameter for each person I'm dialing into the conference, since it will always reflect the phoneNumber of the first person who joined.

My question is, how can I get some kind of identifying information about who is joining or leaving the conference? Where are my twilio evangelists at? Thanks!

digglemister
  • 1,477
  • 3
  • 16
  • 31

1 Answers1

2

Heyooo Developer Evangelist here.

There are two ways to approach this.

1. Persist the call information via CallSid yourself

When you receive the initial phone call and you put people into the conference, what you could do it to persist the call information (including the phone number) on your end and use the CallSid later to reference it when you receive the statusCallback hook. This way you would have all the information at hand using the available CallSid when the statusCallback hook comes in.

2. Fetch the call information when you receive the statusCallback

While the statusCallback hook doesn't include the call details what you can always do is to fetch the call information again by using the CallSid. This way you can take the information from StatusCallbackEvent and merge it with additional information after you received the call details.


Both approaches have pros and cons but are similar in the way that you have to get the call information from "somewhere".

The first approach needs you to find a way to persist call information. This brings additional overhead in your application.

The second approach saves you the need to persist call details but introduces an additional API request.

As always – it depends on your case. I hope that helps. :)

stefan judis
  • 3,416
  • 14
  • 22