Reputation: 11
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.
Upvotes: 1
Views: 518
Reputation: 73027
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.
Upvotes: 1