Esempio n. 1
0
        public override void Validate()
        {
            base.Validate();
            if (this.Outcome == Outcome.Success)
            {
                bool choiceOutcome        = (this.ChoiceOutcome != null);
                bool collectDigitsOutcome = (this.CollectDigitsOutcome != null);

                Utils.AssertArgument(
                    (choiceOutcome && !collectDigitsOutcome) || (!choiceOutcome && collectDigitsOutcome),
                    "Either a ChoiceOutcome or a CollectDigitsOutcome must for specified for successful recognition outcome");

                if (choiceOutcome)
                {
                    Utils.AssertArgument(!String.IsNullOrWhiteSpace(this.ChoiceOutcome.ChoiceName),
                                         "Recognized choice name must be specified for successful choice recognition outcome");
                }

                if (collectDigitsOutcome)
                {
                    Utils.AssertArgument(!String.IsNullOrWhiteSpace(this.CollectDigitsOutcome.Digits),
                                         "Collected digits must be specified for successful choice recognition outcome");
                    ValidDtmfs.Validate(this.CollectDigitsOutcome.Digits.ToCharArray());
                }
            }
        }
Esempio n. 2
0
        public override void Validate()
        {
            base.Validate();
            Utils.AssertArgument(this.Action == ValidActions.RecordAction, "Action was not Record");

            if (this.PlayPrompt != null)
            {
                this.PlayPrompt.Validate();
            }

            if (this.StopTones != null)
            {
                ValidDtmfs.Validate(this.StopTones);
            }

            if (this.MaxDurationInSeconds.HasValue)
            {
                Utils.AssertArgument(this.MaxDurationInSeconds.Value >= MinValues.RecordingDuration.TotalSeconds && this.MaxDurationInSeconds.Value <= MaxValues.RecordingDuration.TotalSeconds,
                                     "MaxDurationInSeconds has to be specified in the range of {0} - {1} secs", MinValues.RecordingDuration.TotalSeconds, MaxValues.RecordingDuration.TotalSeconds);
            }

            if (this.InitialSilenceTimeoutInSeconds.HasValue)
            {
                Utils.AssertArgument(this.InitialSilenceTimeoutInSeconds.Value >= MinValues.InitialSilenceTimeout.TotalSeconds && this.InitialSilenceTimeoutInSeconds.Value <= MaxValues.InitialSilenceTimeout.TotalSeconds,
                                     "InitialSilenceTimeoutInSeconds has to be specified in the range of {0} - {1} secs", MinValues.InitialSilenceTimeout.TotalSeconds, MaxValues.InitialSilenceTimeout.TotalSeconds);
            }

            if (this.MaxSilenceTimeoutInSeconds.HasValue)
            {
                Utils.AssertArgument(this.MaxSilenceTimeoutInSeconds.Value >= MinValues.SilenceTimeout.TotalSeconds && this.MaxSilenceTimeoutInSeconds.Value <= MaxValues.SilenceTimeout.TotalSeconds,
                                     "MaxSilenceTimeoutInSeconds has to be specified in the range of {0} - {1} secs", MinValues.SilenceTimeout.TotalSeconds, MaxValues.SilenceTimeout.TotalSeconds);
            }
        }
Esempio n. 3
0
        public void Validate()
        {
            bool stopTonesSet = this.StopTones != null && this.StopTones.Any();

            Utils.AssertArgument(
                this.MaxNumberOfDtmfs.GetValueOrDefault() > 0 || stopTonesSet,
                "For CollectDigits either stopTones or maxNumberOfDigits or both must be specified");

            if (this.MaxNumberOfDtmfs.HasValue)
            {
                Utils.AssertArgument(this.MaxNumberOfDtmfs.Value >= MinValues.NumberOfDtmfsExpected && this.MaxNumberOfDtmfs.Value <= MaxValues.NumberOfDtmfsExpected,
                                     "MaxNumberOfDtmfs has to be specified in the range of {0} - {1}", MinValues.NumberOfDtmfsExpected, MaxValues.NumberOfDtmfsExpected);
            }

            if (stopTonesSet)
            {
                ValidDtmfs.Validate(this.StopTones);
            }
        }
Esempio n. 4
0
        public void Validate()
        {
            Utils.AssertArgument(!String.IsNullOrWhiteSpace(this.Name), "Choice 'Name' must be set to a valid non-empty value");

            bool speechVariationSet = this.SpeechVariation != null && this.SpeechVariation.Any();
            bool dtmfVarationSet    = this.DtmfVariation != null;

            Utils.AssertArgument(speechVariationSet || dtmfVarationSet, "SpeechVariation or DtmfVariation or both must be set");

            if (speechVariationSet)
            {
                foreach (string s in SpeechVariation)
                {
                    Utils.AssertArgument(!String.IsNullOrWhiteSpace(s), "Null or empty choice cannot be set for speech variation");
                }

                Utils.AssertArgument(this.SpeechVariation.Count() <= MaxValues.NumberOfSpeechVariations, "Number of speech variations specified cannot exceed : {0}", MaxValues.NumberOfSpeechVariations);
            }

            if (dtmfVarationSet)
            {
                ValidDtmfs.Validate(this.DtmfVariation.Value);
            }
        }