Interface IPromptMethods
This interface defines the different prompt methods that are available through the line.
A prompt is a file/message to play followed by asking for digits. A multiTryPrompt is one that will repeat x number of times until you get what you expect.
Namespace: ivrToolkit.Core.Interfaces
Assembly: ivrToolkit.Core.dll
Syntax
public interface IPromptMethods
Methods
| Edit this page View SourceMultiTryPrompt(string, Func<string, bool>, MultiTryPromptOptions)
Same as Prompt(string, PromptOptions) but will ask x number of times before the answer is either accepted or there have been too many retries.
Declaration
string MultiTryPrompt(string fileOrPhrase, Func<string, bool> evaluator, MultiTryPromptOptions multiTryPromptOptions = null)
Parameters
Type | Name | Description |
---|---|---|
string | fileOrPhrase | The name of the file or the phrase string to speak out |
Func<string, bool> | evaluator | Pass in a function that will validate the answer. Return true if it is correct or false if incorrect. |
MultiTryPromptOptions | multiTryPromptOptions | Defines prompt options to override the default ones. See MultiTryPromptOptions |
Returns
Type | Description |
---|---|
string | The answer to the prompt |
MultiTryPrompt(ITextToSpeechCache, Func<string, bool>, MultiTryPromptOptions)
Same as Prompt(ITextToSpeechCache, PromptOptions) but will ask x number of times before the answer is either accepted or there
Declaration
string MultiTryPrompt(ITextToSpeechCache textToSpeechCache, Func<string, bool> evaluator, MultiTryPromptOptions multiTryPromptOptions = null)
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. |
Func<string, bool> | evaluator | Pass in a function that will validate the answer. Return true if it is correct or false if incorrect. |
MultiTryPromptOptions | multiTryPromptOptions | Defines prompt options to override the default ones. See MultiTryPromptOptions |
Returns
Type | Description |
---|---|
string | The answer to the prompt |
MultiTryPromptAsync(string, Func<string, bool>, CancellationToken)
Same as Prompt(string, PromptOptions) but will ask x number of times before the answer is either accepted or there
Declaration
Task<string> MultiTryPromptAsync(string fileOrPhrase, Func<string, bool> evaluator, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | fileOrPhrase | The name of the file or the phrase string to speak out |
Func<string, bool> | evaluator | Pass in a function that will validate the answer. Return true if it is correct or false if incorrect. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task<string> | The answer to the prompt |
MultiTryPromptAsync(string, Func<string, bool>, MultiTryPromptOptions, CancellationToken)
Same as Prompt(string, PromptOptions) but will ask x number of times before the answer is either accepted or there
Declaration
Task<string> MultiTryPromptAsync(string fileOrPhrase, Func<string, bool> evaluator, MultiTryPromptOptions multiTryPromptOptions, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | fileOrPhrase | The name of the file or the phrase string to speak out |
Func<string, bool> | evaluator | Pass in a function that will validate the answer. Return true if it is correct or false if incorrect. |
MultiTryPromptOptions | multiTryPromptOptions | Defines prompt options to override the default ones. Leave as null to keep the default options. See MultiTryPromptOptions |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task<string> | The answer to the prompt |
MultiTryPromptAsync(ITextToSpeechCache, Func<string, bool>, CancellationToken)
Same as Prompt(ITextToSpeechCache, PromptOptions) but will ask x number of times before the answer is either accepted or there
Declaration
Task<string> MultiTryPromptAsync(ITextToSpeechCache textToSpeechCache, Func<string, bool> evaluator, 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. |
Func<string, bool> | evaluator | Pass in a function that will validate the answer. Return true if it is correct or false if incorrect. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task<string> | The answer to the prompt |
MultiTryPromptAsync(ITextToSpeechCache, Func<string, bool>, MultiTryPromptOptions, CancellationToken)
Same as Prompt(ITextToSpeechCache, PromptOptions) but will ask x number of times before the answer is either accepted or there
Declaration
Task<string> MultiTryPromptAsync(ITextToSpeechCache textToSpeechCache, Func<string, bool> evaluator, MultiTryPromptOptions multiTryPromptOptions, 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. |
Func<string, bool> | evaluator | Pass in a function that will validate the answer. Return true if it is correct or false if incorrect. |
MultiTryPromptOptions | multiTryPromptOptions | Defines prompt options to override the default ones. See MultiTryPromptOptions |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task<string> | The answer to the prompt |
Prompt(string, PromptOptions)
Speaks a file/phrase to a person on the call and then expects digits to be pressed.
Declaration
string Prompt(string fileOrPhrase, PromptOptions promptOptions = null)
Parameters
Type | Name | Description |
---|---|---|
string | fileOrPhrase | The name of the file or the phrase string to speak out |
PromptOptions | promptOptions | Defines prompt options to override the default ones. See PromptOptions |
Returns
Type | Description |
---|---|
string | The answer to the prompt |
Prompt(ITextToSpeechCache, PromptOptions)
Speaks out the text-to-speech message using ITextToSpeechCache and then expects digits to be pressed.
Declaration
string Prompt(ITextToSpeechCache textToSpeechCache, PromptOptions promptOptions = null)
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. |
PromptOptions | promptOptions | Defines prompt options to override the default ones. See PromptOptions |
Returns
Type | Description |
---|---|
string | The answer to the prompt |
PromptAsync(string, CancellationToken, PromptOptions)
Asynchronously speaks a file/phrase to a person on the call and then expects digits to be pressed.
Declaration
Task<string> PromptAsync(string fileOrPhrase, CancellationToken cancellationToken, PromptOptions promptOptions = null)
Parameters
Type | Name | Description |
---|---|---|
string | fileOrPhrase | The name of the file or the phrase string to speak out |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
PromptOptions | promptOptions | Defines prompt options to override the default ones. Leave as null to keep the default options. See PromptOptions |
Returns
Type | Description |
---|---|
Task<string> | The answer to the prompt |
PromptAsync(ITextToSpeechCache, CancellationToken, PromptOptions)
Asynchronously speaks out the text-to-speech message using ITextToSpeechCache and then expects digits to be pressed.
Declaration
Task<string> PromptAsync(ITextToSpeechCache textToSpeechCache, CancellationToken cancellationToken, PromptOptions promptOptions = null)
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. |
PromptOptions | promptOptions | Defines prompt options to override the default ones. See PromptOptions |
Returns
Type | Description |
---|---|
Task<string> | The answer to the prompt |