Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 381
enable detection of call status transition (CST) events — dx_setevtmsk( )
/* Use dx_setevtmsk() to enable call status transition events
* on this channel.
*/
if (
dx_setevtmsk(chdev[i],
DM_LCOFF|DM_LCON|DM_RINGS|DM_SILOFF|DM_SILON|DM_WINK)
== -1) {
/* process error */
}
/* Using sr_enbhdlr(), set up handler function to handle call status
* transition events on this channel.
*/
if (sr_enbhdlr(chdev[i], TDX_CST, cst_handler) == -1) {
/* process error */
}
/* Use sr_waitevt to wait for call status transition event.
* On receiving the transition event, TDX_CST, control is transferred
* to the handler function previously established using sr_enbhdlr().
*/
.
.
}
}
int cst_handler()
{
DX_CST *cstp;
/* sr_getevtdatap() points to the event that caused the call status
* transition.
*/
cstp = (DX_CST *)sr_getevtdatap();
switch (cstp->cst_event) {
case DE_RINGS:
printf("Ring event occurred on channel %s\n",
ATDX_NAMEP(sr_getevtdev()));
break;
case DE_WINK:
printf("Wink event occurred on channel %s\n",
ATDX_NAMEP(sr_getevtdev()));
break;
case DE_LCON:
printf("Loop current ON event occurred on channel %s\n",
ATDX_NAMEP(sr_getevtdev()));
break;
case DE_LCOFF:
.
.
}
/* Kick off next function in the state machine model. */
.
.
return 0;
}
!
!!
! See Also
dx_getevt( ) (to handle call status transition events, synchronous operation)
sr_getevtdatap( ) (to handle call status transition events, asynchronous operation)
DX_CST data structure
dx_addtone( )