Exemple #1
0
        /// <summary>
        /// Constructs an action that plays the DTMF tones passed with
        /// the specified individual tone duration to the current call of an
        /// executing dial plan.
        /// </summary>
        /// <param name="dtmfDigits">The DTMF digits.</param>
        /// <param name="toneDuration">The tone duration.</param>
        /// <remarks>
        /// <note>
        /// The actual tone duration used will be adjusted so that it falls
        /// within the switch limits of <see cref="Switch.MinDtmfDuration "/>..<see cref="Switch.MaxDtmfDuration" />.
        /// </note>
        /// </remarks>
        public PlayDtmfAction(string dtmfDigits, TimeSpan toneDuration)
        {
            if (toneDuration < Switch.MinDtmfDuration)
            {
                toneDuration = Switch.MinDtmfDuration;
            }
            else if (toneDuration > Switch.MaxDtmfDuration)
            {
                toneDuration = Switch.MaxDtmfDuration;
            }

            this.dtmfDigits   = Dtmf.Validate(dtmfDigits);
            this.toneDuration = toneDuration;
        }
Exemple #2
0
        /// <summary>
        /// Plays an audio source until it is finished or until one of a set of DTMF
        /// digits is pressed or until <see cref="Break" /> or <see cref="BreakAll" />
        /// is called.
        /// </summary>
        /// <param name="source">The audio source.</param>
        /// <param name="stopDtmf">The set of DTMF digits that will stop the operation (<see cref="Dtmf" />).</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="source" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown if <paramref name="stopDtmf"/> includes an invalid DTMF digit.</exception>
        public void PlayAudio(AudioSource source, string stopDtmf)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (stopDtmf != null)
            {
                Dtmf.Validate(stopDtmf);
            }

            ActionRenderingContext.Execute(new PlayAudioAction(CallID, source)
            {
                StopDtmf = stopDtmf
            });
        }
Exemple #3
0
 /// <summary>
 /// Constructs an action that plays the DTMF tones passed with
 /// the default individual tone duration of <see cref="Switch.MinDtmfDuration" />
 /// to a specific call.
 /// </summary>
 /// <param name="callID">The target call ID.</param>
 /// <param name="dtmfDigits">The DTMF digits.</param>
 public PlayDtmfAction(Guid callID, string dtmfDigits)
 {
     this.CallID       = callID;
     this.dtmfDigits   = Dtmf.Validate(dtmfDigits);
     this.toneDuration = Switch.MinDtmfDuration;
 }
Exemple #4
0
 /// <summary>
 /// Constructs an action that plays the DTMF tones passed with
 /// the default individual tone duration of <see cref="Switch.MinDtmfDuration" />
 /// to the current call of an executing dial plan.
 /// </summary>
 /// <param name="dtmfDigits">The DTMF digits.</param>
 public PlayDtmfAction(string dtmfDigits)
 {
     this.dtmfDigits   = Dtmf.Validate(dtmfDigits);
     this.toneDuration = Switch.MinDtmfDuration;
 }