ec_stopch( )
Cautions | Example | Errors | See Also
Description
The ec_stopch( ) function forces termination of currently active I/O functions on a CSP-capable full-duplex channel.
This function can terminate CSP or voice library I/O functions.
The StopType value determines whether the play, receive or both sides of the channel are terminated. In contrast, the dx_stopch( ) function only terminates the prompt play side.
Parameter
Description
chDev The channel device handle obtained when the CSP-capable device is opened using dx_open( ). StopType The type of stop channel to perform: mode Specifies the mode: Cautions
- The ec_stopch( ) has no effect on a channel that has either of the following functions issued:
- If ec_stopch( ) is called on a channel dialing with Call Analysis enabled, the Call Analysis process stops but dialing is completed. Any Call Analysis information collected prior to the stop is returned by extended attribute functions.
- If an I/O function terminates (due to another reason) before ec_stopch( ) is issued, the reason for termination does not indicate ec_stopch( ) was called.
- When calling ec_stopch( ) from a signal handler, you must set mode to EV_ASYNC.
- In Linux, applications that use multiple threads, you must avoid having two or more threads call functions that send commands to the same channel; otherwise, the replies can be unpredictable and cause those functions to time out. If you must do this, use semaphores to prevent concurrent access to a particular channel.
Example
#include <windows.h> /* include in Windows applications only; exclude in Linux */ #include <stdio.h> #include <srllib.h> #include <dxxxlib.h> #include <eclib.h> #include <errno.h> /* include in Linux applications only; exclude in Windows */ main() { int chdev, srlmode; /* Set SRL to run in polled mode. */ srlmode = SR_POLLMODE; if (sr_setparm(SRL_DEVICE, SR_MODEID, (void *)&srlmode) == -1) { /* process error */ } /* Open the channel using dx_open( ). Get channel device descriptor in * chdev. */ if ((chdev = dx_open("dxxxB1C1",0)) == -1) { /* process error */ } /* continue processing */ . . /* Force the channel idle. The I/O function that the channel is * executing will be terminated, and control passed to the handler * function previously enabled, using sr_enbhdlr(), for the * termination event corresponding to that I/O function. * In the asynchronous mode, ec_stopch() returns immediately, * without waiting for the channel to go idle. */ if (ec_stopch(chdev, FULLDUPLEX, EV_ASYNC) == -1) { /* process error */ } }Errors
If the function returns -1, use ATDV_LASTERR( ) to return the error code and ATDV_ERRMSGP( ) to return a descriptive error message.
One of the following error codes may be returned:
See Also
Click here to contact Dialogic Customer Engineering
Copyright 2001, Intel Corporation