示例#1
0
 /// <summary>
 /// EventArg for the OnAnswerAppHostedMediaCompleted event raised on <see cref="IRealTimeMediaCallService"/>.
 /// </summary>
 /// <param name="conversationResult">ConversationResult corresponding to the event</param>
 /// <param name="resultingWorkflow">Workflow to be returned on completion</param>
 /// <param name="outcome">outcome of the operation</param>
 public AnswerAppHostedMediaOutcomeEvent(ConversationResult conversationResult, RealTimeMediaWorkflow resultingWorkflow, AnswerAppHostedMediaOutcome outcome) : base(conversationResult, resultingWorkflow)
 {
     if (outcome == null)
     {
         throw new ArgumentNullException(nameof(outcome));
     }
     AnswerAppHostedMediaOutcome = outcome;
 }
示例#2
0
 private Task OnAnswerAppHostedMediaCompleted(AnswerAppHostedMediaOutcomeEvent answerAppHostedMediaOutcomeEvent)
 {
     try
     {
         Log.Info(new CallerInfo(), LogContext.FrontEnd, $"[{CallId}] OnAnswerAppHostedMediaCompleted");
         AnswerAppHostedMediaOutcome answerAppHostedMediaOutcome = answerAppHostedMediaOutcomeEvent.AnswerAppHostedMediaOutcome;
         if (answerAppHostedMediaOutcome.Outcome == Outcome.Failure)
         {
             Log.Info(new CallerInfo(), LogContext.FrontEnd, $"[{CallId}] AnswerAppHostedMedia failed with reason: {answerAppHostedMediaOutcome.FailureReason}");
             //cleanup internal resources
             MediaSession.Dispose();
         }
         else
         {
             answerAppHostedMediaOutcomeEvent.RealTimeMediaWorkflow.NotificationSubscriptions = new NotificationType[] { NotificationType.CallStateChange };
         }
         return(Task.CompletedTask);
     } catch (Exception ex)
     {
         Log.Info(new CallerInfo(), LogContext.FrontEnd, $"[{CallId}] threw {ex.ToString()}");
         throw;
     }
 }
        private Task <RealTimeMediaWorkflow> HandleAnswerAppHostedMediaOutcome(ConversationResult conversationResult, AnswerAppHostedMediaOutcome answerAppHostedMediaOutcome)
        {
            var outcomeEvent = new AnswerAppHostedMediaOutcomeEvent(conversationResult, CreateInitialWorkflow(), answerAppHostedMediaOutcome);
            var eventHandler = OnAnswerAppHostedMediaCompleted;

            return(InvokeHandlerIfSet(eventHandler, outcomeEvent));
        }