Table of Contents Index NMS Glossary Previous Page Next Page (Page 49 of 69 in this chapter) Version


adiStartToneDetector

Description

Starts the detection of a precise tone.

Prototype

DWORD adiStartToneDetector (CTAHD ctahd,
unsigned toneid,
unsigned freq1,
unsigned bandw1,
unsigned freq2,
unsigned bandw2,
ADI_TONEDETECT_PARMS *parms)

ctahd CTA context handle returned by ctaCreateContext.

toneid ID or instance of the detector. The range is from 1 to 3. If the current protocol is providing cleardown detection, toneid=1 is not available.

freq1 First (or only) frequency to detect (in Hz).

bandw1 Bandwidth of the first frequency (in Hz)

freq2 The second frequency (in Hz) if the tone contains two frequencies, otherwise zero.

bandw2 Bandwidth of the second frequency.

parms Pointer to tone detection parameters, as shown (NULL designates default values):

typedef struct
{
DWORD size; /* size of this structure */

INT32 qualampl; /* broadband qual level (in dBm) */

DWORD qualtime; /* qualification time (in ms) */

DWORD reflevel; /* qual thresh,output of filter (IDUs) */

DWORD reserved; /* reserved, must be 0 */

} ADI_TONEDETECT_PARMS;

Refer to Appendix C for default values and a more detailed explanation of the fields in this structure.

Return Values

Events

DSP File

For AG and CG hardware, this function may require one of the following DSP files to be specified in the configuration file depending on toneid specified:
CG 6000C Board

AG Boards (general)

AG 2000 and AG 4000/C boards

Description

dtmf.f54/
dtmfe.f54

dtmf.dsp/
dtmfe.dsp

dtmf.m54/
dtmfe.m54

For toneid 1. The CG 6000C board uses dtmf/dtmfe for toneid 2 when detecting a single tone.

ptf.f54

callp.dsp

ptf.m54

For toneid 2 or 3. The CG 6000C board uses dtmf/dtmfe for toneid 2 when detecting a single tone.

Refer to the board-specific installation and developer's manual for a table of MIPS usage for all functions.

For QX hardware, this function is supported in the standard DSP file. Refer to the QX Installation and Developer's Manual for a table of MIPS usage for all functions.

Details

This function starts the detection of a precise tone, which consists of one or two frequencies. The precise tone is defined in terms of center frequency and bandwidth pairs, specified in Hz. Bandwidth is the total band around the center frequency (for example, +/- bandwidth/2).

Once the detector is started, if the specified tone is detected, the ADI service generates a BEGIN event. If the tone stops, the ADI service generates an END event. The detector continues until it is stopped by adiStopToneDetector, which will be followed by a DONE event.

By default, you will probably not need to change ADI_TONEDETECT_PARMS structure. In some cases, you may need to change the minimum qualification time, specified by qualtime.

To set a time limit on the detection, use adiStartTimer to generate a timeout event. Call adiStopToneDetector if a timeout occurred.

See Also

adiStopToneDetector

Example


int myDetectDialtone( CTAHD ctahd )
{
 CTA_EVENT event;
    unsigned toneid = 2;
    unsigned frequency1 = 350;
    unsigned bandwidth1 =  50;
    unsigned frequency2 = 440;
    unsigned bandwidth2 =  50;

    if( adiStartToneDetector( ctahd, toneid, frequency1, bandwidth1,
                              frequency2, bandwidth2, NULL ) != SUCCESS )
        return MYFAILURE;

    while( 1 )
    {
        myGetEvent( &event );           /* see ctaWaitEvent example */

        switch( event.id )
        {
            case ADIEVN_TONE_2_BEGIN:
                adiStopToneDetector( ctahd, toneid );
                break;                      /* on TONE_DETECT_DONE, will return */
            case ADIEVN_TONE_2_DETECT_DONE:
                if( event.value == CTA_REASON_RELEASED )
                    return MYDISCONNECT;    /* call has been terminated */
                else if( CTA_IS_ERROR( event.value ) )
                    return MYFAILURE;       /* API error */
                else
                    return SUCCESS;         /* stopped normally */
                break;
    
            /* might include cases to handle disconnect, DTMFs, etc. */
        }
    }
}


Table of Contents Index NMS Glossary Previous Page Next Page (Page 49 of 69 in this chapter) Version


Want to send us feedback on our documentation? Email: Tech_Pubs@nmss.com
Copyright © 2000, Natural MicroSystems, Inc. All rights reserved.