Delen via


Een oproep ontvangen

In het volgende codevoorbeeld ziet u hoe nieuwe oproepmeldingen worden verwerkt, zoals het zoeken of maken van de juiste terminals om de media weer te geven. Dit voorbeeld is een deel van de switch-instructie die een toepassing moet implementeren voor gebeurtenisafhandeling. De code zelf kan zijn opgenomen in de implementatie van ITTAPIEventNotification::Eventof de methode Event kan een bericht plaatsen in een werkrolthread die de switch bevat.

Voordat u dit codevoorbeeld gebruikt, moet u de bewerkingen uitvoeren in TAPI-initialiseren, Een adresselecteren en Gebeurtenissen registreren.

U moet ook de bewerkingen uitvoeren die worden geïllustreerd in Een Terminal- selecteren na het ophalen van de ITBasicCallControl- en ITAddress interfaceaanwijzers.

Notitie

Dit voorbeeld bevat niet de foutcontrole en releases die geschikt zijn voor productiecode.

 

// pEvent is an IDispatch pointer for the ITCallNotificationEvent interface of the
// call object created by TAPI, and is passed into the event handler by TAPI. 

case TE_CALLNOTIFICATION:
{
    // Get the ITCallNotification interface.
    ITCallNotificationEvent * pNotify;
    hr = pEvent->QueryInterface( 
            IID_ITCallNotificationEvent, 
            (void **)&pNotify 
            );
    // If ( hr != S_OK ) process the error here. 
    
    // Get the ITCallInfo interface.
    ITCallInfo * pCallInfo;
    hr = pNotify->get_Call( &pCallInfo);
    // If ( hr != S_OK ) process the error here. 

    // Get the ITBasicCallControl interface.
    ITBasicCallControl * pBasicCall;
    hr = pCallInfo->QueryInterface(
            IID_ITBasicCallControl,
            (void**)&pBasicCall
            );
    // If ( hr != S_OK ) process the error here. 

    // Get the ITAddress interface.
    ITAddress * pAddress;
    hr = pCallInfo->get_Address( &pAddress );
    // If ( hr != S_OK ) process the error here. 

    // Create the required terminals for this call.
    {
        // See the Select a Terminal code example.
    }
    // Complete incoming call processing.
    hr = pBasicCall->Answer();
    // If ( hr != S_OK ) process the error here. 
}

gebeurtenissen

ITTAPIEventNotification-

ITTAPI::RegisterCallNotifications

ITCallNotificationEvent

ITCallInfo-

ITBasicCallControl-

ITTerminalSupport-