public async Task AcceptAsyncShouldThrowIfLinkNotAvailable() { // Given IAudioVideoInvitation invitation = null; m_applicationEndpoint.HandleIncomingAudioVideoCall += (sender, args) => invitation = args.NewInvite; TestHelper.RaiseEventsFromFile(m_mockEventChannel, "Event_IncomingAudioCall_NoActionLinks.json"); // When await invitation.AcceptAsync(m_loggingContext).ConfigureAwait(false); // Then // Exception is thrown }
public async Task AcceptAsyncShouldWork() { // Given IAudioVideoInvitation invitation = null; m_restfulClient.OverrideResponse(new Uri(DataUrls.AudioVideoInvitationAccept), HttpMethod.Post, HttpStatusCode.NoContent, null); m_applicationEndpoint.HandleIncomingAudioVideoCall += (sender, args) => invitation = args.NewInvite; TestHelper.RaiseEventsFromFile(m_mockEventChannel, "Event_IncomingAudioCall.json"); // When HttpResponseMessage response = await invitation.AcceptAsync(m_loggingContext).ConfigureAwait(false); // Then Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode); Assert.IsTrue(m_restfulClient.RequestsProcessed("POST " + DataUrls.AudioVideoInvitationAccept)); }
private async Task HandleIncomingAudioVideoCallAsync(IncomingInviteEventArgs <IAudioVideoInvitation> e) { Logger.Instance.Information("[AudioVideoIVRJob] Incoming AudioVideoCall."); var input = JobInput as AudioVideoIVRJobInput; IAudioVideoInvitation invite = e.NewInvite; if (input.Action == AudioVideoIVRActions.TerminateCall) { Logger.Instance.Information("[AudioVideoIVRJob] Declining incoming call."); await invite.DeclineAsync(LoggingContext).ConfigureAwait(false); } if (input.Action == AudioVideoIVRActions.TransferToUser) { Logger.Instance.Information("[AudioVideoIVRJob] Forwarding the call to {0}.", input.User); await invite.ForwardAsync(LoggingContext, input.User).ConfigureAwait(false); } if (input.Action == AudioVideoIVRActions.PlayPrompt || input.Action == AudioVideoIVRActions.RepeatPrompt) { Logger.Instance.Information("[AudioVideoIVRJob] Accepting the call."); await invite.AcceptAsync(LoggingContext).ConfigureAwait(false); await e.NewInvite.WaitForInviteCompleteAsync().ConfigureAwait(false); if (e.NewInvite.RelatedConversation?.AudioVideoCall == null) { Logger.Instance.Warning("[AudioVideoIVRJob] AudioVideoModality not found in the conversation."); return; } Logger.Instance.Information("[AudioVideoIVRJob] Call accepted."); var promptHandler = new AudioVideoIVRPromptHandler(input, this.AzureApplication, LoggingContext); promptHandler.HandleEstablishedAudioVideo(e.NewInvite.RelatedConversation.AudioVideoCall); } }