Interface IPlayMethods
Defines a collection of methods for playing audio to the person on the call.
Namespace: ivrToolkit.Core.Interfaces
Assembly: ivrToolkit.Core.dll
Syntax
public interface IPlayMethods
Methods
| Edit this page View SourcePlayCharacters(string)
Speaks out the digits in the string.
Declaration
void PlayCharacters(string characters)
Parameters
Type | Name | Description |
---|---|---|
string | characters | 0-9, a-z, # and * |
PlayCharactersAsync(string, CancellationToken)
Asynchronously speaks out the digits in the string.
Declaration
Task PlayCharactersAsync(string characters, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | characters | 0-9, a-z, # and * |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
PlayDate(DateTime, string)
Plays a DateTime object given based on the mask parameter.
Declaration
void PlayDate(DateTime dateTime, string mask)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | Can be just the date, just the time or both |
string | mask | Tells the voice plugin how to speak the datetime. |
Remarks
Mask parts can be separated by the following characters: :
,
, or -
.
"m" "mm", or "mmm" - Speaks the month. Example: December
"d" or "dd" - Speaks the day of the month. Example: 3rd
"ddd" or "dddd" - Speaks the day of the week. Example: Saturday
"yyy" or "yyyy" - Speaks the year. Speak years 2010 to 2099 with the word "thousand".
"h" or "hh" - Speaks the hours. If your mask contains a/p
, it is 12-hour time; otherwise, it is 24-hour time.
"n" or "nn" - Speaks the minutes.
"a/p" - Speaks either "am" or "pm".
Examples
line.PlayDate(myDateTime,"m-d-yyy h:n a/p");
|
Edit this page
View Source
PlayDateAsync(DateTime, string, CancellationToken)
Asynchronously plays a DateTime object given based on the mask parameter.
Declaration
Task PlayDateAsync(DateTime dateTime, string mask, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
DateTime | dateTime | Can be just the date, just the time or both |
string | mask | Tells the voice plugin how to speak the datetime. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
Remarks
Mask parts can be separated by the following characters: :
,
, or -
.
"m" "mm", or "mmm" - Speaks the month. Example: December
"d" or "dd" - Speaks the day of the month. Example: 3rd
"ddd" or "dddd" - Speaks the day of the week. Example: Saturday
"yyy" or "yyyy" - Speaks the year. Speak years 2010 to 2099 with the word "thousand".
"h" or "hh" - Speaks the hours. If your mask contains a/p
, it is 12-hour time; otherwise, it is 24-hour time.
"n" or "nn" - Speaks the minutes.
"a/p" - Speaks either "am" or "pm".
Examples
await line.PlayDateAsync(myDateTime,"m-d-yyy h:n a/p", cancellationToken);
|
Edit this page
View Source
PlayFile(ITextToSpeechCache)
Converts the specified text into a wav stream and plays it using ITextToSpeechCache
Declaration
void PlayFile(ITextToSpeechCache textToSpeechCache)
Parameters
Type | Name | Description |
---|---|---|
ITextToSpeechCache | textToSpeechCache | Used to generated TTS and possibly save it to a wav file for later use. Will only generate TTS if a wav file is not specified, missing or changed. |
Exceptions
Type | Condition |
---|---|
VoiceException | If ITextToSpeechCache doesn't have a wav file name. |
PlayFileAsync(ITextToSpeechCache, CancellationToken)
Asynchronously converts the specified text into a wav stream and plays it using ITextToSpeechCache
Declaration
Task PlayFileAsync(ITextToSpeechCache textToSpeechCache, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ITextToSpeechCache | textToSpeechCache | Used to generated TTS and possibly save it to a wav file for later use. Will only generate TTS if a wav file is not specified, missing or changed. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
VoiceException | If ITextToSpeechCache doesn't have a wav file name. |
PlayFileOrPhrase(string)
Plays a file or phrase based on the provided string. If the fileNameOrPhrase has a "|" then it is considered a phrase. PlayString(string)
Declaration
void PlayFileOrPhrase(string fileNameOrPhrase)
Parameters
Type | Name | Description |
---|---|---|
string | fileNameOrPhrase | The name of the file or the phrase to be played. |
PlayFileOrPhraseAsync(string, CancellationToken)
Asynchronously plays a file or phrase based on the provided string. If the fileNameOrPhrase has a "|" then it is considered a phrase. PlayString(string)
Declaration
Task PlayFileOrPhraseAsync(string fileNameOrPhrase, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | fileNameOrPhrase | The name of the file or the phrase to be played. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
PlayInteger(long)
Speaks out a long. For example 25 would be spoken as 'twenty-five'
Declaration
void PlayInteger(long number)
Parameters
Type | Name | Description |
---|---|---|
long | number | The long to speak out. |
PlayIntegerAsync(long, CancellationToken)
Asynchronously speaks out a long. For example 25 would be spoken as 'twenty-five'
Declaration
Task PlayIntegerAsync(long number, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
long | number | The long to speak out. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
PlayMoney(double)
Speaks a double in money format. For example 5.23 would be spoken as 'five dollars and twenty three cents'
Declaration
void PlayMoney(double number)
Parameters
Type | Name | Description |
---|---|---|
double | number | The number you want to speak |
PlayMoneyAsync(double, CancellationToken)
Asynchronously speaks a double in money format. For example 5.23 would be spoken as 'five dollars and twenty three cents'
Declaration
Task PlayMoneyAsync(double number, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
double | number | The number you want to speak |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
PlayNumber(double)
Speaks out a double. For example 5.23 would be spoken as 'five point two three'
Declaration
void PlayNumber(double number)
Parameters
Type | Name | Description |
---|---|---|
double | number | The number to speak out |
PlayNumberAsync(double, CancellationToken)
Asynchronously speaks out a double. For example 5.23 would be spoken as 'five point two three'
Declaration
Task PlayNumberAsync(double number, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
double | number | The number to speak out |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
PlayOrdinal(int)
Plays a number from 1 to 31. Example 31 would speak 'thirty-first'.
Declaration
void PlayOrdinal(int number)
Parameters
Type | Name | Description |
---|---|---|
int | number | A number between 1 and 31 |
PlayOrdinalAsync(int, CancellationToken)
Asychronously plays a number from 1 to 31. Example 31 would speak 'thirty-first'.
Declaration
Task PlayOrdinalAsync(int number, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
int | number | A number between 1 and 31 |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
PlayPhoneNumber(string)
Plays a phone number as long as it is 7, 10 or 11 characters long.
Declaration
void PlayPhoneNumber(string phoneNumber)
Parameters
Type | Name | Description |
---|---|---|
string | phoneNumber | The phone number must be 7, 10 or 11 characters long with no spaces or dashes. Just numbers. |
PlayPhoneNumberAsync(string, CancellationToken)
Asynchronously plays a phone number as long as it is 7, 10 or 11 characters long.
Declaration
Task PlayPhoneNumberAsync(string phoneNumber, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | phoneNumber | The phone number must be 7, 10 or 11 characters long with no spaces or dashes. Just numbers. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
PlayString(string)
Plays a collection of one or more string parts which are separated with a comma. Each string part is in the format of 'data|code'. You would string them together like: 'data|code,data|code,data|code' etc.
Declaration
void PlayString(string str)
Parameters
Type | Name | Description |
---|---|---|
string | str | The string to interpret in the format of 'data|code,data|code,data|code'... |
Remarks
Each string part is in the format of 'data|code'. You would string them together like: 'data|code,data|code,data|code' etc.
The following codes are supported:
C
- Characters that will be played with thePlayCharacter
method.D
- Expects the data to be a date in month/day/year format. Can be a date, time, or both. UsesDateTime.Parse(data, new CultureInfo("en-US"));
.F
- A file name.M
- A string that can convert to a double value and be spoken with thePlayMoney
method.N
- A string that can convert to a double value and be spoken with thePlayNumber
method.O
- A string number between 1 and 31 that will be spoken with thePlayOrdinal
method.
PlayStringAsync(string, CancellationToken)
Asychronously plays a collection of one or more string parts which are separated with a comma. Each string part is in the format of 'data|code'. You would string them together like: 'data|code,data|code,data|code' etc.
Declaration
Task PlayStringAsync(string str, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | str | The string to interpret in the format of 'data|code,data|code,data|code'... |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
Remarks
Each string part is in the format of 'data|code'. You would string them together like: 'data|code,data|code,data|code' etc.
The following codes are supported:
C
- Characters that will be played with thePlayCharacter
method.D
- Expects the data to be a date in month/day/year format. Can be a date, time, or both. UsesDateTime.Parse(data, new CultureInfo("en-US"));
.F
- A file name.M
- A string that can convert to a double value and be spoken with thePlayMoney
method.N
- A string that can convert to a double value and be spoken with thePlayNumber
method.O
- A string number between 1 and 31 that will be spoken with thePlayOrdinal
method.
PlayTextToSpeech(string)
Converts the specified text into a wav stream and plays it.
Declaration
void PlayTextToSpeech(string textToSpeech)
Parameters
Type | Name | Description |
---|---|---|
string | textToSpeech | The text to convert to speech. |
Exceptions
Type | Condition |
---|---|
VoiceException | If ITextToSpeechFactory wasn't passed to LineManager |
PlayTextToSpeech(ITextToSpeechCache)
Converts the specified text into a wav stream and plays it using ITextToSpeechCache
Declaration
void PlayTextToSpeech(ITextToSpeechCache textToSpeechCache)
Parameters
Type | Name | Description |
---|---|---|
ITextToSpeechCache | textToSpeechCache | Used to generated TTS and possibly save it to a wav file for later use. Will only generate TTS if a wav file is not specified, missing or changed. |
PlayTextToSpeechAsync(string, CancellationToken)
Asynchronously converts the specified text into a wav stream and plays it.
Declaration
Task PlayTextToSpeechAsync(string textToSpeech, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | textToSpeech | The text to convert to speech |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
PlayTextToSpeechAsync(ITextToSpeechCache, CancellationToken)
Asynchronously converts the specified text into a wav stream and plays it using ITextToSpeechCache
Declaration
Task PlayTextToSpeechAsync(ITextToSpeechCache textToSpeechCache, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ITextToSpeechCache | textToSpeechCache | Used to generated TTS and possibly save it to a wav file for later use. Will only generate TTS if a wav file is not specified, missing or changed. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |