Ending a Call and Shutting Down TAPI

When a user ends the call, the application should disconnect and terminate the call with lineDrop. The lineDrop function can also be used to drop a call in progress.

When the application receives the LINE_CALLSTATE message indicating that the call has ended, the handle should be released before finishing the lineDeallocateCall function.

    To drop a line

  1. Call the lineDrop function.
  2. Free memory with the lineDeallocateCall function.

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

g_DropCallRequestID = lineDrop (g_hCall, NULL, 0);
lineDeallocateCall (g_hCall);

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

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

    To close a line

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

The following code example shows how to use lineClose to close the current 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;
}

The lineShutdown function completely disconnects the application from TAPI. If lineShutdown is called when the TAPI application has lines open or calls active, the calls are closed and the line is shut down.

    To disconnect TAPI from the application

The following code example shows how to use lineShutdown to disconnect.

    lineShutdown (g_hLineApp);