
Description | Cautions | Example | Errors | See Also
Name: |
int cc_GetANI(crn, ani_buf) | |
Inputs: |
CRN crn |
|
char *ani_buf |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Optional call handling | |
Mode: |
synchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_GetANI( ) function retrieves Automatic Number Identification (ANI) information (the calling party number) received in the ISDN setup message. The data returned is in a NULL terminated ASCII string.
Parameter |
Description |
crn: |
The call reference number. Each call needs a CRN. |
ani_buf: |
The address of the buffer where ANI information is to be stored. |
Make sure the size of ani_buf is sufficient for the ANI string. Refer to the file cclib.h for the maximum allowable string defined by CC_ADDRSIZE. Typically, ANI strings are 4 to 20 characters long. CC_ADDRSIZE should be used to define the size of the buffer.
#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 ani_buf[CC_ADDRSIZE];
if ( cc_Open( &devhdl, devname, 0 ) < 0 )
{
printf("Error opening device: errno = %d\n", errno);
exit(1);
}
if ( cc_WaitCall(devhdl, &crn, NULL, -1, EV_SYNC) < 0 )
procdevfail(devhdl);
printf("Retrieving ANI\n");
if ( cc_GetANI(crn, ani_buf) < 0 )
callfail(crn);
if ( cc_AnswerCall(crn, 0, EV_SYNC) < 0 )
callfail(crn);
.
.
.
.
.
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_GetANI( ) function include the following:
Error Code |
Description |
E_ISBADCRN | ERR_ISDN_LIB |
Bad call reference number |
E_ISBADPAR | ERR_ISDN_LIB |
Bad input parameter |
E_ISNOINFOBUF | ERR_ISDN_LIB |
Information buffer not ready |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation