Shutting Down TAPI

Ending a call works the same for incoming and outgoing calls. When the call ends, the application should disconnect and terminate the call by using the lineDrop function. If the incoming call hangs up on the other end, TAPI automatically drops the line.

To drop a line

  1. Call the lineDrop function.
  2. Free memory by using the lineDeallocateCall function.

The following code example shows how to use the lineDrop and lineDeallocateCall functions.

To drop a line, you first must call lineDrop.

g_DropCallRequestID = lineDrop (g_hCall, NULL, 0);

After receiving a LINECALLSTATE_IDLE message, you must call the lineDeallocateCall function.

lineDeallocateCall (g_hCall);

Deallocating a call handle means that the system must free system-allocated memory that is related to the call after the call has been dropped. The application must call the lineDeallocateCall function to free allocated memory.

To close the line, the application should call the lineClose function. After the line has closed successfully, the handle is no longer valid.

To close a line for the incoming call

  1. Cancel the call by using lineDrop function.
  2. Close the open line by using the lineClose function.
  3. Reinitialize the variables.

The following code example shows how to use the lineClose function to close the line.

VOID CurrentLineClose ()
{
  // Close the current line.
  if (g_CurrentLineInfo.hLine)
    lineClose (g_CurrentLineInfo.hLine);

  // Reinitialize the variables.
  g_CurrentLineInfo.hLine = NULL;
  g_bCurrentLineAvail = TRUE;
  g_hCall = NULL;
}

See Also

Establishing a Modem Connection | Shutdown Services | TAPI Functions

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.