PREV TOC HOME INDEX NEXT


gc_Listen( )


Termination Events | Cautions | Errors | Example | See Also

Name: int gc_Listen(linedev, sctsinfop, mode)
Inputs:

LINEDEV linedev

  • Global Call line device handle
 

SC_TSINFO *sctsinfop

  • pointer to CT Bus time slot information structure
 

unsigned long mode

  • async or sync
Returns:

0 if successful

<0 if failure

Includes:

gclib.h

gcerr.h

Category:

system controls and tools

Mode:

asynchronous or synchronous

Platform and Technology:

Springware: T-1/E-1 (PDKRT only)

DM3: T-1/E-1, ISDN, Analog

SS7

IP (host-based stack and embedded stack)

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

Description

The gc_Listen( ) function connects a channel to a network CT Bus time slot. The gc_Listen( ) function uses the information stored in the SC_TSINFO structure to connect the receive channel on the device to an available network CT Bus time slot. The time slot number is returned in the SC_TSINFO structure. When the gc_Listen( ) function returns, the receive channel is connected to the CT Bus time slot.

Parameter

Description

linedev Global Call line device handle
sctsinfop points to the SC_TSINFO CT Bus time slot information structure. See SC_TSINFO for more information.
mode set to EV_ASYNC for asynchronous execution or to EV_SYNC for synchronous execution

Termination Events

GCEV_LISTEN
indicates that a time slot has been routed successfully.
GCEV_TASKFAIL
indicates that the time slot routing has failed.

Cautions

For voice resources, the routing function for the corresponding library must be called, for example, dx_getxmitslot( ), dx_listen( ), and dx_unlisten( ).

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 MAX_CHAN 30              /* max. number of channels in system */ 
/*
* Data structure which stores all information for each line
*/
static struct linebag {
    LINEDEV  ldev;      /* GlobalCall API line device handle */
    CRN      crn;       /* GlobalCall API call handle */
    int      blocked;   /* channel blocked/unblocked */
    int      networkh;  /* network handle */
    int      chdev;     /* voice handle */
} port[MAX_CHAN+1];
struct linebag *pline;    /* pointer to access line device */ 
/*
 * Assume the following has been done:
 *    1. Opened line devices for each time slot on DTIB1.
 *    2. Opened a voice device on dxxxB1C1.
 *    3. Each line device and voice handle is stored in linebag structure "port"
 */
int call_listen(int port_num)
{
    GC_INFO        gc_error_info;  /* GlobalCall error information data */
    SC_TSINFO      sc_tsinfo;        /* CTbus time slot structure */
    long scts; 
    /* Find info for this time slot, specified by 'port_num' */
    /* (assumes port_num is valid) */
    pline = port + port_num; 
    /* Fill in the CTbus time slot information */
    sc_tsinfo.sc_numts = 1;
    sc_tsinfo.sc_tsarrayp = &scts; 
    /* Get CTbus time slot connected to transmit of voice
       channel on board ...1 */
    if (dx_getxmitslot(pline->ldev, &sc_tsinfo) == -1)
    {
        printf("Error message = %s", ATDV_ERRMSGP(pline->ldev));
        exit(1);
    } 
    /* Connect the receive of the digital channel 1 on board 1 to CTBus
       time slot of voice channel 1 */
    if (gc_Listen(pline->ldev, &sc_tsinfo, EV_SYNC) == -1) 
    {
        /* process error return as shown */
        gc_ErrorInfo( &gc_error_info );
        printf ("Error: gc_Listen() on linedev: 0x%lx, GC ErrorValue: 0x%hx - %s, 
                 CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n",
                 pline->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


PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

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