Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 449
perform the actions of an automated attendant — li_attendant( )
// start the first attendant thread
if ((hThread[0] = (HANDLE) _beginthread( li_attendant, 0, (void *) &Att[0] )) == (HANDLE) -1)
{
printf("Cannot create thread 1.\n");
exit(0);
}
// start the second attendant thread
if ((hThread[1] = (HANDLE) _beginthread( li_attendant, 0, (void *) &Att[1] )) == (HANDLE) -1)
{
printf("Cannot create thread 2.\n");
exit(0);
}
Sleep(30000); // Wait as long as you want to run the application
SetEvent(hEvent);
// notify threads to exit
WaitForMultipleObjects(2, hThread, TRUE, INFINITE); // wait until the threads are done
CloseHandle(hEvent);
return(0);
}
int att_onhook(int dev)
{
printf("ONHOOK\n");
return (dx_sethook(dev, DX_ONHOOK, EV_SYNC));
}
int att_offhook(int dev)
{
printf("OFFHOOK\n");
return(dx_sethook(dev, DX_OFFHOOK, EV_SYNC));
}
int att_waitforrings(int dev, BOOL *bWaiting)
{
int ret;
DX_EBLK eblk;
ret = dx_getevt(dev, &eblk, 0);
if (ret == 0)
{
if (eblk.ev_event == DE_RINGS)
*bWaiting = FALSE;
}
return (0);
}
BOOL att_mapextension(char *szExtension, char *szMappedExtension)
{
int nExtId;
// for demo purposes use a dumb translation, increment extension by one...
nExtId = atoi(szExtension) + 1;
// prefix with flash hook and pause characters
sprintf(szMappedExtension, "&,,%*.d", EXTENSION_LENGTH, nExtId);
return(TRUE);
}
!
!!
! See Also
li_islicensed_syntellect( )