Voice API for Linux Demo Guide — June 2005 33
Demo Details
check_term( ) uses ATDX_TERMMSK( ) attribute to check the termination type. If the I/O
function was terminated for any of the cases, the function calls a longjmp( ) and returns to
idlestate. If none of these terminations occurred, the caller is still on the line, and the response must
be validated.
5.5.5 Messaging System Routine
The messaging system provides a way to play voice prompts or digits by specifying the name. It
implements the dx_play( ) function at a higher level. For example, to play the greeting message, a
single argument to the playmsg( ) function is required:
playmsg("intro");

Implementation

The message playback is implemented by using two data structures, DL_MSGS and
DL_MSGTBL, and by the following functions defined in d4xtools.c:
playmsg( )
plaympmsg( )
buildmsg( )
buildmsg_v( )
builddate( )
gt_groupiott( )
gt_iott( )
gt_numiott( )
gt_pairiott( )
The DL_MSGTBL structure provides the physical file name, the descriptor, and the device type for
a file of messages. The initialization routine, init_sys( ), will open the file and provide a file
descriptor for each filename provided in the mt_fn field. The message system requires a NULL-
terminated array of DL_MSGTBL structures.
typedef struct DL_MSGTBL {
DL_MSGS mt_msgsp; /* Pointer to a message structure*/
char mt_fn; /* Pointer to file name */
int mt_fd; /* File descriptor*/
int mt_typ /* Type of the storage media*/
} DL_MSGS;
The DL_MSGS structure makes the location of the message transparent to the application by using
the structure to assign an ASCII name to the message's offset and length. To signify the end of the
messages, the message system requires a NULL-terminated DL_MSGS array for each
DL_MSGTBL structure.
typedef struct dx_msgs {
char * ms_msgname; /* Pointer to message name*/
long ms_ofset; /* Offset of this message - used in a DX_IOTT*/
unsigned ms_lngth; /* Length of this message - used in a DX_IOTT*/
} DL_MSGS;