Mar 24, 2023
0
Level 1
Add a participant to to an existing conference using Conference Participant API in twilio php sdk in Laravel 9
I am trying to add a participant to an existing conference call using the Participant Resource API. I have first fetched the conference_sid in and then tried to add the new participant to the ongoing.
public function twilioConferenceCall2(Request $request) {
$returnArray = array();
$status = "Error";
$msg = "Call not started";
$validator = Validator::make($request->all(), [
'participant' => 'required',
'contact_id' => 'required'
]);
if ($validator->fails()) {
return response()->json(['error' => $validator->errors()], 401);
}
$participant = $request->input('participant');
$contact_id = $request->input('contact_id');
$sid = "aaaa";
$token = "bbbb";
$client = new Client($sid, $token);
$conferences = $client->conferences->read(
array("status" => "in-progress", "friendlyName" => "NewConference")
);
$conference_sid = $conferences->sid;
$call = $client->conferences($conference_sid)
->participants
->create($participant);
}
The Twilio Documentation provide information about creating a new participant using Conference Participant API, but has not given details about how to add participants to an ongoing conference.
Kindly suggest is it correct to add a participant?
Please or to participate in this conversation.