1

I am using Twilio to set up conference calls. I need to make an announcement (play an MP3 file) in the conference but it appears the $twilio->conferences("CFxxxxxxx")->update requires the ConferenceSid (I would prefer to use the FriendlyName, but that doesn't work).

So, I added statusCallback to get the ConferenceSid at the start of the conference but it isn't sending a request. I'm guessing the fix is easy, but i can't figure out what it is.


$twilio = new Client($sid, $token);

$participant = $twilio->conferences("myFriendlyName",
    array(
        "statusCallbackEvent"=>"initiated",
        "statusCallback"=>"https://example.com/wp-json/rec/v1/myroute/",
        "statusCallbackMethod"=>"POST"))
    ->participants
    ->create(
        "+15555555", 
        $participantphone,
                array(
                   "record" => True,
                   "endConferenceOnExit" => False,
                   "recordingStatusCallbackEvent" => array("completed"),
                   "RecordingStatusCallback" => "https://example.com/wp-json/rec/v1/myroute/")
);

I receive RecordingStatusCallback, but not the statusCallback request.

1 Answers1

1

Twilio developer evangelist here.

You're not getting the status callback because you aren't setting it for the new participant. In your example code the second parameter you pass to the conferences resource doesn't do anything.

Instead you should pass all of those parameters as options to the call to create the new participant.

$twilio = new Client($sid, $token);

$participant = $twilio->conferences("myFriendlyName")
    ->participants
    ->create(
        "+15555555", 
        $participantphone,
                array(
                   "record" => True,
                   "endConferenceOnExit" => False,
                   "recordingStatusCallbackEvent" => array("completed"),
                   "recordingStatusCallback" => "https://example.com/wp-json/rec/v1/myroute/"),
                   "statusCallbackEvent"=>"initiated",
                   "statusCallback"=>"https://example.com/wp-json/rec/v1/myroute/",
                   "statusCallbackMethod"=>"POST"
);

Let me know if that helps at all.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Hi, thanks for responding. I am getting the request, but it doesn't contain ConferenceSid. I need ConferenceSid so that i can send an announcment to the conference. Here is what is in statusCallback: Called= ToState= CallerCountry= Direction= Timestamp= CallbackSource= CallerState= ToZip= SequenceNumber= CallSid= To= CallerZip= ToCountry= CalledZip= ApiVersion= CalledCity= CallStatus= From= AccountSid= CalledCountry= CallerCity= ToCity= FromCountry= Caller= FromCity= CalledState= FromZip=& FromState= Thanks! – Rick Liquidsky Jul 08 '19 at 23:53
  • Ah, ok, if you need to search for your conference you can do so using the [Conference API list resource](https://www.twilio.com/docs/voice/api/conference#read-multiple-conference-resources) and filter by `friendlyName`. – philnash Jul 09 '19 at 00:06