internal async Task <IEnumerable <CallConnection> > CreateGroupCallOperation(CallingServerClient callingServerClient, string groupId, string from, string to, string callBackUri) { CallConnection?fromCallConnection = null; CallConnection?toCallConnection = null; try { CommunicationIdentifier fromParticipant = new CommunicationUserIdentifier(from); CommunicationIdentifier toParticipant = new CommunicationUserIdentifier(to); JoinCallOptions fromCallOptions = new JoinCallOptions( new Uri(callBackUri), new MediaType[] { MediaType.Audio }, new EventSubscriptionType[] { EventSubscriptionType.ParticipantsUpdated }); fromCallConnection = await callingServerClient.JoinCallAsync(groupId, fromParticipant, fromCallOptions).ConfigureAwait(false); SleepInTest(1000); Assert.IsFalse(string.IsNullOrWhiteSpace(fromCallConnection.CallConnectionId)); JoinCallOptions joinCallOptions = new JoinCallOptions( new Uri(callBackUri), new MediaType[] { MediaType.Audio }, new EventSubscriptionType[] { EventSubscriptionType.ParticipantsUpdated }); toCallConnection = await callingServerClient.JoinCallAsync(groupId, toParticipant, joinCallOptions).ConfigureAwait(false); SleepInTest(1000); Assert.IsFalse(string.IsNullOrWhiteSpace(toCallConnection.CallConnectionId)); return(new CallConnection[] { fromCallConnection, toCallConnection }); } catch (RequestFailedException ex) { Console.WriteLine(ex.Message); Assert.Fail($"Unexpected error: {ex}"); throw; } catch (Exception ex) { Assert.Fail($"Unexpected error: {ex}"); if (fromCallConnection != null) { await fromCallConnection.HangupAsync().ConfigureAwait(false); } if (toCallConnection != null) { await toCallConnection.HangupAsync().ConfigureAwait(false); } throw; } }
public Task JoinGroup(Guid groupID) { var camera = _deviceManager.Cameras.First(c => c.CameraFacing == CameraFacing.Front); _localVideoStream = new LocalVideoStream(camera, MainActivity.Instance); _localRenderer = new VideoStreamRenderer(_localVideoStream, MainActivity.Instance); var renderingOptions = new CreateViewOptions(ScalingMode.Crop); var nativeView = _localRenderer.CreateView(renderingOptions); var formsView = nativeView.ToView(); LocalVideoAdded?.Invoke(this, formsView); var groupCallLocator = new GroupCallLocator(UUID.FromString(groupID.ToString())); var videoOptions = new VideoOptions(new LocalVideoStream[] { _localVideoStream }); var joinCallOptions = new JoinCallOptions(); joinCallOptions.SetVideoOptions(videoOptions); _call = _callAgent.Join(Application.Context, groupCallLocator, joinCallOptions); _call.RemoteParticipantsUpdated += _call_RemoteParticipantsUpdated; return(Task.CompletedTask); }
public void JoinCall_Returns404NotFound(string serverCallId, CommunicationIdentifier source, JoinCallOptions joinCallOptions) { CallingServerClient callingServerClient = CreateMockCallingServerClient(404); RequestFailedException?ex = Assert.Throws <RequestFailedException>(() => callingServerClient.JoinCall(serverCallId, source, joinCallOptions)); Assert.NotNull(ex); Assert.AreEqual(ex?.Status, 404); }
public void JoinCallAsync_Returns404NotFound(string serverCallId, CommunicationIdentifier source, JoinCallOptions joinCallOptions) { CallingServerClient callingServerClient = CreateMockCallingServerClient(404); RequestFailedException?ex = Assert.ThrowsAsync <RequestFailedException>(async() => await callingServerClient.JoinCallAsync(serverCallId, source, joinCallOptions).ConfigureAwait(false)); Assert.NotNull(ex); Assert.AreEqual(ex?.Status, 404); }
public void JoinCall_Returns202Accepted(string serverCallId, CommunicationIdentifier source, JoinCallOptions joinCallOptions) { CallingServerClient callingServerClient = CreateMockCallingServerClient(202, CreateOrJoinCallPayload); var response = callingServerClient.JoinCall(serverCallId, source, joinCallOptions); Assert.AreEqual((int)HttpStatusCode.Accepted, response.GetRawResponse().Status); Assert.AreEqual("cad9df7b-f3ac-4c53-96f7-c76e7437b3c1", response.Value.CallConnectionId); }