拨打电话

下面的代码示例演示如何创建调用对象、发现与调用关联的流、选择和创建适当的终端、选择终端到流,以及完成连接。

使用此代码示例之前,必须在 初始化 TAPI 中执行作,并 选择地址

此外,必须执行 调用 ITAddress::CreateCall后选择终端 所示的作。

注意

此示例没有适用于生产代码的错误检查和发布。

 

// Specify the destination address.
//
// szAddressToCall and 
// dwAddressType have been
// retrieved from a user interface.
ITBasicCallControl * pBasicCall
bstrAddressToCall = SysAllocString( szAddressToCall );
// If ( bstrAddressToCall == NULL ) process the error here. 

HRESULT hr = pAddress->CreateCall(
    bstrAddressToCall,
    dwAddressType,
    &pBasicCall
 );
// If ( hr != S_OK ) process the error here. 

SysFreeString(bstrAddressToCall);

// Create the required terminals for this call.
{
    // See the Select a Terminal code example.
}

// Make the connection.
pBasicCall->Connect( TRUE );

ITAddress::CreateCall

ITBasicCallControl

ITBasicCallControl::Connect