Global Call API for HMP on Windows Programming Guide — August 2006 77
5
5.Application Development
Guidelines
This chapter provides some tips when developing programs using Global Call. Topics include:
General Programming Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Tips for Programming Drop and Insert Applications . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Using Global Call with Digital Network Interface Boards. . . . . . . . . . . . . . . . . . . . . . 79

5.1 General Programming Tips

The following tips apply when programming with Global Call:
When using Global Call functions, the application must use the Global Call handles (that is,
the line device ID and CRN) to access Global Call functions. Do not substitute a network,
voice or media device handle for the Global Call line device ID or CRN. If the application
needs to use a network, voice or media device handle for a specific network or voice library
call, for example, nr_scroute() (for E1, T1 or ISDN technologies only) or dx_play( ) (all
technologies), you must use the gc_GetResourceH( ) to retrieve the network, voice or media
device handle, associated with the specified Global Call line device. The gc_GetResourceH()
function is only needed if the voice or media resource is associated with a Global Call line
device. If a voice resource is not part of the Global Call line device, the device handle returned
from the dx_open( ) call should be used.
Do not access the underlying call control libraries directly. All access must be done using the
Global Call library, that is, using Global Call (gc_) functions.
Do not call any network library (dt_) function directly from your application that may affect
the state of the line or the reporting of events, for example, dt_settssig( ), dt_setevtmsk( ), or
others.
The GCEV_BLOCKED and the GCEV_UNBLOCKED events are line related events, not call
related events. These events do not cause the state of a call to change.
Before exiting an application:
Drop and release all active calls, using the gc_DropCall() and gc_ReleaseCallEx( )
functions.
Close all open line devices, using the gc_Close() function.
Stop the application, using the gc_Stop( ) function
Before issuing gc_DropCall( ), you must use the dx_stopch( ) function to terminate any
application-initiated voice functions, such as dx_play( ) or dx_record( ).
In Windows environments, although asynchronous models are more complex than the
synchronous model, asynchronous programming is recommended for more complex
applications that require coordinating multiple tasks. Asynchronous programming can handle
multiple channels in a single thread. In contrast, synchronous programming requires separate