
Description | Termination Events | Cautions | Example | Errors | See Also
Name: |
int cc_ReleaseCallEx(crn, mode) | |
Inputs: |
CRN crn |
|
unsigned long mode |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Call control | |
Mode: |
synchronous or asynchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_ReleaseCallEx( ) function instructs the driver and firmware to release all Dialogic ISDN resources for the specified call. Every cc_DropCall( ) must be followed by cc_ReleaseCallEx( ) or cc_ReleaseCall( ) (see Note below). An inbound call will be rejected after cc_DropCall( ) and prior to cc_ReleaseCallEx( ).
Under PRI, the firmware sends the RELEASE message to the network automatically, by default. However, the host can be configured to control when to send the RELEASE message to the network by using a parameter configuration file set prior to download time. Unlike PRI, the BRI board passes this control to the host application by default. The host application then sends the RELEASE message through the cc_ReleaseCallEx( ) function. See the Host-Controlled Disconnect Process scenario in Appendix A - Call Control Scenarios for more information on how to use this function.
Parameter |
Description |
crn: |
The call reference number. Each call needs a CRN. |
mode: |
Specifies asynchronous (EV_ASYNC) or synchronous (EV_SYNC) mode. |
The cc_ReleaseCallEx( ) function is not supported for LINUX applications.
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
/* GLOBAL VARIABLES */
LINEDEV ldev = 0;
CRN crn = 0;
char *devname = "dtiB1T1"; /* device name for ISDN board 1 timeslot 1 */
void main()
{
int rc;
int srlmode = SR_STASYNC; /* mode for SRL initialization (disabling the internal SRL event thread) */
.
.
.
/* open the ISDN line device */
if ( cc_Open( &ldev, devname, 0 ) < 0 )
{
printf("Error opening device: errno = %d\n", errno);
exit(1);
}
/* disable the internal SRL thread in order to use sr_waitevt() for event processing */
if ( sr_setparm( SRL_DEVICE,SR_MODELTYPE,&srlmode) == -1 )
{
printf( "sr_setparm of SRL failed\n" );
}
/* set the event handlers */
sr_enbhdlr( EV_ANYDEV, EV_ANYEVT, (HDLR)defaultHandler);
/* wait for an incoming call */
if ((rc = cc_WaitCall(ldev, &crn, NULL, EV_ASYNC)) < 0)
{
rc = cc_CauseValue(ldev);
printf("ERROR in cc_WaitCall(), error code = %x (%s) \n",
rc, cc_ResultMsg(rc));
exit(1);
}
else
printf("Waiting for call...\n");
.
.
.
/* wait indefinitely for events */
sr_waitevt(-1);
/* continue with application */
.
.
.
.
} /* end main */
/***********************************************/
/* defaultHandler - default event handler */
/***********************************************/
int defaultHandler()
{
int devindx;
int dev = sr_getevtdev();
int len = sr_getevtlen();
int typ = sr_getevttype();
void *datap = sr_getevtdatap();
/* process all incoming events in one switch statement */
switch(typ)
{
.
.
.
case CCEV_DROPCALL:
printf("Asynchronous cc_DropCall() completed\n");
/* release the call asynchronously so as not to block within an async handler */
if (cc_ReleaseCallEx(crn, EV_ASYNC)) = = -1) {
printf("Error in cc_ReleaseCall(): error code = %x\n", cc_CauseValue(ldev));
}
else printf("Asynchronous cc_ReleaseCall sent...waiting for completion event CCEV_RELEASECALL...\n");
/* the next case is the completion event for the asynchronous cc_ReleaseCall */
case CCEV_RELEASECALL:
printf("Asynchronous cc_ReleaseCall completed\n");
break;
} /* end switch */
} /* end defaultHandler() */
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.
Possible error codes from the cc_ReleaseCallEx( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISBADIF |
Bad interface number |
ERR_ISDN_LIB | E_BADSTATE |
Bad state |
ERR_ISDN_LIB | E_ISBADTS |
Bad time slot |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation