Click or drag to resize

VoiceResource Class

This is the basic object for executing all media based functions including playing, recording, capturing, transmitting and all forms of media handling.
Inheritance Hierarchy
SystemObject
  ClientObject
    VoiceElements.ClientRoutableResource
      VoiceElements.ClientVoiceResource

Namespace:  VoiceElements.Client
Assembly:  VoiceElementsClient (in VoiceElementsClient.dll) Version: 8.6.1.1
Syntax
public class VoiceResource : RoutableResource

The VoiceResource type exposes the following members.

Properties
  NameDescription
Public propertyBeepDetectionDebouncerOff
This is the required number of samples (each 10ms) that are required for the tone to be considered "off". Default = 4 samples
Public propertyBeepDetectionDebouncerOn
This is the required number of samples (each 10ms) that are required for the tone to be considered "on". Default = 4 samples
Public propertyBeepDetectionFrequencyRangeHighHz
The highest frequency the Beep Detector will attempt to isolate. Default = 1800Hz.
Public propertyBeepDetectionFrequencyRangeLowHz
The highest frequency the Beep Detector will attempt to isolate. Default = 600Hz.
Public propertyBeepDetectionMaximumTimeMs
This is the maximum time the system will listen for a beep. Beep Detection will stop after this interval. Default = 60000ms
Public propertyBeepDetectionMetaData
When the server is recording Beep Detection, this allows you to add additional information to the filename that is created. Be sure to only use characters that are permissable within filenames.
Public propertyBeepDetectionMinimumRequiredDb
The minimum required energy in decibels for a packet to be examined. Default = -38.0f Raising this value will eliminate quieter tones.
Public propertyBeepDetectionPercentOfEnergy
The percentage of energy that is contained within the frequency bin as compared to the overall energy. Default = 0.90f
Public propertyBeepDetectionShortToneMs
The length of the shortest tone you wish to detect. For shorter tones, the tone must be immediately followed by silence. Default = 120ms.
Public propertyBeepDetectionShortToneSilenceTriggerMs
The amount of required silence after a short tone goes to silence. Deafult = 40ms.
Public propertyBeepDetectionThrowsException
Cause an exception to be thrown when the BeepDetector senses a beep in the audio stream.
Public propertyBeepDetectionTimeOnToTriggerMs
This is the total time the frequency must be registered before the system qualifies it as a beep. Default = 200ms.
Public propertyBeepDetectionToneOnEnergyDeviationDb
The allowable deviation of the tone's loudness in decibels. If the tone starts at -15db it must stay at this level +/- this value. Default = 2.0 db.
Public propertyBeepDetectionToneOnFrequencyDeviation
The allowable deviation of the tone's frequency in hertz. If the tone starts at 600hz it must stay at this frequency +/- this value. Default = 25 Hz.
Public propertyBytesPlayed
The number of bytes that were output on the last Play on this resource.
Public propertyBytesRecorded
The number of bytes that were recorded on the last Record on this resource.
Public propertyClearDigitBuffer
Gets or Sets the flag that tells the system whether or not to clear the digit buffer before executing the the next voice function, such as a Play or Record.
Public propertyCodec
Gets or sets the audio codec for the Voice Resource.
Public propertyConference
Represents the Conference of which this resource is a member.
(Inherited from RoutableResource.)
Public propertyConferenceAttributes
Represents the Conference Attributes of a Conference to which this resource is a member.
(Inherited from RoutableResource.)
Public propertyDataFormat
Gets or sets the audio Data Format The Default is Wave Format.
Public propertyDetectBargeIn
When set to true, files played will return a Termination Code of "BargeIn" if voice activity is detected during the Timeout. This only applies to CSP enabled voice resources.
Public propertyDetectBargeInTimeout
The maximum amount of time you will allow a speech recognition barge-in to trigger the stopping of a Play function. This only applies to CSP enabled voice resources.
Public propertyDeviceName
The unique name of this resource / device on the server. This is useful for following, logging a call or thread.
(Inherited from RoutableResource.)
Public propertyDigitBuffer
Holds the string of digits from the last Get Response or Get Digits.
Public propertyEnableDigitEvents
Enables or disables Digit Events on this resource.
Public propertyFaxToneThrowsException
Cause an exception to be thrown when the voice resource senses a fax signal in the audio stream. Note the Fax tone 'F' must be defined on the voice elements server (GlobalTones config setting) When set to true, this turns on DigitEvents by default. If you set this to false and donot want DigitEvents enabled, you must manually turn them off.
Public propertyFormatSpoken
Public propertyInterDigitTimeout
Gets or sets the inter digit time out in seconds (how long to wait for another digit after receiving one) to use for the next voice function, such as a Play or Record. This value is how long the system will wait between digits for the next one.
Public propertyInterDigitTimeoutStartsAfterFirstDigit
Gets or sets a value to determine when the Inter Digit Timer starts; either immediately or after the first digit is pressed.
Public propertyListeners
A list of Routable Resources which are currently listening to this resource.
(Inherited from RoutableResource.)
Public propertyListentingTo
A Routable Resources to which this resource is currently listening.
(Inherited from RoutableResource.)
Public propertyMaximumDigits
Gets or sets the maximum number of digits that will be accepted as input on the next voice function. Default = 20.
Public propertyMaximumSilence
Gets or sets the maximum silence in seconds that will be allowed until termination of the next voice function. Default = 20.
Public propertyMaximumTime
Gets or sets the maximum time in seconds that will be allowed until termination of the next voice function. Default = 20.
Public propertyPlayGain
Public propertyRecordWithBeep
Sets the voice resource to play a short beep before it begins any subsequent Record.
Public propertySpeechRecognitionComfortFile
Specifies the comfort file to use with the next speech recognition operation.
Public propertySpeechRecognitionComfortStart
Specifies, in milliseconds, how soon to start the Comfort File after a barge in. A setting of 0 means to wait until the end of speech is detected.
Public propertySpeechRecognitionEnabled
When set to true, this causes all subsequent Play and Play TTS methods to perform speech recognition.
Public propertySpeechRecognitionEndOfSpeechDelay
Sets the amount of time in seconds necessary to trigger end of speech detection.
Public propertySpeechRecognitionGrammarFile
Specifies the grammar file to use with the next speech recognition operation.
Public propertySpeechRecognitionMode
Specifies if speech recognition spans a single play or multiple plays.
Public propertySpeechRecognitionPermitBargeIn
Tells the speech engine whether or not to terminate any Plays or Play TTS's when speech is detected.
Public propertySpeechRecognitionReturnedWord
The word returned by the last speech operation. Essentially, what the engine thinks the caller said.
Public propertySpeechRecognitionScore
The score returned from the speech engine signifying how "confident" it is about the accuracy of the last speech operation. Ranges from 1-1000, 1000 being the most confident.
Public propertyStartingOffset
The starting byte position in the file from which the next Play will begin. This property is reset after each invocation.
Public propertyTalkTime
The number of seconds of time in the last Record on this resource.
Public propertyTerminationCode
A Termination Code indicating how the last voice function (i.e. Play) ended. Typically, you will use this to determine what to do next.
Public propertyTerminationDigits
Gets or Sets the termination digits to use for the next voice function such as a Play. "ANY" or "@" specifies to terminate on all digits.
Public propertyVapCodec
Gets or sets the audio codec for the current VAP File.
Public propertyVapFile
Specifies the current VAP File.
Public propertyVapMapFile
Specifies the file which maps the segments of your VAP File.
Public propertyVoiceRecognitionEnabled Obsolete.
When set to true, this causes all subsequent Play() and PlayTTS() methods to perform voice recognition.
Public propertyVoiceRecognitionEndOfSpeechDelay Obsolete.
Sets the amount of time necessary to trigger end of speech detection.
Public propertyVoiceRecognitionGrammarFile Obsolete.
Specifies the grammar file to use with the voice recognition operation.
Public propertyVoiceRecognitionPermitBargeIn Obsolete.
Allows BargeIn when using voice recognition.
Public propertyVoiceRecognitionReturnedWord Obsolete.
The returned word from the last voice recognition operation.

UML Diagram: UML Diagram

Public propertyVoiceRecognitionScore Obsolete.
The score returned from the engine that specifies how the last voice recognition operation was scored.
Top
Methods
  NameDescription
Public methodBeepDetectionRestart
Restarts the Beep Detector. This feature greatly improve call progress accuracy.
Public methodBeepDetectionStart
Starts the Beep Detector. This feature greatly improves call progress accuracy.
Public methodBeepDetectionStop
Stops the Beep Detector. This feature greatly improves call progress accuracy.
Protected methodDispose
This method forces a dispose of the Voice Resource object.
(Overrides ClientObject.Dispose(Boolean).)
Public methodCode exampleGetDigits
Waits for a user input as Digit(s) using all current settings for the Voice Resource, and therefore has no parameters.
Public methodCode exampleGetDigits(Int32, Int32, String)
Waits for a user input as Digit(s) specifying three current settings for the Voice Resource: Maximum Digits, Maximum Time and Termination Digit.
Public methodCode exampleGetDigits(Int32, Int32, String, Int32)
Waits for a user input as Digit(s) specifying four settings for the Voice Resource: Maximum Digits, Maximum Time, Termination Digit and Inter Digit Timeout.
Public methodCode exampleGetDigits(Int32, Int32, String, Int32, Boolean)
Waits for a user input as Digit(s) specifying all settings for the Voice Resource: Maximum Digits, Maximum Time, Termination Digit, Inter Digit Timeout and Clear Digit Buffer Flag.
Public methodCode exampleGetResponse
Waits for a user response as Digit(s) or Speech using all current settings for the Voice Resource, and therefore has no parameters.
Public methodCode exampleGetResponse(Int32, Int32, String)
Waits for a user response as Digit(s) or Speech specifying three current settings for the Voice Resource: Maximum Digits, Maximum Time and Termination Digit.
Public methodCode exampleGetResponse(Int32, Int32, String, Int32)
Waits for a user response as Digit(s) or Speech specifying four settings for the Voice Resource: Maximum Digits, Maximum Time, Termination Digit and Inter Digit Timeout.
Public methodCode exampleGetResponse(Int32, Int32, String, Int32, Boolean)
Waits for a user response as Digit(s) or Speech specifying all settings for the Voice Resource: Maximum Digits, Maximum Time, Termination Digit, Inter Digit Timeout and Clear Digit Buffer Flag.
Public methodGetSilence
Waits for a specified period of silence before returning to your code. This is useful when waiting for an answering machine to finish playing it's greeting.
Public methodGetToneDigit
Gets the first occurance of any registered tone that has been triggered and is in the digit buffer. If no tones have been triggered, this function returns -1.
Public methodIcecastStream
Public methodIsToneComplete
Returns 1 if the specified Tone is Off. Otherwise a 0. This function also returns -1 if the tone is not found.
Public methodCode examplePlay(Byte)
Plays the specified byte array of audio using the current Audio Codec of the Voice Resource.
Public methodCode examplePlay(String)
Plays the specified file path and name.
Public methodCode examplePlay(String)
Plays a sequence of files, provided each file plays to completion.
Public methodCode examplePlayDate
Plays a Date using the voice resource's specified VAP file.
Public methodCode examplePlayNumber
Plays the specified string as a number using the specified Format Spoken and the voice resource's VAP file.
Public methodCode examplePlayTone(Int32, Int32, Int32)
Plays a single tone at the desired frequency and amplitude for the requested duration.
Public methodCode examplePlayTone(Int32, Int32, Int32, Int32, Int32)
Plays two mixed tones at the two specified frequencies and amplitudes for the requested duration.
Public methodCode examplePlayTouchTones
Plays DTMF or touch tones corresponding to the string specified.
Public methodCode examplePlayTTS(String)
Plays the text specified using the Text-To-Speech engine using the default voice.
Public methodCode examplePlayTTS(String, String)
Plays the text specified using the Text-To-Speech engine and using the voice selected.
Public methodPlayVap(Int32)
Plays a single segment of the current VAP File.
Public methodPlayVap(Int32)
Plays an array of segments of the current VAP File.
Public methodPlayVap(String)
Plays a single segment of the current VAP File using the Vap Map entry specified.
Public methodPlayVap(String)
Plays multiple segments of the current VAP File using the VapMap entries specified.
Public methodRecord(String)
Records audio on the Voice Resource to the given file name and path.
Public methodRecord(Int32, Byte)
Records to a memory buffer.
Public methodRecordAndFollowConversation(String, RoutableResource)
Follows a resource's route and records both the resource and what it is routed to.
Public methodRecordAndFollowConversation(Int32, Byte, RoutableResource)
Follows a resource's route and records both the resource and what it is routed to.
Public methodRecordConversation(String, RoutableResource, RoutableResource)
Records two routable resources, summing them together into the same file. You can specify channels and/or a voice resources.
Public methodRecordConversation(Int32, Byte, RoutableResource, RoutableResource)
Records two routable resources, summing them together into a buffer. You can specify channels and/or a voice resources.
Public methodRecordConverstation(String, RoutableResource, RoutableResource) Obsolete.
Records two Routable Resources, summing their audio together into the designated file. You can specify Channels and/or Voice Resources.
Public methodRecordConverstation(Int32, Byte, RoutableResource, RoutableResource) Obsolete.
Records two Routable Resources, summing their audio together into a buffer. You can specify Channels and/or Voice Resources.
Public methodRouteFull(TelephonyLinkInfo)
This overload is for Voice Elements Internal Use Only! To correctly route, use the Full Route Method.
(Inherited from RoutableResource.)
Public methodCode exampleRouteFull(RoutableResource)
Completes a full route between two Routable Resources. Both channels then listen to each other.
(Inherited from RoutableResource.)
Public methodRouteHalf(TelephonyLinkInfo)
This overload is for Voice Elements Internal Use Only! To correctly route, use the Half Route Method.
(Inherited from RoutableResource.)
Public methodCode exampleRouteHalf(RoutableResource)
Completes a half route between two Routable Resources. The channel calling this method listens to the one in the parameter, the second cannot hear.
(Inherited from RoutableResource.)
Public methodSetConferenceAGCLevels
Sets the levels for the AGC in conferencing. If all values are set to negatives, then the system wide AGC applies.
(Inherited from RoutableResource.)
Public methodSetConferenceECTailDelay
Sets the Echo Tail Delay in conferencing.
(Inherited from RoutableResource.)
Public methodSetConferenceFEGLevel
Sets the front end gain in conferencing. If set to 0, front end gain is turned off.
(Inherited from RoutableResource.)
Public methodSetMonitorStream
Public methodStop
Stops any current activity on the Voice Resource, such as a Play or Record.
Public methodStopAllListeners
Forces all Routable Resources currently listening to this resource to stop.
(Inherited from RoutableResource.)
Public methodStopListener
Forces a apecific Routable Resource currently listening to this resource to stop.
(Inherited from RoutableResource.)
Public methodStopListening
Forces this resource to stop listening to all Routable Resources.
(Inherited from RoutableResource.)
Public methodTddDetectionStart
Starts the detection of a TDD device for the hearing impaired.
Public methodTddDetectionStop
Starts the detection of a TDD device for the hearing impaired.
Public methodTerminationCodeFlag
A Termination Code flag indicating how the last voice function (i.e. Play) ended. Typically, you will use this to determine what to do next.
Public methodWipeDigitBuffer
Forcibly clears all digits in the buffer from previous inputs. This is useful to ensure the buffer is clean before doing a Get Response or Get Digits.
Top
Events
  NameDescription
Public eventDigit
This event fires when a digit is detected on the voice resource if the Enable Digit Events Property is set to true.
Top
Remarks
A Voice Resource is a type of Routable Resource. Being inherited from there, it has all the attributes thereof.

Some of the most common uses for a Voice Resource are:

Note that Voice Resources are typically accompanied by a Channel Resource through which the many of the most common telephony functions are executed. By accessing this object, you can do the following and more:
Examples
The code snippets below illustrate basic Voice Resource functions being executed on an outbound call placed on a Channel Resource.
public void ExecuteChannelMethods()
{
  // To get a channel, you must first get a link to a Telephony Server.  You may need to pass a username password here.
  TelephonyServer m_TelephonyServer = new TelephonyServer();

  // Get your channel resource from the server
  ChannelResource m_ChannelResource = m_TelephonyServer.GetChannel();

  // Example 1: Dial an oubound call
  string phoneNumber = "2135551212";
  m_ChannelResource.Dial(phoneNumber);

  // Next, use the voice resource of the channel to do some more things
  // First, play an audio file
  m_ChannelResource.VoiceResource.Play(@"C:\Audio\Sample.wav");

  // Get digits from the caller
  TerminationCode terminationCode = m_ChannelResource.VoiceResource.GetDigits();
  string m_Digits = m_ChannelResource.VoiceResource.DigitBuffer;

  // Play text to speech to the caller
  m_ChannelResource.VoiceResource.PlayTTS("Hello, this is your application speaking.  Please say whatever you like.");

  // Record the callers response to the file specified
  m_ChannelResource.VoiceResource.Record(@"C:\Audio\RecordedCall.wav");
}
See Also