Re: LINEERR_INVALCALLHANDLE

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Stefan Lechner" <StefanLechner@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im
Newsbeitrag news:4DBF98DE-1F33-4515-8286-E6DAC8096BFC@xxxxxxxxxxxxxxxx
> I do not understand why I get an LINEERR_INVALCALLHANDLE error after calling
> lineGetCallInfo using the handle from the callback function (dwMsg =
> LINE_CALLINFO)!
> I found out that I get the error in the case that the LINE_CALLINFO is a
> LINECALLINFOSTATE_NUMMONITORS or a LINECALLINFOSTATE_NUMOWNERDECR after the
> call is already deallocated.

Stefan,
that's it!
After you deallocate a call handle you don't have a handle to that call
anymore.


> The TAPI-Browser logs the following lines after ring off:
>
> received LINE_CALLSTATE
> device=x10224
> cbInst=x0
> param1=x1, IDLE
> param2=x0,
> param3=x0,
> lineGetCallStatus returned SUCCESS
> Call x10224 deallocated on IDLE
> received LINE_CALLINFO
> device=x10224
> cbInst=x0
> param1=x2000, NUMMONITORS
> param2=x0,
> param3=x0,
>
> In my application I get the same order:
> - LINE_CALLSTATE = IDLE => lineDeallocateCall
> - any LINE_CALLINFO => lineGetCallInfo
> - LINEERR_INVALCALLHANDLE (because the handle is already deallocated?)

Yes, because the handle is already deallocated.


> My solution is to query the LINECALLINFO structure only if NOT
> LINECALLINFOSTATE_NUMMONITORS AND NOT LINECALLINFOSTATE_NUMOWNERDECR.
>
> Am I right?
> Are there more LINECALLINFOSTATEs that I have to exclude?
> Why do I get a call handle from TAPI that is not valid at the time my
> callback function is executed?

Well, you invalidated the call handle yourself by calling
lineDeallocateCall()...
LINE_CALLINFO doesn't give you a (new) call handle it only provides a
reference.
Valid call handles are provided by LINE_APPNEWCALL message or lineMakeCall() /
linePrepareAddToConference() / linePickup() / lineSetupConference() /
lineSetupTransfer() / lineUnpark() functions (but only if the corresponding
LINE_REPLY indicates success).

> Is there any function to validate a call handle?


It is suggested to maintain your own list a valid call handles.
In addition you can use lineGetNewCalls() to get call handles that you
currently don't have.

--
Best Regards
Andreas Marschall
Microsoft MVP for TAPI / Windows SDK
TAPI / TSP Developer and Tester
http://www.I-B-A-M.de/Andreas_Marschall's_TAPI_and_TSPI_FAQ.htm
* Please post all messages and replies to the newsgroup so all may
* benefit from the discussion. Private mail is usually not replied to.
* This posting is provided "AS IS" with no warranties, and confers no rights.



.



Relevant Pages

  • Re: waveoutopen callback restrictions
    ... > The waveOutProc function is the callback function used with the ... > callback function, except for EnterCriticalSection, LeaveCriticalSection, ... Calling other wave functions will cause deadlock. ... >> was i just lucky that waveOutWrite seemed to work so well when called from ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: Is CALLBACK or WINAPI is necessary?
    ... > Yes, My own function pointer. ... >>> for functions that Windows will be calling. ... I was thinking the OP was writing a callback function that Windows ...
    (microsoft.public.vc.language)
  • Debugging Async call to WebService, how
    ... I'm calling a webservice using a async callback function, ...
    (microsoft.public.vsnet.debugging)
  • Re: Is CALLBACK or WINAPI is necessary?
    ... > For declaring a callback function? ... I believe __stdcall is a requirement ... > for functions that Windows will be calling. ...
    (microsoft.public.vc.language)