Intel 05-1832-002 IP Phone User Manual


 
126 Voice API for Windows Operating Systems Library Reference — November 2003
dx_addtone( ) — add a user-defined tone
EDX_FREQDET
Invalid tone frequency
EDX_INVSUBCMD
Invalid sub-command
EDX_MAXTMPLT
Maximum number of user-defined tones for the board
EDX_SYSTEM
Error from operating system; use dx_fileerrno( ) to obtain error value
EDX_TONEID
Invalid tone template ID
!
!!
! Example
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
#define TID_1 101
#define TID_2 102
#define TID_3 103
#define TID_4 104
main()
{
int dxxxdev;
/*
* Open the Voice Channel Device and Enable a Handler
*/
if ( ( dxxxdev = 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" );
}
/*
* Bind the Tone to the Channel
*/
if (
dx_addtone( dxxxdev, NULL, 0 )
== -1 ) {
printf( "Unable to Bind the Tone %d\n", TID_1 );
printf( "Lasterror = %d Err Msg = %s\n",
ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ));
dx_close( dxxxdev );
exit( 1 );
}