/// <summary>
        /// Invokes handlers for callback on the bot
        /// </summary>
        /// <param name="conversationResult">ConversationResult that has the details of the callback</param>
        /// <returns></returns>
        internal async Task <string> ProcessConversationResult(ConversationResult conversationResult)
        {
            conversationResult.Validate();
            var newWorkflowResult = await PassActionResultToHandler(conversationResult).ConfigureAwait(false);

            if (newWorkflowResult == null)
            {
                throw new BotCallingServiceException($"[{CallLegId}]: No workflow returned for AnswerAppHostedMediaOutcome");
            }

            bool expectEmptyActions = false;

            if (conversationResult.OperationOutcome.Type == RealTimeMediaValidOutcomes.AnswerAppHostedMediaOutcome && conversationResult.OperationOutcome.Outcome == Outcome.Success)
            {
                Uri link;
                if (conversationResult.Links.TryGetValue("subscriptions", out link))
                {
                    _subscriptionLink = link;
                    Trace.TraceInformation($"RealTimeMediaCallService [{CallLegId}]: Caching subscription link {link}");
                }

                if (conversationResult.Links.TryGetValue("call", out link))
                {
                    _callLink = link;
                    Trace.TraceInformation($"RealTimeMediaCallService [{CallLegId}]: Caching call link {link}");
                }
                expectEmptyActions = true;

                Trace.TraceInformation($"RealTimeMediaCallService [{CallLegId}]: Disposing call expiry timer");
                _timer.Dispose();
            }

            newWorkflowResult.Validate(expectEmptyActions);
            return(RealTimeMediaSerializer.SerializeToJson(newWorkflowResult));
        }
コード例 #2
0
        private async Task <string> ProcessConversationResult(ConversationResult conversationResult, Task <Stream> additionalData)
        {
            conversationResult.Validate();
            var newWorkflowResult = await PassActionResultToHandler(conversationResult, additionalData).ConfigureAwait(false);

            if (newWorkflowResult == null)
            {
                return("");
            }
            newWorkflowResult.Validate();
            return(Serializer.SerializeToJson(newWorkflowResult));
        }