User guide
August 2001 117
Handling Incoming and Outgoing Calls
Monitoring For Disconnection
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_ON returns an error, use
RHT_GET_STATUS for more information about the
termination.
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 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 E1 device to communicate.
With ‘LineTerm0’ set, the E1 device automatically runs
RHT_WAIT_LINE_OFF. It continues monitoring the line until
the VP driver sends a signal that the VP function terminated or
until the E1 device detects a disconnect. When it detects a
disconnect, the E1 device signals the VP driver to terminate the
function. When the VP function terminates, check the condition
that caused termination using RHT_GET_STATUS. A
T_RHT_LINE_OFF condition means that RHT_WAIT_LINE_OFF
caused the function to terminate.