(Page 46 of 80 in this chapter)


adiStartCallProgress

Description

Starts monitoring call progress analysis data.

Prototype

DWORD adiStartCallProgress( CTAHD ctahd,
ADI_CALLPROG_PARMS *parms)

ctahd Context handle returned by adiOpenPort.

parms Pointer to call progress analysis parameters, stored in the ADI_CALLPROG_PARMS, as follows (NULL designates default values):

typedef struct
{
DWORD size; /* Size of this structure */
DWORD timeout;
/* If no tone/voice detected, done via timeout (ms).*/
DWORD busycount;
/* Number of busy cycles until report and quit; */
/* busycount ignored if precise busy detected. */
DWORD ringcount;
/* Number of ring cycles until report and quit. */
DWORD maxreorder;
/* Separates reorder (fast busy) from busy (ms) */
DWORD maxbusy; /* Separates busy from ring cycle (ms) */
DWORD maxring; /* Separates ring from dial tones (ms) */
DWORD maxringperiod;
/* Maximum ring period before CP_RING_QUIT (ms) */
DWORD voicemedium;
/* Time after VOICE BEGIN until VOICE MEDIUM (ms) */
DWORD voicelong;
/* Time after VOICE BEGIN until VOICE LONG (ms) */
DWORD voicextended;
/* Time after VOICE BEGIN until VOICE EXTENDED (ms) */
DWORD silencetime;
/* Silence period after voice til VOICE END (ms) */
DWORD precqualtime;
/* Precise tone qualification time (ms) */
DWORD precmask; /* Precise tone mask */
DWORD stopmask; /* mask to auto-stop adiCallProgress: */
INT32 silencelevel;
/* Reference level below which is "silence" (dBm) */
DWORD voicetoneratio; /* voice vs. tone ratio (IDUs) */
DWORD qualtonetime1;
/* Qualify time 1 for the TONE state (ms); */
DWORD qualtonetime2;
/* Qualify time 2 for the TONE state (ms); */
DWORD qualvoicetime1;
/* Qualify time 1 for the VOICE state (ms); */
DWORD qualvoicetime2;
/* Qualify time 2 for the VOICE state (ms); */
DWORD leakagetime;
/* Leaky integrator time constant (in ms) */
DWORD noiselevel;
/* Level window for QT2 state (in IDUs) */
} ADI_CALLPROG_PARMS;

Return Values

Events

DSP File Requirement

This function requires that callp.dsp has been loaded by agmon.

Details

Starts the call progress analysis operation. This is the same functionality utilized by call control. It can be used by applications that are not using standard call control, or by any application during the connected state.

Note: Do not modify the following fields in the ADI_CALLPROG_PARMS structures; doing so may compromise your application's ability to interact with the telephone network:

The call progress analysis operation always terminates when any of the following events occur:

In addition, you can configure the ADI_CALLPROG stopmask parameter to stop on occurrence of any of the following events:

See Also

adiStopCallProgress

Example


/* Wait for voice detection or any network tone.
 * Returns SUCCESS if voice is detected within 30 seconds, else DISCONNECT.
 */
int waitforvoice( CTAHD ctahd )
{
    ADI_CALLPROG_PARMS parms;
    ADI_EVENT          event;
    DWORD              last_cp_event = 0;

    adiGetParms (ADI_CALLPROG_PARMID, &parms, sizeof parms);
    parms.stopmask |= ADI_CPSTOP_ON_VOICE_BEGIN;
    parms.timeout  = 30000;      /* Increase timeout from default 10 seconds */

    if( adiStartCallProgress (ctahd, &parms) != SUCCESS )
        return MYFAILURE;

    do 
    {
        myGetEvent( &event );           /* see adiFetchAndProcess example */

        if (ADIEVN_CP_VOICE <= event.id && event.id <= ADIEVN_CP_CED)
             last_cp_event = event.id;

    } while (event.id != ADIEVN_CP_DONE);

    switch (event.value)
    {
        case CTA_REASON_FINISHED:
            if (last_cp_event == ADIEVN_CP_VOICE)
                return  SUCCESS;
            else
                return  MYDISCONNECT;       /* hang-up tone detected */

        case CTA_REASON_TIMEOUT:            /* nothing detected - give up */
        case CTA_REASON_RELEASED:           /* The call was terminated */
        case CTA_REASON_STOPPED:
        default:
            return  MYDISCONNECT;
    }
}



(Page 46 of 80 in this chapter)


Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights reserved.