Aracılığıyla paylaş


Terminal seçin

Aşağıdaki kod örneği, bir çağrıyla ilişkili akışlarda terminallerin nasıl seç yapılacağını gösterir.

Bu kod örneğini kullanmadan önce, TAPI başlatma ve AdresSeçme içinde işlemleri gerçekleştirmeniz gerekir.

Ayrıca bu örnek, uygulamanın bir gelen veya giden çağrının ITBasicCallControl arabirimine yönelik bir işaretçiye sahip olmasını gerektirir. Bu işaretçiyi elde etmeyle ilgili kod örnekleri için bkz. Arama Yapma veya Arama Alma .

Not

Bu örnekte hata denetimi yoktur ve üretim kodu için uygun sürümler vardır.

 

// pAddress is an ITAddress interface pointer.
// pBasicCall is an ITBasicCallControl interface pointer.

// Get the ITStreamControl interface.
ITStreamControl * pStreamControl;
HRESULT hr = pBasicCall->QueryInterface(
        IID_ITStreamControl,
        (void **) &pStreamControl
        );
// If ( hr != S_OK ) process the error here. 

// Enumerate the streams and select 
// terminals onto them.
IEnumStream * pEnumStreams;
ITStream    * pStream;
hr = pStreamControl->EnumerateStreams(&pEnumStreams);
// If ( hr != S_OK ) process the error here. 

while ( S_OK == pEnumStreams->Next(1, &pStream, NULL) )
{
    // Get the media type and direction of this stream.
    long                lMediaType;
    TERMINAL_DIRECTION  dir;
    hr = pStream->get_MediaType( &lMediaType );
    // If ( hr != S_OK ) process the error here. 
    hr = pStream->get_Direction( &dir );
    // If ( hr != S_OK ) process the error here. 

    // Create the default terminal for this media type and direction.
    //   If lMediaType == TAPIMEDIATYPE_VIDEO and
    //   dir == TD_RENDER, a dynamic video render terminal
    //   is required. Please see Incoming.cpp in 
    //   the samples section of the SDK. 
    // For all other terminals, get the default static terminal.
    ITTerminal * pTerminal;
    ITTerminalSupport * pTerminalSupport;
    hr = pAddress->QueryInterface( 
            IID_ITTerminalSupport, 
            (void **)&pTerminalSupport
         );
    // If ( hr != S_OK ) process the error here. 
    hr = pTerminalSupport->GetDefaultStaticTerminal(
            lMediaType,
            dir,
            pTerminal
         );
    // If ( hr != S_OK ) process the error here. 
    // Select the terminal on the stream.
    hr = pStream->SelectTerminal(pTerminal);
    // If ( hr != S_OK ) process the error here. 
}

ITAddress

ITBasicCallControl

ITStreamControl

ITStream

IEnumStream

BTTerminal

ITTerminalSupport