
Description | Example | Cautions | Errors | See Also
Name: |
int dx_distone(chdev,toneid,evt_mask) | |
Inputs: |
int chdev |
|
int toneid |
| |
int evt_mask |
| |
Returns: |
=0 |
|
-1 |
| |
Category: |
Global Tone Detection | |
The dx_distone( ) function disables detection of a user-defined tone on a channel, as well as the TONE ON and/or TONE OFF events for that tone. Detection capability for user-defined tones is enabled on a channel by default when dx_addtone( ) is called.
Parameter |
Description | |
chdev |
specifies the valid channel device handle obtained when the channel was opened using dx_open( ). | |
toneid |
specifies the user-defined tone identifier for which detection is being disabled. | |
To disable detection of all user-defined tones on the channel, set toneid to TONEALL. | ||
evt_mask |
specifies whether to disable detection of the user-defined tone going on or going off. Set to one or both of the following using a bitwise-OR (|) operator. | |
|
disable TONE ON detection | |
|
disable TONE OFF detection | |
evt_mask affects the enabled/disabled status of the tone template and will remain in effect until dx_distone( ) or dx_enbtone( ) is called again to reset it. | ||
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
#define TID_1 101
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 );
}
/*
* Disable Detection of ToneId TID_1
*/
if ( dx_distone( dxxxdev, TID_1, DM_TONEON | DM_TONEOFF ) == -1 ) {
printf( "Unable to Disable Detection of Tone %d\n", TID_1 );
printf( "Lasterror = %d Err Msg = %s\n",
ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) );
dx_close( dxxxdev );
exit( 1 );
}
/*
* Continue Processing
* .
* .
* .
*/
/*
* Close the opened Voice Channel Device
*/
if ( dx_close( dxxxdev ) != 0 ) {
perror( "close" );
}
/* Terminate the Program */
exit( 0 );
}
When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in "Bad Tone Template ID" errors.
If the function returns -1 to indicate failure, call ATDX_LASTERR( ) and ATDV_ERRMSGP( ) to return one of the following errors:
|
EDX_BADPARM |
|
EDX_BADPROD |
|
EDX_SYSTEM |
|
EDX_TNMSGSTATUS |
|
EDX_TONEID |
|
Global Tone Detection functions:
Event Retrieval:
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation