
Description | Cautions | Example | Errors | See Also
Name: |
int dcb_setdigitmsk(devh,confid,bitmask,action) | |
Inputs: |
int devh |
|
int confid |
| |
unsigned int bitmask |
| |
unsigned int action |
| |
Returns: |
0 on success | |
Includes: |
srllib.h | |
Category: |
Configuration | |
Mode: |
synchronous | |
The dcb_setdigitmsk( ) function enables specific digit detection for a conference. This current bitmask is examined by a call to dcb_getdigitmsk( ).
Parameter |
Description |
devh: |
The DCB/SC DSP device handle. |
confid: |
The conference identifier. |
bitmask: |
The digit bitmask. |
action: |
Specifies how the digit mask is changed. Possible values are:
|
The bitmask determines the digits to be detected. Upon detection of a digit, a DCBEV_DIGIT event is generated on a DCB/SC DSP handle. The sr_getevtdatap( ) function can be used to retrieve the following structure:
typedef struct {
unsigned char dsp; /* DCB/SC DSP number */
int confid; /* Conference ID */
int chan_num; /* Channel/time slot number /
int chan_sel; /* Meaning of chan_num */
int chan_attr; /* Attribute of chan_num */
unsigned char digits [DCB_MAXDIGS+1]; /* ASCIIZ string of detected digits */
unsigned char dig_type; /* Type of digits(s) detected */
} DCB_DIGITS;
The possible values for bitmask are:
CBMM_ZERO Detect digit 0
CBMM_ONE Detect digit 1
CBMM_TWO Detect digit 2
CBMM_THREE Detect digit 3
CBMM_FOUR Detect digit 4
CBMM_FIVE Detect digit 5
CBMM_SIX Detect digit 6
CBMM_SEVEN Detect digit 7
CBMM_EIGHT Detect digit 8
CBMM_NINE Detect digit 9
CBMM_STAR Detect digit *
CBMM_POUND Detect digit #
CBMM_A Detect digit A
CBMM_B Detect digit B
CBMM_C Detect digit C
CBMM_D Detect digit D
CBMM_ALL Detect ALL digits
For example, to enable notification of the digits specified in the bitmask parameter and disable notification of previously set digits:
To enable an additional digit specified in bitmask without disabling the currently enabled digits:
To disable digits in bitmask without disabling any other digits:
To disable all currently enabled digits:
To enable an event handler for a specified event, follow these steps:
This function fails when:
#include <windows.h>
#include <stdio.h>
#include "srllib.h"
#include "dtilib.h"
#include "msilib.h"
#include "dcblib.h"
#include "errno.h"
#define NUM_PARTIES 2
main()
{
int dspdevh; /* DCB/SC DSP device handle */
int confid; /* Conference Identifier */
unsigned int bitmask; /* Digit bitmask */
int tsdevh1, tsdevh2; /* DTI time slot device handles */
MS_CDT cdt[NUM_PARTIES]; /* Conference descriptor table */
long scts; /* SCbus transmit time slot */
/* Open DCB/SC board 1, DSP 2 device */
if ((dspdevh = dcb_open("dcbB1D2",0)) == -1) {
printf("Cannot open dcbB1D2. errno = %d", errno);
exit(1);
}
/* Open DTI board 1, time slot 1 */
if ((tsdevh1 = dt_open("dtiB1T1",0)) == -1) {
printf( "Cannot open dtiB1T1 : errno = %d", errno);
exit(1);
}
/* Prepare the time slot information structure */
tsinfo.sc_numts = 1;
tsinfo.sc_tsarrayp = &scts;
/* Retrieve the SCbus transmit time slot for tsdevh1 */
if (dt_getxmitslot(tsdevh1, &tsinfo) == -1){
printf("Error Message : %s", ATDV_ERRMSGP(tsdevh1));
exit(1);
}
/* Set up the MS_CDT structure */
cdt[0].chan_num = (int)scts; /* SCbus time slot returned */
cdt[0].chan_sel = MSPN_TS; /* by dt_getxmitslot() */
cdt[0].chan_attr = MSPA_TARIFF; /* Conferee receives periodic tariff tones */
/* Open board 1, tslot 2 */
if ((tsdevh2 = dt_open("dtiB1T2",0)) == -1) {
printf( "Cannot open dtiB1T2 : errno = %d", errno);
exit(1);
}
/* Prepare the time slot information structure */
tsinfo.sc_numts = 1;
tsinfo.sc_tsarrayp = &scts;
/* Retrieve the SCbus transmit time slot for tsdevh2 */
if (dt_getxmitslot(tsdevh2, &tsinfo) == -1){
printf("Error Message : %s", ATDV_ERRMSGP(tsdevh2));
exit(1);
}
/* Set up the MS_CDT structure */
cdt[1].chan_num = (int)scts; /* SCbus time slot returned */
cdt[1].chan_sel = MSPN_TS; /* by dt_getxmitslot() */
cdt[1].chan_attr = MSPA_TARIFF; /* Conferee receives periodic tariff tones */
/* Establish a 2 party conference */
if (dcb_estconf(dspdevh, cdt, NUM_PARTIES, MSCA_ND, &confid) == 1) {
printf("Error Message : %s", ATDV_ERRMSGP(dspdevh));
exit(1);
}
/* Do a listen for the DTI tsdevh1 device */
tsinfo.sc_numts = 1;
tsinfo.sc_tsarrayp = &cdt[0].chan_lts;
if (dt_listen(tsdevh1,&tsinfo) == -1){
printf("Error Message : %s", ATDV_ERRMSGP(tsdevh1));
exit(1);
}
/* Do a listen for the DTI tsdevh2 device */
tsinfo.sc_numts = 1;
tsinfo.sc_tsarrayp = &cdt[1].chan_lts;
if (dt_listen(tsdevh2,&tsinfo) == -1){
printf("Error Message = %s",ATDV_ERRMSGP(tsdevh2));
exit(1);
}
/*
* Enable DTMF detection for digits 1,3,5 only */
*/
if (dcb_setdigitmsk(dspdevh, confid, CBMM_ONE|CBMM_THREE|CBMM_FIVE,
CBA_SETMSK)) == -1) {
printf("Error Message : %s", ATDV_ERRMSGP(dspdevh));
exit(1);
}
/*
* Continue processing
*/
/* Perform 'unlistens' on all DTI listening time slots */
if (dt_unlisten(tsdevh1) == -1){
printf("Error Message : %s", ATDV_ERRMSGP(tsdevh1));
exit(1);
}
if (dt_unlisten(tsdevh2) == -1){
printf("Error Message : %s", ATDV_ERRMSGP(tsdevh2));
exit(1);
}
/* Delete the conference */
if(dcb_delconf(dspdevh, confid) == -1) {
printf("Cannot delete conference %d. Error Message = %s", confid,
ATDV_ERRMSGP(dspdevh));
exit(1);
}
/* And close all open devices */
if (dt_close(tsdevh1) == -1){
printf("Error closing tsdevh1\n");
exit(1);
}
if (dt_close(tsdevh2) == -1){
printf("Error closing tsdevh2\n");
exit(1);
}
if(dcb_close(dspdevh) == -1) {
printf("Cannot close dcbB1D2 : errno = %d", errno);
exit(1);
}
If the function does not complete successfully, it will return -1 to indicate an error. Use the Standard Attribute functions ATDV_LASTERR( ) to obtain the applicable error value, or ATDV_ERRMSGP( ) to obtain a more descriptive error message.
Refer to the error type tables found in Chapter 2 of this guide. Error defines can be found in dtilib.h, msilib.h or dcblib.h.
Click here to contact Dialogic Customer Engineering
Copyright 2000, Dialogic Corporation