User guide

64 RealCT Direct API Developer Guide
Chapter 3: T1 Networking
Monitoring for Disconnect
Whether you received or originated the call, you should
continuously monitor the line for disconnect using
RHT_WAIT_LINE_OFF. The sooner you detect the disconnect,
the sooner the line is free for new calls, allowing you to reach
more people in the same amount of time without increasing the
number of lines. RHT_WAIT_LINE_OFF returns successfully
when it detects a disconnect or returns an error if it detects
other conditions. If RHT_WAIT_LINE_OFF returns an error,
use RHT_GET_STATUS for more information about the
termination.
When the application detects a disconnect, it should terminate
what it is doing, update some information, and hang up in
preparation for a new call. Wink Start, Double Wink Start, and
Immediate Start protocols provide reliable disconnect signals.
Loop Start and Ground Start protocols usually don’t provide
disconnect information. In these protocols, only the CO receives
answer and disconnect signals. We recommend that you use one
of the protocols that provide disconnect information if that
protocol is available from your carrier.
If the application is running a voice processing function when it
detects disconnect, it should terminate that function
immediately. There are two ways to terminate a function. The
first uses two threads (or processes) per channel: one to run the
line monitoring function and another the run the voice
processing function. The main thread synchronizes these two
threads.
A better way to terminate VP functions is to run the functions
so they terminate automatically when the application detects a
disconnect. To do this, set the field ‘LineTerm0’ in the
VPstartStop_s or RhtDialDigit_s structures. This field provides
a way for the VP driver and the T1 driver to communicate.