통화 받기

다음 코드 예제에서는 미디어를 렌더링할 적절한 터미널을 찾거나 만드는 것과 같은 새 호출 알림을 처리하는 방법을 보여 줍니다. 이 예제는 애플리케이션이 이벤트 처리를 위해 구현해야 하는 switch 문의 부분입니다. 코드 자체는 ITTAPIEventNotification::Event 구현에 포함되거나 Event 메서드가 스위치를 포함하는 작업자 스레드에 메시지를 게시할 수 있습니다.

이 코드 예제를 사용하기 전에 TAPI 초기화, 주소 선택이벤트 등록에서 작업을 수행해야 합니다.

또한 ITBasicCallControlITAddress 인터페이스 포인터를 검색한 후 터미널 선택에 설명된 작업을 수행해야 합니다.

참고

이 예제에는 오류 검사 및 프로덕션 코드에 적합한 릴리스가 없습니다.

 

// 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. 
}

이벤트

ITTAPIEventNotification

ITTAPI::RegisterCallNotifications

ITCallNotificationEvent

ITCallInfo

ITBasicCallControl

ITTerminalSupport