(Page 5 of 5 in this chapter)


7.4 Using Asynchronous Digit Collection Functions

AG Access enables applications to collect DTMF digit strings asynchronously into their own buffers. adiCollectDigits initiates digit collection into a user-specified buffer (rather than into the AG Access digit queue). Digits are appended to the user-specified buffer until a terminating event occurs. Figure 27 illustrates the asynchronous digit collection process.

Note: Because they perform read/write operations on the internal digit queue, an application cannot call adiGetDigit and adiFlushDigitQueue while actively collecting digits. AG Access will return an error if an application attempts to modify the internal digit queue while digit collection is active.

7.4.1 Digit Collection Parameters

You can modify the collection operation's default behavior by re-defining the parameters in ADI_COLLECT_PARMS when invoking adiCollectDigits. The digit collection parameters are:

7.4.2 Terminating Asynchronous Digit Collection

The collection operation has programmable termination conditions. An application can also prematurely terminate the function by invoking adiStopCollection. In all cases, AG Access sends an ADIEVN_COLLECTION_DONE event to the application, which indicates that collection has finished. The value field contains the termination reason. These reasons are defined in the AG Access Function Reference Manual.

An argument to adiCollectDigits, maxdigits, specifies the maximum number of digits to collect. Only digits written to the user buffer are counted (i.e., digits discarded because they are not in the acceptable list are not counted). Digit collection terminates when this maximum digit count is reached.

If digits are already stored in AG Access' internal digit queue when adiCollectDigits is invoked, AG Access processes the digits individually from the front of the AG Access digit queue. Each digit processed is checked against a list of acceptable digits, and a list of terminating digits, which are stored in the validDTMFs and terminators fields in the ADI_COLLECT_PARMS structure. Invalid digits are discarded. Terminating digits cause the digit collection operation to terminate.

When digit collection terminates, the ADIEVN_COLLECTION_DONE event is delivered to the application.

Digit collection can also terminate when the interdigit timeout value in ADI_COLLECT_PARMS is exceeded.

When the ADIEVN_COLLECTION_DONE event is delivered to the application, one of the following reasons is in its value field:

Reason

Description

CTA_REASON_FINISHED

The number of digits requested was received.

CTA_REASON_STOPPED

The application invoked adiStopCollection.

CTA_REASON_TIMEOUT

Timeout occurred waiting for a digit.

CTA_REASON_DIGIT

A terminating digit was received.

CTA_REASON_RELEASED

The call was released.



(Page 5 of 5 in this chapter)


tech_support@nmss.com
Copyright © 1997, Natural MicroSystems, Inc. All rights reserved.