
Description | Example | Cautions | Example | Errors | See Also
Name: |
int dx_setdigtyp(chdev,dmask) | |
Inputs: |
int chdev |
|
unsigned short dmask |
| |
Returns: |
0 if successful | |
-1 if failure | ||
Includes: |
srllib.h | |
dxxxlib.h | ||
Category: |
Configuration | |
The dx_setdigtyp( ) function controls the types of digits the Voice channel detects.
dx_setdigtyp( ) does not clear the previously detected digits in the digit buffer.
The function parameters are defined as follows:
|
Parameter |
Description |
|
|
chdev |
specifies the valid channel device handle obtained when the channel was opened using dx_open( ). |
|
|
dmask |
sets the type of digits the channel will detect. More than one type of digit detection can be enabled in a single function call, as shown in the function example. dmask can have one, or a combination of several, of the following values: |
|
|
To disable digit detection, set dmask to NULL. |
||
|
||
For any digit detected, you can determine the digit type, DTMF, MF, GTD (user-defined) or DPD, by using the DV_DIGIT data structure in the application. When a dx_getdig( ) call is performed, the digits are collected and transferred to the user's digit buffer. The digits are stored as an array inside the DV_DIGIT structure. This method allows you to determine very quickly whether a pulse or DTMF telephone is being used.
/*$ dx_setdigtyp( )and dx_getdig( ) example for Global Dial Pulse Detection $*/
#include <stdio.h>
#include "srllib.h"
#include "dxxxlib.h"
void main(int argc, char **argv)
{
int dev; /* Dialogic device handle */
DV_DIGIT dig;
DV_TPT tpt;
/*
* Open device, make or accept call
*/
/* setup TPT to wait for 3 digits and terminate */
dx_clrtpt(&tpt, 1);
tpt.tp_type = IO_EOT;
tpt.tp_termno = DX_MAXDTMF;
tpt.tp_length = 3;
tpt.tp_flags = TF_MAXDTMF;
/* enable DPD and DTMF digits */
dx_setdigtyp(dev, D_DPDZ|D_DTMF);
/* clear the digit buffer */
dx_clrdigbuf(dev);
/* collect 3 digits from the user */
if (dx_getdig(dev, &tpt, &dig, EV_SYNC) == -1) {
/* error, display error message */
printf("dx_getdig error %d, %s\n", ATDV_LASTERR(dev), ATDV_ERRMSGP(dev));
} else {
/* display digits received and digit type */
printf("Received \"%s\"\n", dig.dg_value);
printf("Digit type is ");
/*
* digit types have 0x30 ORed with them strip it off
* so that we can use the DG_xxx equates from the header files
*/
switch ((dig.dg_type[0] & 0x000f)) {
case DG_DTMF:
printf("DTMF\n");
break;
case DG_DPD:
printf("DPD\n");
break;
default:
printf("Unknown, %d\n", (dig.dg_type[0] &0x000f));
}
}
/*
* continue processing call
*/
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
main()
{
int chdev;
.
.
/* Open Voice channel */
if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) {
/* process error */
}
/* Set channel to detect DTMF */
if (dx_setdigtyp(chdev, DM_DTMF) == -1) {
/* error routine */
}
.
.
}
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_SYSTEM |
|
Specifying user-defined digits:
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation