
Description | Termination Events | Cautions | Example | Errors | See Also
Name: |
int cc_ReqANI(crn, ani_buf, reqtype, mode) | |
Inputs: |
CRN crn |
|
char *ani_buf |
| |
int reqtype |
| |
unsigned long mode |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Optional call handling | |
Mode: |
synchronous or asynchronous | |
Technology: |
PRI (4ESS only) | |
The cc_ReqANI( ) function returns the caller ID for Automatic Number Identification (ANI)-on-demand services. The caller ID is usually included in the ISDN setup message. However, if the caller ID does not exist and the serving network is AT&T, the driver will automatically request the caller ID from the network if the ANI-on-demand feature is enabled. The information is returned 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 stored. |
reqtype: |
The type of information requested. Possible values are:
|
mode: |
Specifies asynchronous (EV_ASYNC) or synchronous (EV_SYNC) mode. |
The cc_ReqANI( ) function can operate as either a multitasking or non-multitasking function. It is a multitasking function when the caller number is offered upon request and the network provides this type of service (such as AT&T's ANI-on-demand service). cc_ReqANI( ) is a non-multitasking function when the calling party number is received or when the network does not offer an ANI-on-demand service. Thus, if ANI is already available, the function returns immediately because it does not have to instruct the interface device to query the switch.
In EV_ASYNC mode, the function will always return an event. In EV_SYNC mode, the function will return automatically with the ANI if one is available. Otherwise, the function will wait for completion of the ANI-on-demand request.
#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("Requesting ANI\n");
if ( cc_ReqANI(crn, ani_buf, ISDN_CPN_PREF, EV_SYNC) < 0 )
callfail(crn);
else
printf("cc_ReqANI succeeded: %s\n",ani_buf);
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_ReqANI( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISBADPAR |
Bad input parameter |
ERR_ISDN_LIB | E_ISNULLPTR |
Null pointer error |
ERR_ISDN_LIB | E_ISBADIF |
Bad interface number |
ERR_ISDN_LIB | E_ISBADCALLID |
Bad call identifier |
ERR_ISDN_LIB | E_ISBADTS |
Bad time slot |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation