32 Voice API for Linux Demo Guide — June 2005
Demo Details
}
/* Not a valid response */
playmsg(retry);
} while (--numretry);
/*
* No valid response within max. # of retries, so call fatal error
* handler for this menu, if any provided, and then hang up and go idle.
*/
if (error)
(*error)();
longjmp(idlestate,1);
/* never gets here but makes lint happy */
return (NULL);
}
The memcpy( ) function call copies the default get digit DV_TPT array, def_dg_tpt, into the local
structure, dattpt. The local DV_TPT array is redefined by using the values of the current menu's
DL_DATA structure, datap, in the following code fragment:
dattpt[DX_MAXDTMF-1].tp_length=datap->da_recvdig;
dattpt[DX_MAXTIME-1].tp_length=datap->da_time;
dattpt[DX_DIGMASK-1].tp_length=bld_tdig_msk(datap->da_digit);
The caller's response to the voice prompt is received by the library call to dx_getdig( ) or
dx_getdigEx( ). The reason for termination is checked in the call to the system function
check_term( ).
The call to the function pointed to by validfnc validates the caller's response. If the response is
invalid, the validation function returns a failure, the error message is played, and the caller is
prompted to input another response. If the caller does not give a correct response within the
maximum number of retries, the error message is played, and the process jumps back to the
idlestate. The idlestate is defined in main( ) by the code:
main(argc,argv)
.
.
(void)setjmp(idlestate); /* where idlestate is defined */
When the longjmp(idlestate,1) call is made in gt_data( ), the control jumps to the statement
directly after the setjmp(idlestate) call in main( ).
check_term( )
When an I/O function returns, the check_term( ) function is used to find out the reason for
termination.
void check_term( )
{
if(ATDX_TERMMSK(devhandle)&(TM_MAXNOSIL|TM_LCOFF|TM_PATTERN|TM_USRSTOP)){
longjmp(idlestat,1); /*hang up&ready for new call */
}
return;
}