I want to add users to simple call generated using twilio to update it to conference call
public function forwardCallToUser(Request $request)
{
$client = new Client($accountSid, $authToken);
$conferenceName = 'Conference_' . time() . '_' . rand(1000, 9999);
$newUser = User::findOrFail($newUserId);
$newUserNumber = $newUser->phone_number;
$call = $client->calls($ongoingCallSid)->fetch();
$twiml = new VoiceResponse();
$dial = $twiml->dial('');
$dial->conference($conferenceName, [
'startConferenceOnEnter' => true,
'endConferenceOnExit' => false,
]);
$client->calls($ongoingCallSid)->update([
'twiml' => $twiml->asXML()
]);
$message = 'Converted existing call to conference and added new participant
return response()->json([
'success' => true,
'conference_name' => $conferenceName,
'new_participant_sid' => $newCall->sid,
'message' => $message
]);
}
it is giving me error
"[HTTP 400] Unable to fetch record: Invalid CallSid: CH8284f315ba6e43f1822e4efec9708bd1" even though ongoing call sid is same as mentioned above
I want to integrate adding user to simple call and make it conference call using twilio