User guide
August 2001 59
Handling Incoming and Outgoing Calls
The function automatically sends any acknowledgments
required by the protocol. This serves two purposes. First, it
isolates the application from the protocol. You can communicate
with different carriers simply by switching protocol files rather
than making changes to the application. Second, it improves
timing. In a heavily loaded system, threads and processes can
be preempted at almost any time, and it might take several
seconds before they can run again. If one function detected a call
and another sent the acknowledgment, the two signals could be
several seconds apart. This delay might exceed the maximum
allowed by the originating end.
The guard time adds a space between two consecutive line
function calls so the remote end can detect a change in the
signaling bits. One example of when a guard time is necessary
is in an application designed to answer a call, play a file, then
disconnect. If the application cannot play the file, it
immediately hangs up. If the answer is on the line for a very
short amount of time before the disconnect, the remote end
might mistake the on hook/off hook/on hook pattern as a wink
rather than an answer followed by a disconnect. A guard time
after going on hook guarantees that the signal was on the line
long enough for the remote end to recognize the signal.
Although a guard time is not necessary in
RHT_WAIT_LINE_ON, it is available for consistency. It is set
to 0 by default.
If the application calls RHT_WAIT_LINE_ON when the line is
in a state other than idle, the function returns an error.
RHT_WAIT_LINE_ON should continuously wait for a call, even
though you can limit the function’s run time with the parameter
MDP_WAIT_LINE_ON_TIMEOUT. If you use this timeout to
monitor for other conditions, you could miss incoming calls. Use
another thread to do any necessary monitoring. To terminate
RHT_WAIT_LINE_ON, use RHT_STOP. The application is
notified that the function terminated and will take any
appropriate action.