gc_GetCallState( )
Termination Events | Cautions | Errors | Example | See Also
Name: int gc_GetCallState(crn, state_ptr) Inputs: Returns: Includes: Category: Mode: Platform and Technology: Description
The gc_GetCallState( ) function retrieves the state of the call associated with the call reference number (CRN). The acquired state will be associated with the last message received by the application. This function is especially useful when an error occurs and the application requires an update as to whether the call state has changed. State transition diagrams and call state definitions are presented in the Global Call API Programming Guide.
Termination Events
Cautions
- Due to the process latency time, the state value acquired through the gc_GetCallState( ) function may lag behind the current call state in the protocol state machine. If the two state values differ, the acquired state value is always behind the actual state. This is especially evident in the process of establishing an outbound call. The state acquired by the application will be associated with the latest event received by the application.
- The GCST_CALLROUTING and GCST_PROCEEDING call states are not supported on DM3 boards.
Errors
If this function returns <0 to indicate failure, use the gc_ErrorInfo( ) function to retrieve the reason for the error. 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
#include <stdio.h> #include <srllib.h> #include <gclib.h> #include <gcerr.h> #define MAXCHAN 30 /* max. number of channels in system */ /* * Data structure which stores all information for each line */ struct linebag { LINEDEV ldev; /* GlobalCall line device handle */ CRN crn; /* GlobalCall API call handle */ int state; /* state of first layer state machine */ } port[MAXCHAN+1]; struct linebag *pline; /* pointer to access line device */ int get_call_state(int port_num) { LINEDEV ldev; /* line device ID */ CRN crn; /* call reference number */ int call_state; /* current state of call */ GC_INFO gc_error_info; /* GlobalCall error information data */ /* Find info for this time slot, specified by 'port_num' */ /* (Assumes port_num is valid) */ pline = port + port_num; crn = pline -> crn; /* * Retrieve the call state and save it. */ if (crn) { if (gc_CRN2LineDev( crn, &ldev) != GC_SUCCESS) { /* get and process error */ 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_GetCallState( crn, &call_state) != GC_SUCCESS) { /* process error return as shown */ gc_ErrorInfo( &gc_error_info ); printf ("Error: gc_GetCallState() on devive 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); } } pline->state = call_state; return (0); }See Also
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation