Receiving a Call

[This is preliminary documentation and subject to change.]

// The app must register the ITAddressCallNotification outgoing
// interface. By registering this interface, the app is telling
// the provider that it wants to wait for calls.


// the app waits for calls
// when one comes in…
// we are given the call info interface on notification.
pCallInfo->QueryInterface(IID_ITBasicCallControl,
                          &pCall);

pCallInfo->EnumerateMediaTerminalsInUse(&pEnumMediaTerminals);

while (S_OK == pEnumMediaTerminals->Next(1,
                                         &pMediaTerminal,
                                         NULL)))
{
    // put media terminal in UI or whatever for
    // user
}

if (bOK)
{
// if user is OK with media terminals, simply call
pCall->Answer();
}
else
{
    pCallInfo->get_Address(&pAddress);
    pAddress->EnumerateStaticTerminals(&pEnumTerminal);
    while (S_OK == pEnumTerminal->Next(1,
                                       &pTerminal
                                       NULL)))
    {
        // put terminal in UI or whatever for user
    }
    // let user select media terminals
    pCall->SelectMediaTerminals(pMediaTerminals);

    // release terminals
    pCall->Answer();
}