
Description | Cautions | Example | Errors | See Also
Name: |
int cc_GetDNIS(crn, dnis_buf) | |
Inputs: |
CRN crn |
|
char *dnis_buf |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Optional call handling | |
Mode: |
synchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_GetDNIS( ) function gets the dialed number information string (destination address/called party number) associated with a specific call reference number (CRN). The information is in a NULL terminated ASCII string.
Parameter |
Description |
crn: |
The call reference number. Each call needs a CRN. |
dnis_buf: |
The address of the buffer where the DNIS (destination address/called party number) will be stored. Use CC_ADDRSIZE to define the size of the buffer. |
Make sure the size of the dnis_buf is large enough to hold the DNIS. It must be no smaller than CC_ADDRSIZE. Refer to the file cclib.h for the maximum allowable string.
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
void main()
{
LINEDEV devhdl = 0;
CRN crn = 0;
char *devname = "dtiB1T1";
char dnis_buf[CC_ADDRSIZE];
if ( cc_Open( &devhdl, devname, 0 ) < 0 )
{
printf("Error opening device: errno = %d\n", errno);
exit(1);
}
printf("Waiting for call\n");
if ( cc_WaitCall(devhdl, &crn, NULL, -1, EV_SYNC) < 0 )
procdevfail(devhdl);
printf("Getting DNIS\n");
if ( cc_GetDNIS(crn,dnis_buf) < 0 )
callfail(crn);
else
printf("cc_GetDNIS succeeded: %s\n",dnis_buf);
if ( cc_AnswerCall(crn, 0, EV_SYNC) < 0 )
callfail(crn);
.
.
.
.
.
/* Drop the call */
if ( cc_DropCall(crn, NORMAL_CLEARING, EV_SYNC) < 0 )
callfail(crn);
if ( cc_ReleaseCall(crn) < 0 )
callfail(crn);
if ( cc_Close( devhdl ) < 0 )
printf("Error closing device, errno = %d\n", errno);
}
int callfail(CRN crn)
{
LINEDEV ld;
cc_CRN2LineDev(crn,&ld);
procdevfail(ld);
}
int procdevfail(LINEDEV handle)
{
int reason;
char *msg;
reason = cc_CauseValue(handle);
cc_ResultMsg(handle,reason,&msg);
printf("reason = %x - %s\n",reason,msg);
}
If the function returns < 0 to indicate failure, use the cc_CauseValue( ) function to retrieve the reason code for the failure. The cc_ResultMsg( ) function can be used to interpret the reason code. Error codes are defined in the files ccerr.h, isdnerr.h, and isdncmd.h.
Error codes from the cc_GetDNIS( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISBADCRN |
Bad call reference number |
ERR_ISDN_LIB | E_ISBADPAR |
Bad input parameter |
ERR_ISDN_LIB | E_ISNOINFOBUF |
Information buffer not ready |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation