(Page 49 of 69 in this chapter) Version
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;
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. */
}
}
}
(Page 49 of 69 in this chapter) Version