Пример #1
0
        private static Task PlayMoneyValue(Step step, ICall call, PlayValueStepSettings stepSettings)
        {
            var numbersToPromptsConverter = new MoneyValueToPrompts(call.Logger);
            var valueToPlay = (decimal?)DynamicState.GetProperty(call.CallState, stepSettings.Value);

            if (valueToPlay == null)
            {
                throw new ArgumentException("Value specified does not exist on CallState: " + stepSettings.Value);
            }

            var prompts = numbersToPromptsConverter.GetPromptsForValue(valueToPlay.Value);

            var promptSettings = new PlayerPromptSettings()
            {
                IsInterruptible = stepSettings.IsInterruptible,
                NextStep        = step.GetStepFromConnector(NextStep),
                Prompts         = prompts,
                Direction       = stepSettings.Direction
            };

            call.PromptPlayer.DoStepAsync(promptSettings);
            if (stepSettings.Direction != Direction.Outgoing)
            {
                call.CallState.AddStepToIncomingQueue(step.GetStepFromConnector(NextStep));
            }
            else
            {
                call.CallState.AddStepToOutgoingQueue(step.GetStepFromConnector(NextStep));
            }
            return(Task.CompletedTask);
        }
Пример #2
0
        private static async Task PlayNumberValue(Step step, ICall call, PlayValueStepSettings stepSettings)
        {
            var promptSettings = new PlayerPromptSettings()
            {
                IsInterruptible = stepSettings.IsInterruptible,
                NextStep        = step.GetStepFromConnector(NextStep),
                Direction       = stepSettings.Direction
            };

            await call.PromptPlayer.DoStepAsync(promptSettings);

            var valueToPlay = DynamicState.GetProperty(call.CallState, stepSettings.Value);

            if (valueToPlay == null)
            {
                throw new ArgumentException("Value specified does not exist on CallState: " + stepSettings.Value);
            }

            await call.PromptPlayer.PlayNumberToLineAsync(valueToPlay.ToString(),
                                                          stepSettings.Direction == Direction.Incoming
                                                          ?call.CallState.GetIncomingLineId()
                                                              : call.CallState.GetOutgoingLineId());

            if (stepSettings.Direction != Direction.Outgoing)
            {
                call.CallState.AddStepToIncomingQueue(step.GetStepFromConnector(NextStep));
            }
            else
            {
                call.CallState.AddStepToOutgoingQueue(step.GetStepFromConnector(NextStep));
            }
        }