
Description | Cautions | Example | Errors | See Also
Name: |
int cc_SetInfoElem(linedev, iep) | |
Reference: |
LINEDEV linedev |
|
Inputs: |
IE_BLK *iep |
|
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Optional call handling | |
Mode: |
synchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_SetInfoElem( ) function sets additional information elements, allowing the application to include application-specific ISDN information elements in the next outbound message. This function is used for rapid deployment of an application that "interworks" with the network to take advantage of ISDN's capabilities. A typical application is user-to-user information elements in each outgoing message.
Parameter |
Description |
linedev: |
The B channel board line device handle. |
iep: |
The starting address of the information element block (IE_BLK). For a description of the IE_BLK data structure, see Section 6.6. IE_BLK. See the Example code for details. |
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
typedef struct uui_type {
unsigned char uui_id;
unsigned char length;
char data[128];
} USR_USR_INFO; /* This structure complies with CCITT Q.931
USER-USER information element standard */
int build_struui(USR_USR_INFO *uuip,char *str)
{
uuip->uui_id = 0x7E; /* CCITT UUI */
strcpy(uuip->data, str);
uuip->length = strlen(uuip->data);
return(uuip->length+2);
}
void main()
{
LINEDEV devhdl = 0;
CRN crn = 0;
char *devname = "dtiB1T1";
IE_BLK icp;
USR_USR_INFO uui;
if ( cc_Open( &devhdl, devname, 0 ) < 0 )
{
printf("Error opening device: errno = %d\n", errno);
exit(1);
}
/*
* Using cc_SetInfoElem()to include additional
* information elements in the next ISDN message.
*/
icp.length = build_struui(&uui, "Dialogic ISDN");
memcpy(icp.info_elem_str, &uui, icp.length);
if ( cc_SetInfoElem(devhdl, &icp))
procdevfail(devhdl);
if ( cc_MakeCall(devhdl, &crn, "9933000", NULL, 30, EV_SYNC) < 0 )
procdevfail(devhdl);
.
.
.
.
.
/* 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_SetInfoElem( ) function include the following:
Error Code |
Description |
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