
Description | Cautions | Example | Errors | See Also
Name: |
cc_GetCallInfo(crn, info_id, valuep) | |
Inputs: |
CRN crn |
|
int info_id |
| |
char *valuep |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Optional call handling | |
Mode: |
synchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_GetCallInfo( ) function gets the information elements associated with the CRN of an incoming message. The cc_GetCallInfo( ) function must be used immediately after the message is received if the application requires the call information. The library will not queue the call information; subsequent messages on the same line device will be discarded if the previous messages are not retrieved.
Parameter |
Description |
crn: |
The call reference number. Each call needs a CRN. |
info_id: |
The call information identifier (see Table 19 below). |
valuep: |
Points to the buffer where the call information will be stored. |
The following table provides definitions of possible info_id parameters.
Table 19. cc_GetCallInfo( ) Info_ID Definitions
info_id |
Definition |
Information Elements (IEs) in CCITT format. The cc_GetCallInfo( ) function retrieves all unprocessed IEs in CCITT format. Be sure to allocate enough memory (up to 256 bytes) to hold the retrieved IEs. The IEs are returned as raw data and must be parsed and interpreted by the application. Use IE_BLK to retrieve the unprocessed IEs. For a description of the IE_BLK data structure, see Section 6.6. IE_BLK. See Appendix C for descriptions of information elements specific to the DPNSS protocol. | |
User-to-user information. The user information data returned is application-dependent. The user information is retrieved using the USRINFO_ELEM data structure. For a description of the return format for UUI, see Section 6.16. USRINFO_ELEM. |
#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];
char infbuf[MAXLEN_IEDATA]; /* buffer raw information in CCITT format */
int i; /* for loop counter to print out information buffer contents */
/* open the ISDN line device */
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 call information\n");
if ( cc_GetCallInfo(crn, U_IES, &infbuf) < 0 )
callfail(crn);
else
/* print out the raw buffer information */
printf("Received call information buffer contents:\n")
for (i=1; i<=MAXLEN_IEDATA; i++) {
printf("%c", infbuf[I]);
} /* end for */
}
/* answer the call */
if ( cc_AnswerCall(crn, 0, EV_SYNC) < 0 )
callfail(crn);
.
.
.
.
.
/* drop the call */
if ( cc_DropCall(crn, NORMAL_CLEARING, EV_SYNC) < 0 )
callfail(crn);
/* release the CRN */
if ( cc_ReleaseCall(crn) < 0 )
callfail(crn);
/* close the ISDN line device */
if ( cc_Close( devhdl ) < 0 )
printf("Error closing device, errno = %d\n", errno);
} /* end main */
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_GetCallInfo( ) 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 |
ERR_ISDN_LIB | E_ISNOFACILITYBUF |
Network Facility buffer not ready |
None
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation