通話の受信
次のコード例は、メディアをレンダリングするための適切な端末の検索や作成など、新しい呼び出し通知の処理を示しています。 この例は、アプリケーションがイベント処理のために実装する必要がある switch ステートメントの一部です。 コード自体は、ITTAPIEventNotification::Eventの実装に含まれている場合があります。また、Event メソッドは、スイッチを含むワーカー スレッドにメッセージを投稿できます。
このコード例を使用する前に、TAPIの初期化、アドレスの選択、およびイベントの登録 で操作を実行する必要があります。
また、「ITBasicCallControl の取得と ITAddressインターフェイス ポインターのに従って、ターミナル を選択する」に示されている操作を実行する必要があります。
手記
この例では、実稼働コードに適したエラー チェックとリリースはありません。
// 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.
}
関連トピック