Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 385
provide control of the hook switch status — dx_sethook( )
If running asynchronously, termination is indicated by a TDX_SETHOOK event. The cst_event
field in the DX_CST data structure will specify one of the following:
DX_ONHOOK if the hookstate has been set to on-hook
DX_OFFHOOK if the hookstate has been set to off-hook
Use the Event Management function sr_getevtdatap( ) to return a pointer to the DX_CST
structure.
ATDX_HOOKST( ) will also return the type of hookstate event.
!
!!
! Synchronous Operation
By default, this function runs synchronously.
If running synchronously, dx_sethook( ) will return 0 when complete.
!
!!
! Cautions
None.
!
!!
! Errors
If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function
ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive
error message. One of the following error codes may be returned:
EDX_BADPARM
Invalid parameter
EDX_SYSTEM
Error from operating system; use dx_fileerrno( ) to obtain error value
!
!!
! Example 1
This example illustrates how to use dx_sethook( ) in synchronous mode.
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
main()
{
int chdev;
/* open a channel with chdev as descriptor */
if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) {
/* process error */
}
/* put the channel on-hook */
if (
dx_sethook(chdev,DX_ONHOOK,EV_SYNC)
== -1) {
/* error setting hook state */
}
.
.