
Description | Termination Events | Cautions | Example | Errors | See Also
Name: |
int cc_SetBilling(crn, rate_type, ratep, mode) | |
Inputs: |
CRN crn |
|
int rate_type |
| |
CC_RATE_U *ratep |
| |
unsigned long mode |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Optional call handling | |
Mode: |
asynchronous or synchronous | |
Technology: |
PRI (4ESS only) | |
The cc_SetBilling( ) function sets the billing rate for AT&T Vari-A-Bill services associated with the particular call reference number, using cents as the unit. In asynchronous mode, the cc_SetBilling( ) function must be used after either CCEV_CONNECTED or CCEV_ANSWERED is received (in call state Connected). In synchronous mode, cc_SetBilling( ) must be used after successful completion of either cc_MakeCall( ) or cc_AnswerCall( ).
Parameter |
Description |
crn: |
The call reference number. Each call needs a CRN. |
rate_type: |
The type of billing data. Possible values are:
|
ratep: |
Pointer to the billing rate of the current call. The billing rate information is contained in the CC_RATE_U data structure. For a description of this structure, see Section 6.1. CC_RATE_U. |
mode: |
Specifies asynchronous (EV_ASYNC) or synchronous (EV_SYNC) mode. |
#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];
CC_RATE_U rate;
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);
if ( cc_GetDNIS(crn, dnis_buf) < 0 )
callfail(crn);
if ( cc_AnswerCall(crn, 0, EV_SYNC) < 0 )
callfail(crn);
/*
* using cc_SetBilling( ) to set the rate of the current call.
* This function is used in conjunction with AT&T Vari-A-Bill
* service only.
* Do not use it in other protocol applications
*/
rate.ATT.cents = 99;
if ( cc_SetBilling(crn, ISDN_FLAT_RATE, &rate, 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.
Possible error codes from the cc_SetBilling( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISBADTS |
Bad time slot |
ERR_ISDN_LIB | E_FB_UNAVAIL |
Flex billing unavailable |
ERR_ISDN_LIB | E_ISBADIF |
Bad interface number |
ERR_ISDN_LIB | E_ISBADCALLID |
Bad call identifier |
ERR_ISDN_LIB | E_ISBADPAR |
Bad input parameter |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation