Intel 05-1832-002 IP Phone User Manual


 
116 Voice API for Windows Operating Systems Library Reference — November 2003
ATDX_TONEID( ) — return user-defined tone ID that terminated I/O function
/*
* Open the D/xxx Channel Device and Enable a Handler
*/
if ( ( chdev = dx_open( "dxxxB1C1", NULL ) ) == -1 ) {
perror( "dxxxB1C1" );
exit( 1 );
}
/*
* Describe a Simple Dual Tone Frequency Tone of 950-
* 1050 Hz and 475-525 Hz using leading edge detection.
*/
if ( dx_blddt( TID_1, 1000, 50, 500, 25, TN_LEADING )== -1 ) {
printf( "Unable to build a Dual Tone Template\n" );
}
/*
* Add the Tone to the Channel
*/
if ( dx_addtone( chdev, NULL, 0 ) == -1 ) {
printf( "Unable to Add the Tone %d\n", TID_1 );
printf( "Lasterror = %d Err Msg = %s\n",
ATDV_LASTERR( chdev ), ATDV_ERRMSGP( chdev ) );
dx_close( chdev );
exit( 1 );
}
/*
* Build a Tone Generation Template.
* This template has Frequency1 = 1140,
* Frequency2 = 1020, amplitute at -10dB for
* both frequencies and duration of 100 * 10 msecs.
*/
dx_bldtngen( &tngen, 1140, 1020, -10, -10, 100 );
/*
* Set up the Terminating Conditions
*/
tpt[0].tp_type = IO_CONT;
tpt[0].tp_termno = DX_TONE;
tpt[0].tp_length = TID_1;
tpt[0].tp_flags = TF_TONE;
tpt[0].tp_data = DX_TONEON;
tpt[1].tp_type = IO_CONT;
tpt[1].tp_termno = DX_TONE;
tpt[1].tp_length = TID_1;
tpt[1].tp_flags = TF_TONE;
tpt[1].tp_data = DX_TONEOFF;
tpt[2].tp_type = IO_EOT;
tpt[2].tp_termno = DX_MAXTIME;
tpt[2].tp_length = 6000;
tpt[2].tp_flags = TF_MAXTIME;
if (dx_playtone( chdev, &tngen, tpt, EV_SYNC ) == -1 ){
printf( "Unable to Play the Tone\n" );
printf( "Lasterror = %d Err Msg = %s\n",
ATDV_LASTERR( chdev ), ATDV_ERRMSGP( chdev ) );
dx_close( chdev );
exit( 1 );
}
if ( ATDX_TERMMSK( chdev ) & TM_TONE ) {
printf( "Terminated by Tone Id = %d\n",
ATDX_TONEID( chdev )
);
}