
Description | Cautions | Example | Errors | See Also
Name: |
int dcb_getdigitmsk(devh,confid,bitmaskp) | |
Inputs: |
int devh |
|
int confid |
| |
unsigned int * bitmaskp |
| |
Returns: |
0 on success | |
Includes: |
srllib.h | |
Category: |
Configuration | |
Mode: |
synchronous | |
The dcb_getdigitmsk( ) function returns the digit mask for a specified conference. The values set in the mask corresponds to the digits which, when received, will cause a DCBEV_DIGIT event to be generated to the application.
Parameter |
Description |
devh: |
The DCB/SC DSP device handle. |
confid: |
The conference identifier. |
bitmask: |
Pointer to the digit bitmask. |
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; /* bitmask variable */
int tsdevh1, tsdevh2; /* DTI time slot device handles */
MS_CDT cdt[NUM_PARTIES]; /* Conference descriptor table */
SC_TSINFO tsinfo;
long scts; /* SCbus 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 CDT[0] structure */
cdt[0].chan_num = (int)scts; /* scts is the SCbus time slot */
cdt[0].chan_sel = MSPN_TS; /* returned from dt_getxmitslot() */
cdt[0].chan_attr = MSPA_TARIFF; /* Party receives periodic tariff tone */
/* Open DTI board 1, tslot 2 */
if ((tsdevh2 = dt_open("dtiB1T2",0)) == -1) {
printf( "Cannot open dtiB1T2: errno=%d", errno);
exit(1);
}
/* 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 CDT[1] structure */
cdt[1].chan_num = (int)scts; /* scts is the SCbus time slot */
cdt[1].chan_sel = MSPN_TS; /* returned from dt_getxmitslot() */
cdt[1].chan_attr = MSPA_PUPIL; /* Conferee may be coached later */
/* Establish a two 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 tsdevh1 */
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 tsdevh2 */
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 digit detection for digits 1,3 and 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);
}
/* Get the bitmask value for the digit detection event */
if (dcb_getdigitmsk(dspdevh, confid, &bitmask) == -1) {
printf("Error Message : %s", ATDV_ERRMSGP(dspdevh));
exit(1);
}
/*
* Display list of digits enabled for detection
*/
if (bitmask & CBMM_ZERO)
printf("Digit 0 is enabled\n");
if (bitmask & CBMM_ONE)
printf("Digit 1 is enabled\n");
if (bitmask & CBMM_TWO)
printf("Digit 2 is enabled\n");
if (bitmask & CBMM_THREE)
printf("Digit 3 is enabled\n");
if (bitmask & CBMM_FOUR)
printf("Digit 4 is enabled\n");
if (bitmask & CBMM_FIVE)
printf("Digit 5 is enabled\n");
if (bitmask & CBMM_SIX)
printf("Digit 6 is enabled\n");
if (bitmask & CBMM_SEVEN)
printf("Digit 7 is enabled\n");
if (bitmask & CBMM_EIGHT)
printf("Digit 8 is enabled\n");
if (bitmask & CBMM_NINE)
printf("Digit 9 is enabled\n");
if (bitmask & CBMM_STAR)
printf("Digit * is enabled\n");
if (bitmask & CBMM_POUND)
printf("Digit # is enabled\n");
if (bitmask & CBMM_A)
printf("Digit A is enabled\n");
if (bitmask & CBMM_B)
printf("Digit B is enabled\n");
if (bitmask & CBMM_C)
printf("Digit C is enabled\n");
if (bitmask & CBMM_D)
printf("Digit D is enabled\n");
/* Unlisten the 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);
}
/* Done Processing - 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\n", 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