Initial Setup Properties |
||
Common (Voice and Data) |
||
|
|
|
Voice Only |
||
|
|
|
Runtime Properties |
||
Common (Voice and Data) |
||
Voice Only |
||
Greetings |
||
Common (Voice and Data) |
||
|
||
Data Only |
||
|
||
Methods |
||
Common (Voice and Data) |
||
Events |
||
Common (Voice and Data) |
||
Overview
All VBVoice events' code is executed in the primary thread; in order to keep the system responsive this code should be as fast as possible. Blocking for a certain time would affect all other channels because they are waiting for their events' code to be executed. WorkerThread is helping to get your lengthy code executed in a separate thread and avoid blocking the primary thread.
The WorkerThread Control offers the application a way to run certain lengthy code (like accessing database or waiting synchronously for a resource) in a separate thread (worker thread), leaving the primary thread free to execute Windows and other VBVoice events. While waiting for completion of the action from the worker thread, the channel is doing voice processing in a way similar to the Delay control, playing music or waiting silently.
This is especially usefully when an outside process could take an unpredictable amount of time (e.g. a complex database query, or slow response times). The caller will experience this like a standard Delay Control, and the call will exit from the control after the code executed in the worker thread completed.
The call stays in WorkerThread until at least one of the following conditions are met:
- The code being executed in the worker thread has finished ( exited the Run function of the job class);
- The MaxWaitTime set for the WorkerThread Control has been reached.
Each WorkerThread control in a system has its own thread pool, but the following technique guarantees optimum usage of threads. At system start, a minimum number of threads (IMinimumThreads) are initialized. Later, more threads could be created as needed up to a maximum set by IMaximumThreads. The pool may also shrink to its minimum limit when certain threads are idle for period longer than IThreadIdleTime.
The WorkerThread control can operate in three modes:
-
Simulated Hold: VBVoice plays a greeting (hold music) to the caller during the wait period. When playing hold music, VBVoice continually plays a short file containing music or a short announcement. The music can be replaced with a VB Phrase in order to be dynamically generated in the PlayRequest event.
-
Silent: VBVoice remains silent during job execution.
-
Silent Without Resources: VBVoice also remains silent during this control but will not attempt to get any voice resources for the line, if the line does not already have one.