Intel 05-1832-002 IP Phone User Manual


 
438 Voice API for Windows Operating Systems Library Reference — November 2003
dx_wink( ) — generate an outbound wink
/* get digits while on-hook */
if (dx_getdig(chdev,&tpt, &digitp, EV_SYNC) == -1) {
/* error getting digits */
}
/* now we can go off-hook and continue */
if ( dx_sethook(chdev,DX_OFFHOOK,EV_SYNC)== -1) {
/* process error */
}
.
.
}
!
!!
! Example 2
This example illustrates how to use dx_wink( ) in asynchronous mode.
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
#define MAXCHAN 24
int wink_handler();
main()
{
int i, chdev[MAXCHAN];
char *chnamep;
int srlmode;
/* Set SRL to run in polled mode. */
srlmode = SR_POLLMODE;
if (sr_setparm(SRL_DEVICE, SR_MODEID, (void *)&srlmode) == -1) {
/* process error */
}
for (i=0; i<MAXCHAN; i++) {
/* Set chnamep to the channel name - e.g., dxxxB1C1 */
/* open the channel with dx_open( ). Obtain channel device
* descriptor in chdev[i]
*/
if ((chdev[i] = dx_open(chnamep,NULL)) == -1) {
/* process error */
}
/* Using sr_enbhdlr(), set up handler function to handle wink
* completion events on this channel.
*/
if (sr_enbhdlr(chdev[i], TDX_WINK, wink_handler) == -1) {
/* process error */
}
/* Before issuing dx_wink(), ensure that the channel is onhook,
* else the wink will fail.
*/
if(dx_sethook(chdev[i], DX_ONHOOK, EV_ASYNC)==-1){
/* error setting channel on-hook */
}
/* Use sr_waitevt( ) to wait for the completion of dx_sethook( ). */
if (
dx_wink(chdev[i], EV_ASYNC)
== -1) {
/* error winking channel */
}
}