(Page 7 of 69 in this chapter) Version
{
DWORD size; /* size of this structure */
DWORD firsttimeout; /* timeout waiting for the first digit */
/* use 0 to wait forever. */
DWORD intertimeout; /* timeout waiting for the next digit */
/* use 0 to wait forever. */
DWORD waitendtone; /* if non-zero, collection does not */
/* end until the end of the final dtmf */
DWORD validDTMFs; /* mask of acceptable digits; use 0 */
/* or ADI_DIGIT_ANY to accept all. */
DWORD terminators; /* mask of terminating digits; use 0 */
/* to indicate no terminators. */
} ADI_COLLECT_PARMS;
int myGetDigits( CTAHD ctahd, char *digits, int maxdigits )
{
ADI_COLLECT_PARMS parms;
CTA_EVENT event;
*digits = 0;
adiGetParms( ADI_COLLECT_PARMID, &parms, sizeof parms );
parms.firsttimeout = 4000; /* wait 4 seconds for first digit */
parms.intertimeout = 2000; /* wait 2 seconds between digits */
adiCollectDigits( ctahd, digits, maxdigits, &parms );
while( 1 )
{
myGetEvent( &event ); /* see ctaWaitEvent example */
switch( event.id )
{
case ADIEVN_COLLECTION_DONE:
if( event.value == CTA_REASON_RELEASED )
return MYDISCONNECT; /* remote hang-up */
else if( CTA_IS_ERROR( event.value ) )
return MYFAILURE; /* AG Access API error */
else if( strlen( digits ) == 0 )
return MYFAILURE; /* no digits provided */
else
return SUCCESS; /* got digits */
break;
case ADIEVN_CALL_DISCONNECTED:
/* In case this event was on the way up when we started
* collection. Wait for 'collection done' event.
*/
break;
case ADIEVN_DIGIT_BEGIN:
case ADIEVN_DIGIT_END:
/* Typically don't want digit events. Wait for the
* string of digits with 'collection done'.
*/
break;
}
}
}
(Page 7 of 69 in this chapter) Version