One or more ftalk or talk instructions in a script cause a list of phrases to be played. If a failure occurs in the process of playing one or more phrases, the Avaya IR system software plays as many phrases as possible but returns an error code of -1 in r.0. When using the tflush instruction, the script writer can tell the script to check r.0 for the returned status.
When ftalk or talk instructions are executed, the system queues phrases in a buffer, but the phrases are not immediately played. Phrases are played when:
In order to check the status of a list of phrases being queued, the script must examine r.0 immediately after one or more talk instructions have been executed. By entering the tflush instruction in the script, the status can be obtained immediately following one or more ftalk or talk instructions. The tflush instruction, like other speech-flushing instructions, causes the phrases queued by the ftalk or talk instructions to be played. But only tflush retains the returned status from playing phrases in r.0. The other instructions may overwrite r.0 with their own return status.
The following is an example of using tflush to examine the returned status of queued phrases:
talk ("Hello")
talk (200)
talk ("Enter your ID")
tflush()
jmp(r.0 < 0,play_fail)
getinput(ch.ID, 4)
--
--
--
play_fail:
quit(3)
In this example, several phrases are queued as the result of the three talk instructions. The tflush instruction is optional and does not have to be used. Its function is to allow the script writer to check the status when phrases are played. When the tflush instruction is completed, r.0 contains 0 if no errors occurred. Otherwise, it contains -1. If there are errors in the play, control jumps to the label play_fail.
It is recommended that the tflush instruction be used only after several ftalk or talk instructions have executed, or after every ftalk or talk instruction. Each time tflush is executed, two interprocess messages are sent: TSM sends a message to a system process which causes the phrases to be played and the system process returns a message to TSM which contains the status. These processes can delay play of a script if tflush is used too often.
Note:
Take care to avoid program loops that queue up large numbers of phrases before playing them with tflush or other speech flushing instruction. TSM uses dynamic memory allocation to store the phrase queue. Allowing the queue to become too large before flushing it could cause the TSM process to become too large, negatively affecting system performance (60 phrases is a reasonable queue limit).