gc_SetBilling( )
Termination Events | Cautions | Errors | Example | See Also
Name: int gc_SetBilling(crn, rate_type, ratep, mode) Inputs: Returns: Includes: Category: Mode: Platform and Technology: †See the Global Call Technology User's Guides for additional information.
Description
The gc_SetBilling( ) function sets billing information associated with the specified call reference number (CRN). For protocols that support this feature, this function tells the Central Office whether or not to charge for the call. For AT&T ISDN applications, the billing rate is available to applications that use AT&T's Vari-A-Bill service. For some E-1 CAS protocols, different billing rates can be chosen on a per-call basis.
See also the appropriate Global Call Technology User's Guide for technology-specific information about the rate_type, ratep, and mode parameters.
crn call reference number rate_type type of billing data ratep points to the GC_RATE_U data structure, which contains the charge information for the current call. For a description of the structure, see GC_RATE_U. mode set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution (see the appropriate Global Call Technology User's Guide to determine if the asynchronous mode is supported) Termination Events
- GCEV_SETBILLING
- indicates that the function was successful, that is, the charge information was set.
- GCEV_TASKFAIL
- indicates that the function failed. For more information, see the "Error Handling" section in the Global Call API Programming Guide.
Cautions
If this function is invoked for an unsupported technology, the function fails. The error value EGC_UNSUPPORTED will be the Global Call value returned when the gc_ErrorInfo( ) function is used to retrieve the error code.
Errors
If this function returns <0 to indicate failure, use the gc_ErrorInfo( ) function for error information. If the GCEV_TASKFAIL event is received, use the gc_ResultInfo( ) function to retrieve information about the event. See the "Error Handling" section in the Global Call API Programming Guide. All Global Call error codes are defined in the gcerr.h file. If the error returned is technology specific, see the technology-specific error header file(s) for the error definition (for example, ccerr.h or isdnerr.h file for the ISDN call control library).
Example
/* * Assume the following has been done: * 1. device has been opened (e.g. :N_dtiB1T1:P_isdn, :N_dtiB1T2:P_isdn, etc...) * 2. gc_WaitCall() has been issued to wait for a call. * 3. gc_GetMetaEvent() or gc_GetMetaEventEx() (Windows) has been * called to convert the event into metaevent. * 4. a GCEV_OFFERED has been detected. * 5. a call has been established. */ #include <stdio.h> #include <srllib.h> #include <gclib.h> #include <gcerr.h> #include <gcisdn.h> /* * For this example, let's assume that mode = SYNC and * the rate_type = ISDN_FLAT_RATE. The ratep stores the billing information. * rate_type can be one of the following: * ISDN_NEW_RATE * ISDN_PREM_CHARGE * ISDN_PREM_CREDIT * ISDN_FREE_CALL * * Note: This is only available for some protocols. * This function call is used any time after the connection * is established. */ int set_billing(CRN crn, int rate_type, GC_RATE_U *ratep, unsigned long mode) { LINEDEV ldev; /* Line device */ GC_INFO gc_error_info; /* GlobalCall error information data */ if(gc_CRN2LineDev(crn, &ldev) != GC_SUCCESS) { /* process error return as shown */ gc_ErrorInfo( &gc_error_info ); printf ("Error: gc_CRN2LineDev() on crn: 0x%lx, GC ErrorValue: 0x%hx - %s, CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n", crn, gc_error_info.gcValue, gc_error_info.gcMsg, gc_error_info.ccLibId, gc_error_info.ccLibName, gc_error_info.ccValue, gc_error_info.ccMsg); return (gc_error_info.gcValue); } if(gc_SetBilling(crn, rate_type, ratep, mode) != GC_SUCCESS) { gc_ErrorInfo( &gc_error_info ); printf ("Error: gc_SetBilling() on device handle: 0x%lx, GC ErrorValue: 0x%hx - %s, CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n", ldev, gc_error_info.gcValue, gc_error_info.gcMsg, gc_error_info.ccLibId, gc_error_info.ccLibName, gc_error_info.ccValue, gc_error_info.ccMsg); return (gc_error_info.gcValue); } return(0); }See Also
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation