コード例 #1
0
        /// <summary>
        /// When the IRealTimeMediaCallService detects an error and cleans up the call locally
        /// </summary>
        /// <returns></returns>
        private Task OnCallCleanup()
        {
            Log.Info(new CallerInfo(), LogContext.FrontEnd, $"[{CallId}] Received OnCallCleanup");
            if (MediaSession != null)
            {
                MediaSession.Dispose();
            }

            return(Task.CompletedTask);
        }
コード例 #2
0
        /// <summary>
        /// This gets called when the user hangs up the call to the bot
        /// </summary>
        /// <param name="callStateChangeNotification"></param>
        /// <returns></returns>
        private Task OnCallStateChangeNotification(CallStateChangeNotification callStateChangeNotification)
        {
            Log.Info(new CallerInfo(), LogContext.FrontEnd, $"[{CallId}] Received CallStateChangeNotification with AudioVideoCallStateType={callStateChangeNotification.CurrentState.ToString()}");

            if (callStateChangeNotification.CurrentState == CallState.Terminated)
            {
                MediaSession.Dispose();
            }
            return(Task.CompletedTask);
        }
コード例 #3
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;
     }
 }