Interface IIvrBaseLine
This interface provides methods to control the selected IVR plugin. It is primarily used by the ivrToolkit.Core.Util.LineWrapper class.
Inherited Members
Namespace: ivrToolkit.Core.Interfaces
Assembly: ivrToolkit.Core.dll
Syntax
public interface IIvrBaseLine : IDisposable
Properties
| Edit this page View SourceLastTerminator
Gets or sets the last terminator key that was pressed.
Declaration
string LastTerminator { get; set; }
Property Value
Type | Description |
---|---|
string |
LineNumber
Gets the attached line number.
Declaration
int LineNumber { get; }
Property Value
Type | Description |
---|---|
int |
Management
Provides functionality for managing the line from another thread.
Declaration
IIvrLineManagement Management { get; }
Property Value
Type | Description |
---|---|
IIvrLineManagement |
Volume
Gets or sets the volume level. Valid range: -10 to 10 (0 is default volume).
Declaration
int Volume { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceDial(string, int)
Dials a phone number using call progress analysis.
Declaration
CallAnalysis Dial(string phoneNumber, int answeringMachineLengthInMilliseconds)
Parameters
Type | Name | Description |
---|---|---|
string | phoneNumber | The phone number to call. |
int | answeringMachineLengthInMilliseconds | The threshold for determining an answering machine. Detects the callee's greeting duration.0 = no answering machine detection. |
Returns
Type | Description |
---|---|
CallAnalysis | A CallAnalysis object containing call results. |
DialAsync(string, int, CancellationToken)
Asynchronously dials a phone number using call progress analysis.
Declaration
Task<CallAnalysis> DialAsync(string phoneNumber, int answeringMachineLengthInMilliseconds, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | phoneNumber | The phone number to call. |
int | answeringMachineLengthInMilliseconds | The threshold for determining an answering machine. Detects the callee's greeting duration.0 = no answering machine detection. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task<CallAnalysis> | A task representing the asynchronous operation, returning a CallAnalysis object. |
FlushDigitBuffer()
Clears the digit buffer and returns all previously collected digits, including terminators.
Declaration
string FlushDigitBuffer()
Returns
Type | Description |
---|---|
string | All digits in the buffer. |
GetDigits(int, string, int)
Collects digits from the user until the specified number is reached or a terminator is pressed.
Declaration
string GetDigits(int numberOfDigits, string terminators, int interDigitTimeoutMilliseconds = 0)
Parameters
Type | Name | Description |
---|---|---|
int | numberOfDigits | The maximum number of digits to capture. |
string | terminators | The valid terminator keys. |
int | interDigitTimeoutMilliseconds | The timeout duration between keypresses in milliseconds (0 to use default). |
Returns
Type | Description |
---|---|
string | The collected digits, excluding the terminator if used. |
GetDigitsAsync(int, string, CancellationToken, int)
Asynchronously collects digits from the user until the specified number is reached or a terminator is pressed.
Declaration
Task<string> GetDigitsAsync(int numberOfDigits, string terminators, CancellationToken cancellationToken, int interDigitTimeoutMilliseconds = 0)
Parameters
Type | Name | Description |
---|---|---|
int | numberOfDigits | The maximum number of digits to capture. |
string | terminators | The valid terminator keys. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
int | interDigitTimeoutMilliseconds | The timeout duration between keypresses in milliseconds (0 to use default). |
Returns
Type | Description |
---|---|
Task<string> | The collected digits, excluding the terminator if used. |
Hangup()
Forces a hangup on the current line.
Declaration
void Hangup()
PlayFile(string)
Plays a WAV file (8000Hz, mono, signed 16-bit PCM).
Declaration
void PlayFile(string filename)
Parameters
Type | Name | Description |
---|---|---|
string | filename | The path to the WAV file. |
PlayFileAsync(string, CancellationToken)
Asynchronously plays a WAV file (8000Hz, mono, signed 16-bit PCM).
Declaration
Task PlayFileAsync(string filename, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | filename | The path to the WAV file. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
PlayWavStream(WavStream)
Plays a WAV audio stream.
Declaration
void PlayWavStream(WavStream audioStream)
Parameters
Type | Name | Description |
---|---|---|
WavStream | audioStream | The audio stream, including the WAV header. |
PlayWavStreamAsync(WavStream, CancellationToken)
Asynchronously plays a WAV audio stream.
Declaration
Task PlayWavStreamAsync(WavStream audioStream, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
WavStream | audioStream | The audio stream, including the WAV header. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
RecordToFile(string)
Records a WAV file (8000Hz, mono, signed 16-bit PCM) to disk.
Declaration
void RecordToFile(string filename)
Parameters
Type | Name | Description |
---|---|---|
string | filename | The output file path. |
RecordToFile(string, int)
Records a WAV file with a specified timeout (8000Hz, mono, signed 16-bit PCM) to disk.
Declaration
void RecordToFile(string filename, int timeoutMilliseconds)
Parameters
Type | Name | Description |
---|---|---|
string | filename | The output file path. |
int | timeoutMilliseconds | The maximum recording duration in milliseconds. |
RecordToFileAsync(string, int, CancellationToken)
Asynchronously records a WAV file with a specified timeout (8000Hz, mono, signed 16-bit PCM) to disk.
Declaration
Task RecordToFileAsync(string filename, int timeoutMilliseconds, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | filename | The output file path. |
int | timeoutMilliseconds | The maximum recording duration in milliseconds. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
RecordToFileAsync(string, CancellationToken)
Asynchronously records a WAV file (8000Hz, mono, signed 16-bit PCM) to disk.
Declaration
Task RecordToFileAsync(string filename, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | filename | The output file path. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |
Reset()
Disposes of the line and re-initializes it.
Declaration
void Reset()
StartIncomingListener(Func<IIvrLine, CancellationToken, Task>, IIvrLine, CancellationToken)
Starts an incoming call listener with a callback function.
Declaration
void StartIncomingListener(Func<IIvrLine, CancellationToken, Task> callback, IIvrLine line, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Func<IIvrLine, CancellationToken, Task> | callback | The function to execute when a call is received. |
IIvrLine | line | The line instance. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
TakeOffHook()
Takes the line off hook.
Declaration
void TakeOffHook()
WaitRings(int)
Waits for a specified number of rings before answering.
Declaration
void WaitRings(int rings)
Parameters
Type | Name | Description |
---|---|---|
int | rings | The number of rings to wait. |
WaitRingsAsync(int, CancellationToken)
Asynchronously waits for a specified number of rings before answering.
Declaration
Task WaitRingsAsync(int rings, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
int | rings | The number of rings to wait. |
CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
Type | Description |
---|---|
Task |