Re: question about LINEBEARERMODE_PASSTHROUGH
by Crespo » Sat, 22 Apr 2006 14:16:14 GMT
r Andreas,
Many thanks, You are most kind to answer my question. Yes,I have closed
the file handle gotten from ITLegacyCallMediaControl2->GetID(XXXX) and I
only mange one call at a time, I think I must have something related to the
old call forgotten to release.
My codes is just listed like belowed:
1. make a call:
hr =
pAddress->CreateCall(bstrAddressToCall,LINEADDRESSTYPE_PHONENUMBER,TAPIMEDIA
TYPE_AUDIO,&g_pCurrentCall);
hr = g_pCurrentCall->Connect(VARIANT_TRUE);
2. Process call state of connected:
IEnumCall* ppCallEnum = NULL;
HRESULT hr = pAddress->EnumerateCalls(&ppCallEnum);
ITCallInfo * pCallInfo = NULL;
hr = ppCallEnum->Next(1,&pCallInfo,NULL);
CString csDeviceName = "comm/datamodem";
BSTR bstrDeviceName = csDeviceName.AllocSysString();
ITLegacyCallMediaControl2 * pCallMediaControl = NULL;
hr =
g_pCurrentCall->QueryInterface(IID_ITLegacyCallMediaControl2,(void**)&pCallM
ediaControl);
hr =
pCallInfo->put_CallInfoLong(CIL_BEARERMODE,LINEBEARERMODE_PASSTHROUGH);
DWORD size = 0;
BYTE *pVarDeviceID;
hr = pCallMediaControl->GetID(bstrDeviceName,&size,&pVarDeviceID);
memcpy( &hCommFile, pVarDeviceID, 4 );
hCommFile = *(LPHANDLE)pVarDeviceID;
CloseHandle(hCommFile);
pCallMediaControl->Release();
ppCallEnum->Release();
pCallInfo->Release();
if(g_pCurrentCall)
{
HRESULT hr = g_pCurrentCall->Disconnect(DC_NORMAL);
g_pCurrentCall->Release();
}
g_pCurrentCall = NULL;
pCallStateEvent->Release();
pCallStateEvent = NULL;
For simplity, here I have not supplied codes handling HRESULT errors
returned from every called TAPI object's method.
During my debugging, I found if I put LINEBEARERMODE_VOICE instead of
LINEBEARERMODE_PASSTHROUGH, my codes will work fine and I can make a new
call again.
I am using c++ in .net environment.
Best Regards
Crespo.wu
"Andreas Marschall [MVP TAPI]" < XXXX@XXXXX.COM >
news:eQ7$ XXXX@XXXXX.COM ...
"Crespo" < XXXX@XXXXX.COM > schrieb im Newsbeitrag
news:eb% XXXX@XXXXX.COM ...
ITCallInfo->put_CallInfoLong(CIL_BEARERMODE,LINEBEARERMODE_PASSTHROUGH)
new
that
wu,
do you also CloseHandle() all used handles for the direct modem
communication?
UniModem.TSP can only manage one call at a time.
If there is any call related reference to the old call then it can't manage
a
new one.
Are you using .NET ?
--
Best Regards
Andreas Marschall
Microsoft MVP for TAPI / Windows SDK
TAPI / TSP Developer and Tester
My TAPI and TSPI FAQ:
http://www.I-B-A-M.de/Andreas_Marschall's_TAPI_and_TSPI_FAQ.htm
My Toto?Tools (a collection of free, mostly TAPI related tools):
http://www.i-b-a-m.de/Andreas_Marschall's_Toto_Tools.htm
TAPI development around the world (Frappr! map):
http://www.frappr.com/TAPIaroundTheWorld
* 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.