
Description | Example | Errors | Cautions | See Also
Name: |
int r2_playbsig(chdev,backwardsig,forwardsig,mode) | |
Inputs: |
int chdev |
|
int backwardsig |
| |
int forwardsig |
| |
int mode |
| |
Returns: |
0 if success | |
error return code | ||
Includes: |
srllib.h | |
dxxxlib.h | ||
Category: |
R2MF | |
Mode: |
asynchronous/synchronous | |
The r2_playbsig( ) function plays a specified backward R2MF signal on the specified channel until a tone-off event is detected for the specified forward signal.
The r2_playbsig( ) function is a convenience function that plays a tone and controls the timing sequence required by the R2MF compelled signaling procedure.
Compelled signaling sends each signal, until it is responded to by a return signal, which in turn is sent until responded to by the other party. See the Voice Software Reference: Voice Features Guide for more information about R2MF Compelled signaling.
Asynchronous Operation
Synchronous Operation
|
Parameter |
Description |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
chdev |
specifies the valid channel device handle obtained when the channel was opened using dx_open( ). |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
backwardsig |
specifies the name of a Group A or Group B backward signal to play. Set to one of the defines in Group A or one of the defines in Group B:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
forwardsig: |
specifies the name of the Group I or Group II forward signal for which a tone-on event was detected, and for which a tone-off event will terminate this function. Set to one of defines from Group I or one of the defines from Group II:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
The following procedure describes how to use the r2_playbsig( ) function:
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
main()
{
int dxxxdev;
/*
* Open the Voice Channel Device and Enable a Handler
*/
if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) {
perror( "dxxxB1C1" );
exit( 1 );
}
/*
* Create all forward signals
*/
if ( r2_creatfsig( dxxxdev, R2_ALLFSIG ) == -1 ) {
printf( "Unable to Create the Forward Signals\n" );
printf( "Lasterror = %d Err Msg = %s\n",
ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) );
dx_close( dxxxdev );
exit( 1 );
}
/*
* Continue Processing
* .
* .
* .
*
* Detect an incoming call using dx_wtring()
*
* Enable the detection of all forward signals using
* dx_enbtone(). In this example, only the first
* forward signal will be enabled.
*/
if (dx_enbtone( dxxxdev, SIGI_1, DM_TONEON | DM_TONEOFF ) == -1 ) {
printf( "Unable to Enable Detection of Tone %d\n", SIGI_1 );
printf( "Lasterror = %d Err Msg = %s\n",
ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) );
dx_close( dxxxdev );
exit( 1 );
}
/*
* Now wait for the TDX_CST event and event type,
* DE_TONEON. The data part contains the ToneId of
* the forward signal detected. Based on the forward
* signal, determine the backward signal to generate.
*
* In this example, we will be generating the Group A
* backward signal A-1 (send next digit) assuming
* forward signal received is SIGI_1.
*/
if ( r2_playbsig( dxxxdev, SIGA_1, SIGI_1, EV_SYNC ) == -1 ) {
printf( "Unable to generate the backward signals\n" );
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 );
}
If this function returns -1 to indicate failure, use ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to retrieve one of the following error reasons:
|
EDX_BADPARM |
|
EDX_BADPROD |
|
EDX_BADTPT |
|
EDX_BUSY |
|
EDX_AMPLGEN |
|
EDX_FREQGEN |
|
EDX_FLAGGEN |
|
EDX_SYSTEM |
|
The channel must be idle when calling this function.
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation