我有我開發從電腦發送到東芝CIX TAPI命令該路線的手機一個C#TAPI應用程序。線路本身並不重要,因爲該部分正在工作。我可以從應用程序撥打電話。但是,應答和掛斷不能正常工作。當我嘗試disconnct我得到這個錯誤:C#應用程序嘗試使用TAPI與東芝CIX
此實現不採取建議(從HRESULT異常:0x80040003(OLE_E_ADVISENOTSUPPORTED))
當我試着回答我得到:
Unable to cast COM object of type 'System.__ComObject' to interface type 'TAPI3Lib.ITBasicCallControl'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B1EFC389-9355-11D0-835C-00AA003CCABD}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
我的應用程序基於: http://www.codeproject.com/KB/IP/devangpro.aspx 由於存在crossthread問題,爲了讓代碼項目上的應用程序至少正常運行,我必須做一個委託向項目列表添加項目。
這裏是斷開:
IEnumCall ec = ia[line].EnumerateCalls();
uint arg = 0;
ITCallInfo ici;
try
{
ec.Next(1,out ici,ref arg);
ITBasicCallControl bc=(ITBasicCallControl)ici;
bc.Disconnect(DISCONNECT_CODE.DC_NORMAL);
ici.ReleaseUserUserInfo();
}
catch(Exception exp)
{
MessageBox.Show("No call to disconnect!","TAPI3");
}
這裏是答案:
IEnumCall ec = ia[line].EnumerateCalls();
uint arg=0;
ITCallInfo ici;
try
{
ec.Next(1,out ici,ref arg);
ITBasicCallControl bc=(TAPI3Lib.ITBasicCallControl)ici;
if(!reject)
{
bc.Answer();
}
else
{
bc.Disconnect(DISCONNECT_CODE.DC_REJECTED);
ici.ReleaseUserUserInfo();
}
}
catch(Exception exp)
{
MessageBox.Show("There may not be any calls to answer! \n\n"+exp.ToString(),"TAPI3");
}