PREV TOC HOME INDEX NEXT


gc_AnswerCall( )


Termination Events | Cautions | Errors | Example | See Also

Name: int gc_AnswerCall(crn, rings, mode)
Inputs:

CRN crn

  • call reference number
 

int rings

  • number of rings before return
 

unsigned long mode

  • async or sync
Returns:

0 if successful

<0 if failure

Includes:

gclib.h

gcerr.h

Category:

basic

Mode:

asynchronous or synchronous

Platform and Technology:

All

See the Global Call Technology User's Guides for additional information.

Description

The gc_AnswerCall( ) function indicates (to the originator) that the destination party is connected and must be used to complete the call establishment process. It can be used any time after a GCEV_OFFERED or GCEV_ACCEPT event is received. Upon successful completion of the gc_AnswerCall( ) function, the call state changes from the Offered state or the Accepted state to the Connected state.

See also the appropriate Global Call Technology User's Guide for technology-specific information.

Parameter

Description

crn call reference number
rings specifies the number of rings the protocol handler waits before notifying the calling entity. The valid values are as follows:
  • 0 to 14
    the call is answered after the specified number of rings
  • 15 or greater
    the call will ring forever; this allows the application to accept calls without answering them
For protocols not using rings, the rings parameter is ignored.
mode set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution

Termination Events

GCEV_ANSWERED
indicates successful completion of the gc_AnswerCall( ) function, that is, the call was answered
GCEV_TASKFAIL
indicates that the function failed. For more information, see the "Error Handling" section in the Global Call API Programming Guide.
Note: A GCEV_DISCONNECTED event may be reported as an unsolicited event to the application after gc_AnswerCall( ) function is issued.

Cautions

The gc_AnswerCall( ) function can only be called after an inbound call is detected. Otherwise the function fails.

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

#include <stdio.h>
#include <srllib.h>
#include <gclib.h>
#include <gcerr.h> 
/*
 * Assume the following has been done:
 *    1. Opened line devices for each time slot on DTIB1.
 *    2. Wait for a call using gc_WaitCall()
 *    3. An event has arrived and has been converted to a metaevent
 *       using gc_GetMetaEvent() or gc_GetMetaEventEx() (Windows)
 *    4. The event is determined to be a GCEV_OFFERED event
 */
int answer_call(void)
{  
    CRN         crn;                 /* call reference number */
    GC_INFO     gc_error_info;    /* GlobalCall error information data */
    /*
     * Do the following:
     *    1. Get the CRN from the metaevent
     *    2. Proceed to answer the call as shown below
     */ 
    crn = metaevent.crn; 
    /*
     * Answer the incoming call
     */ 
    if (gc_AnswerCall(crn, 0, EV_ASYNC) != GC_SUCCESS) {
        /* process error return as shown */
        gc_ErrorInfo( &gc_error_info );
        printf ("Error: gc_AnswerCall() on device handle: 0x%lx, GC ErrorValue: 0x%hx - %s, CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n",
               metaevent.evtdev, 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); 
    } 
    /*
     * gc_AnswerCall() terminates with GCEV_ANSWERED event
     */
    return (0);
} 

See Also


PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

Copyright 2003, Intel Corporation
All rights reserved
This page generated February, 2003