public async Task CreateRoomAsync(string id, Country country, bool needRecord, Uri callBack, StudyRoomType studyRoomType) { var type = RoomResource.RoomTypeEnum.PeerToPeer; //switch (studyRoomType) //{ // case StudyRoomType.SmallGroup: // type = RoomResource.RoomTypeEnum.GroupSmall; // break; // case StudyRoomType.PeerToPeer: // type = RoomResource.RoomTypeEnum.PeerToPeer; // break; //} var mediaRegion = "us1"; if (country == Country.Israel) { mediaRegion = "de1"; } if (country == Country.India) { mediaRegion = "us1"; } await RoomResource.CreateAsync( uniqueName : id, enableTurn : true, maxParticipants : 2, type : type, statusCallback : callBack, statusCallbackMethod : HttpMethod.Post, recordParticipantsOnConnect : needRecord, mediaRegion : mediaRegion ); }
public static async Task CreateMeetingRoomAsync(Event @event) { var uniqueName = GetRoomName(@event); var room = (await RoomResource.ReadAsync( uniqueName: uniqueName, limit: 1)).FirstOrDefault(); if (room is null || room.UniqueName != uniqueName) { var callbackUrl = string.IsNullOrEmpty(_twilioConfiguration.RoomUpdateCallbackUrl) ? null : new Uri(_twilioConfiguration.RoomUpdateCallbackUrl); var callbackMethod = string.IsNullOrEmpty(_twilioConfiguration.RoomUpdateCallbackUrl) ? null : HttpMethod.Post; await RoomResource.CreateAsync( uniqueName : uniqueName, type : RoomResource.RoomTypeEnum.Group, maxParticipants : _maxParticipants, recordParticipantsOnConnect : false, statusCallback : callbackUrl, statusCallbackMethod : callbackMethod); } }
public async Task <IActionResult> Index() { TwilioClient.Init(_settings.AccountSid, _settings.AuthToken); try { var room1 = await RoomResource.CreateAsync(new CreateRoomOptions { UniqueName = "DailyStandup1" }); Debug.WriteLine(room1.UniqueName); var room2 = await RoomResource.CreateAsync(new CreateRoomOptions { UniqueName = "DailyStandup2" }); Debug.WriteLine(room2.UniqueName); var rooms = await RoomResource.FetchAsync(room1.Sid); Debug.WriteLine(rooms.UniqueName); } catch (Exception e) { Debug.WriteLine(e); } return(Ok()); }