TapiCall.Redirect no exception thrown on error


It appears that when a Redirect fails for some reason, this is not correctly detected.

See the following code in EndRedirect:
var req = (PendingTapiRequest)ar;
if (req.Result < 0)
    throw new TapiException("lineRedirect failed", req.Result);
Unfortunately, it appears that Result is a positive number, even when an error happend.

In my particular scenario, TAPI returns a LINEERR_OPERATIONFAILED (0x80000048). Since PendingTapiRequest.Result is of type long, it will convert that value into 2147483720 (instead of -2147483576) and it will not throw the exception.

This appears to be the case in most End... methods.


tuttb wrote Mar 17, 2015 at 11:23 PM

While your problem analysis makes sense, your suggested patch seems wrong.
I audited all usages of HandleCompletion, and the PendingTapiRequest .ResultCode as used by ATAPI and determined that in all cases the data was 32bits.

PHONE_REPLY and LINE_REPLY dwParam2 are both 32bits from TAPI.
The digit gathering reasons are also only 32bits from TAPI.