Avaya Logo

Previous Topic

Next Topic

Book Contents

Book Index

phreserve

The phreserve instruction creates space for a phrase in a talkfile.

Synopsis

phreserve(type.phrase,type.talk,type.time,type.style)

Description

The phreserve instruction creates an area in a talkfile that is used to store a phrase and specifies the coding style and rate to be used. This phrase is later encoded by the vc instruction. The arguments for the phreserve instruction are:

type.phrase

Specifies the phrase ID of the phrase to be created (valid range is 1 through 65,535)

type.talk

Specifies the talkfile ID of the talkfile where the phrase is stored (valid range is 1 through 255)

type.time

Specifies the amount of space, or time (in seconds), to be reserved for the phrase in the talkfile.

type.style

Specifies the coding style and rate to be used. The coding styles and rates are defined in the header file codestyle.h. If the coding style and rate are invalid, the instruction fails. Do not use character data types for any of these arguments.

If type.phrase is -1, the system assigns a phrase ID and returns this id in register 1. The phrase id can be used to reference the phrase (for example, in a talk instruction) once it has been coded and stored in the talkfile by the vc instruction. If type.talk is -1, the system selects a default value (255) for the talkfile and returns the id of the selected talkfile in register 0.

Note:
If there are two phreserve instructions, there must be a vc instruction between them or the second phreserve instruction fails.

When both type.talk and type.phrase are -1, both a phrase ID and talkfile ID are chosen by the system and returned in registers 1 and 0 respectively. Since registers 0 and 1 can be used implicitly to store talkfile or phrase IDs, the script writer must take care to save the contents of these registers before the phreserve is executed.

If type.phrase matches the phrase ID in the specified talkfile, the existing phrase is replaced by the new phrase. The value 0 or -1 for the type.time argument can be used to indicate that the phreserve instruction should not allocate any space. If enough space is available to store the phrase when coding ends, the phrase is stored. If there is not enough space, an error message is issued from the vc instruction.

If you add phrase 0 to any talkfile, the phrase is added as phrase 65535 the first time. If the command is executed again, the phrase is added to the talkfile as phrase 65534, then 65533, etc.

If the instruction is successfully completed, the return values are:

If the instruction is not successfully completed, the return value in register 0 is negative.

Note:
If the script terminates before vc instruction is used, the space allocated to the phrase is freed and the phrase number is reused the next time a phreserve instruction is executed. A new phrase is not stored in the speech file system until a successful vc is performed.

Example

In the following example, an area in talkfile 15 is created to store the phrase. The ID for the phrase is returned in register 1 and then loaded into location int.PHRASE. Since type.time is -1, the script writer relies on the system having enough space to store the phrase.

load(int.TALKID,15)
phreserve(-1,int.TALKID,-1,ADPCM32)
load(int.PHRASE,r.1)

In the following example, 10 seconds (using ADPCM 32 Kbs coding) of storage are allocated in talkfile 23 for phrase 8.

load(ch.20,8)
phreserve(ch.20,23,10,ADPCM32)

© 2006 Avaya Inc. All Rights Reserved.