Voice API for Linux Demo Guide — June 2005 29
Demo Details
DL_DATA Data Structure
The DL_DATA structure defines the termination conditions for getting the response to the menu
options. It holds the values for several fields that map to corresponding DV_TPT elements used
when getting a caller's response. These are used with the global termination conditions located in
def_dg_tpt.
typedef struct DL_DATA {
unsigned short da_recvdig; /* Number of digits to receive */
unsigned short da_time; /* Maximum time limit */
char * da_digit; /* Terminating digit string */
unsigned short da_numretry; /* Number of retries before giving up */
}DL_DATA;
The fields are defined as follows:
da_recvdig
Receive Digits - The maximum number of digits to receive.
da_time
Time Limit - The amount of time a caller has to respond to the voice prompt. (100 ms units)
da_digit
Digit String - A string of specific digits, any one of which will terminate the I/O when
received.
da_numretry
Number of Retries - The number of retries the caller has to press a correct digit.
In d40demo.c, the variable data_1 defines the termination conditions for the root menu. The
comments explain what each value indicates.
DL_DATA data_1 ={
1, /* Read only 1 digit */
100, /* Allow 10 seconds for entering it */
NULL, /* No termination digits needed */
3 /* Allow 3 retries for entry */
};
menu_engine( ) function
The menu_engine( ) function is defined in the d4xtools.c module. Its purpose is to control flow of
the program by using the menu tables.
void menu_engine( )
{
DL_MNUOPTS * rspentry;
DL_MENU * tmp;
char digbuf[2];
/* The following is the main menuing system engine. Its purpose
* is to drive the application as defined by the menu pointed to by
* cur_menu.
*/
while(1) {
/*
* Execute the response parser