예제 #1
0
        public void StartRecordingLatestVersion_Returns200Ok(Uri sampleCallBackUri, RecordingContent?recordingContentType, RecordingChannel recordingChannelType, RecordingFormat recordingFormatType)
        {
            ServerCall serverCall = CreateMockServerCall(200, responseContent: DummyStartRecordingResponse);

            StartRecordingResult result = serverCall.StartRecording(sampleCallBackUri, recordingContentType, recordingChannelType, recordingFormatType);

            Assert.AreEqual("dummyRecordingId", result.RecordingId);
        }
예제 #2
0
        public void StartRecording_Returns200Ok(Uri sampleCallBackUri)
        {
            ServerCall serverCall = CreateMockServerCall(200, responseContent: DummyStartRecordingResponse);

            StartRecordingResult result = serverCall.StartRecording(sampleCallBackUri);

            Assert.AreEqual("dummyRecordingId", result.RecordingId);
        }
        public async Task RunAllRecordingFunctionsScenarioTests(AuthMethod authMethod)
        {
            CallingServerClient callingServerClient = authMethod switch
            {
                AuthMethod.ConnectionString => CreateInstrumentedCallingServerClientWithConnectionString(),
                AuthMethod.TokenCredential => CreateInstrumentedCallingServerClientWithToken(),
                _ => throw new ArgumentOutOfRangeException(nameof(authMethod)),
            };

            var groupId = GetGroupId();

            try
            {
                // Establish a Call
                var callConnections = await CreateGroupCallOperation(callingServerClient, groupId, GetFromUserId(), GetToUserId(), TestEnvironment.AppCallbackUrl).ConfigureAwait(false);

                var serverCall = callingServerClient.InitializeServerCall(groupId);

                // Start Recording
                StartRecordingResult startCallRecordingResult = await serverCall.StartRecordingAsync(new Uri(TestEnvironment.AppCallbackUrl)).ConfigureAwait(false);

                var recordingId = startCallRecordingResult.RecordingId;
                await ValidateCallRecordingStateAsync(serverCall, recordingId, CallRecordingState.Active).ConfigureAwait(false);

                // Pause Recording
                await serverCall.PauseRecordingAsync(recordingId).ConfigureAwait(false);
                await ValidateCallRecordingStateAsync(serverCall, recordingId, CallRecordingState.Inactive).ConfigureAwait(false);

                // Resume Recording
                await serverCall.ResumeRecordingAsync(recordingId).ConfigureAwait(false);
                await ValidateCallRecordingStateAsync(serverCall, recordingId, CallRecordingState.Active).ConfigureAwait(false);

                // Stop Recording
                await serverCall.StopRecordingAsync(recordingId).ConfigureAwait(false);

                // Get Recording StateAsync
                Assert.ThrowsAsync <RequestFailedException>(async() => await serverCall.GetRecordingStateAsync(recordingId).ConfigureAwait(false));

                // Hang up the Call, there is one call leg in this test case, hangup the call will also delete the call as the result.
                await SleepIfNotInPlaybackModeAsync().ConfigureAwait(false);
                await CleanUpConnectionsAsync(callConnections).ConfigureAwait(false);
            }
            catch (RequestFailedException ex)
            {
                Console.WriteLine(ex.Message);
                Assert.Fail($"Unexpected error: {ex}");
            }
            catch (Exception ex)
            {
                Assert.Fail($"Unexpected error: {ex}");
            }
        }