Partilhar via


TAPI Call Handle Confusion

TAPI call handles (HCALLs) consume memory and should be closed with lineDeallocateCall when no longer needed.

If an application has a TAPI line device opened (HLINE), then TAPI will allocate call handles on its behalf in order to indicate call status messages to the application. Such an application needs to be aware of this and at the very least process the LINE_CALLSTATE message indicating LINECALLSTATE_IDLE by calling lineDeallocateCall on the HCALL passed as dwParam1. Otherwise, the system will leak almost 200 bytes of memory per call.

For an application using TAPI to control a call, LINECALLSTATE_IDLE is also a good time to call lineDeallocateCall. In this case though, the application needs to be aware that calling lineDeallocateCall will cause TAPI to delete any LINE_REPLY messages for asynchronous operations associated with that HCALL. If the application has a separate thread that calls lineDrop and then blocks waiting for the associated LINE_REPLY, there needs to be coordination with the message handling thread that just called lineDeallocateCall, otherwise the lineDrop thread will block indefinitely.

 

Author: David Kanz