# adiFlushDigitQueue

Flushes the internal digit collection queue.

#### Supported board types

- AG

- CG

#### Prototype

DWORD adiFlushDigitQueue ( CTAHD ctahd)

Argument | Description
ctahd | Context handle returned by ctaCreateContext or ctaAttachContext.

#### Return values

Return value | Description
SUCCESS |
CTAERR_FUNCTION_ACTIVE | Digit collection function is active.
CTAERR_INVALID_CTAHD | Context handle is invalid.
CTAERR_INVALID_STATE | Function not valid in the current port state.
CTAERR_SVR_COMM | Server communication error.

#### Details

Use adiFlushDigitQueue to discard all digits in the ADI service internal digit collection queue. This function cannot be invoked while the application is actively collecting digits using adiCollectDigits.

If any digits are queued in the ADI service when a play or record voice operation is started, and the voice operation is to terminate on those specific touchtones, the voice operation terminates immediately. To prevent this from happening, use adiFlushDigitQueue or adiGetDigit to remove the escape key from the queue.

The digit queue is automatically flushed when a call is released.

For more information, refer to Collecting digits.

#### See also

adiPeekDigit, adiStopCollection

#### Example

/* Play a message, ignoring dtmfs. */
int myPlayToCompletion( CTAHD ctahd, unsigned encoding, void *buffer, unsigned bufsize )
{
ADI_PLAY_PARMS playparms;
CTA_EVENT event;
ctaGetParms( ADI_COLLECT_PARMID, &playparms, sizeof playparms );
playparms.DTMFabort = 0x0;
adiPlayFromMemory( ctahd, encoding, buffer, bufsize, &playparms );
do
{
myGetEvent( &event ); /* see ctaWaitEvent example */
} while( event.id != ADIEVN_PLAY_DONE );
if( event.value != CTA_REASON_FINISHED )
return MYFAILURE;
/* We've finished playing an uninteruptable message (no DTMF abort).
* but some DTMFs may have been pressed and are sitting in the digit
* collection queue. If we don't remove them, the queued digits
* will cause the next interruptible play to be aborted immediately.
*/
adiFlushDigitQueue( ctahd );
return SUCCESS;
}