08.01.2013 Views

Dialogic® Global Call API Library Reference

Dialogic® Global Call API Library Reference

Dialogic® Global Call API Library Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

gc_Get<strong>Call</strong>State( ) — retrieve the state of the call<br />

returned is technology specific, see the technology-specific error header file(s) for the error<br />

definition (for example, ccerr.h or isdnerr.h file for the ISDN call control library).<br />

Example<br />

#include <br />

#include <br />

#include <br />

#include <br />

#define MAXCHAN 30 /* max. number of channels in system */<br />

/*<br />

* Data structure which stores all information for each line<br />

*/<br />

struct linebag {<br />

LINEDEV ldev; /* <strong>Global</strong><strong>Call</strong> line device handle */<br />

CRN crn; /* <strong>Global</strong><strong>Call</strong> <strong>API</strong> call handle */<br />

int state; /* state of first layer state machine */<br />

} port[MAXCHAN+1];<br />

struct linebag *pline; /* pointer to access line device */<br />

int get_call_state(int port_num)<br />

{<br />

LINEDEV ldev; /* line device ID */<br />

CRN crn; /* call reference number */<br />

int call_state; /* current state of call */<br />

GC_INFO gc_error_info; /* <strong>Global</strong><strong>Call</strong> error information data */<br />

/* Find info for this time slot, specified by 'port_num' */<br />

/* (Assumes port_num is valid) */<br />

pline = port + port_num;<br />

crn = pline -> crn;<br />

/*<br />

* Retrieve the call state and save it.<br />

*/<br />

if (crn)<br />

{<br />

if (gc_CRN2LineDev( crn, &ldev) != GC_SUCCESS)<br />

{<br />

/* get and process error */<br />

gc_ErrorInfo( &gc_error_info );<br />

printf ("Error: gc_CRN2LineDev() on crn: 0x%lx, GC ErrorValue: 0x%hx - %s,<br />

CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n",<br />

crn, gc_error_info.gcValue, gc_error_info.gcMsg,<br />

gc_error_info.ccLibId, gc_error_info.ccLibName,<br />

gc_error_info.ccValue, gc_error_info.ccMsg);<br />

return (gc_error_info.gcValue);<br />

}<br />

if (gc_Get<strong>Call</strong>State( crn, &call_state) != GC_SUCCESS)<br />

{<br />

/* process error return as shown */<br />

gc_ErrorInfo( &gc_error_info );<br />

printf ("Error: gc_Get<strong>Call</strong>State() on devive handle: 0x%lx,<br />

GC ErrorValue: 0x%hx - %s, CCLibID: %i - %s, CC ErrorValue: 0x%lx - %s\n",<br />

ldev, gc_error_info.gcValue, gc_error_info.gcMsg,<br />

gc_error_info.ccLibId, gc_error_info.ccLibName,<br />

gc_error_info.ccValue, gc_error_info.ccMsg);<br />

return (gc_error_info.gcValue);<br />

}<br />

}<br />

}<br />

pline->state = call_state;<br />

return (0);<br />

138 Dialogic ® <strong>Global</strong> <strong>Call</strong> <strong>API</strong> <strong>Library</strong> <strong>Reference</strong> — January 2008<br />

Dialogic Corporation

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!