Я нашел, что мне нужно сделать.
Создать комнату с mediaRegion:
use Symfony\Component\HttpFoundation\Request;
use Twilio\Jwt\AccessToken;
use Twilio\Jwt\Grants\VideoGrant;
use Twilio\Rest\Client;
class VideoconferencingController extends Controller
{
public function createAction(Request $request, $twilioRoomSid, $staffId, $roomName)
{
$twilioRoomSid = ('undefined' == $twilioRoomSid) ? null : $twilioRoomSid;
$user = $this->getUser();
$twilioAccountSid = $this->getParameter('twilio_account_sid');
$twilioApiKey = $this->getParameter('twilio_api_key');
$twilioApiSecret = $this->getParameter('twilio_api_secret');
$now = new \DateTime();
// Get or create room
$twilio = new Client($twilioApiKey, $twilioApiSecret, $twilioAccountSid);
if ($twilioRoomSid) {
$room = $twilio
->video
->v1
->rooms($twilioRoomSid)
->fetch()
;
}
$createRoom = (!$twilioRoomSid || 'completed' == $room->status) ? true : false;
if ($createRoom) {
$room = $twilio
->video
->v1
->rooms
->create([
'mediaRegion' => 'ie1',
'uniqueName' => $roomName
]
)
;
$twilioRoomSid = $room->sid;
$staff = $this->findOr404('App:Staff', $staffId);
$staff->setTwilioRoomSid($twilioRoomSid);
$this->flush();
}
// Authorize room
$identity = $user->getFullName();
// Create access token, which we will serialize and send to the client
$token = new AccessToken(
$twilioAccountSid,
$twilioApiKey,
$twilioApiSecret,
3600,
$identity
);
// Create Video grant
$videoGrant = new VideoGrant();
$videoGrant->setRoom($twilioRoomSid);
// Add grant to token
$token->addGrant($videoGrant);
// render token to string
return [
'token' => $token->toJWT(),
'roomName' => $roomName,
];
}
}