This tutorial describes how to detect and answer an inbound call with the telephony API for applications.
#include <e32base.h> #include <Etel3rdParty.h> class CClientApp : public CActive { private: CTelephony* iTelephony; CTelephony::TCallId iCallId; public: CClientApp(CTelephony* aTelephony); void SomeFunction(); private: /* These are the pure virtual methods from CActive that MUST be implemented by all active objects */ void RunL(); void DoCancel(); }; CClientApp::CClientApp(CTelephony* aTelephony) : CActive(EPriorityStandard), iTelephony(aTelephony) { //default constructor } void CClientApp::SomeFunction() { iTelephony->AnswerIncomingCall(iStatus, iCallId); SetActive(); } void CClientApp::RunL() { if(iStatus==KErrNone) {} // The call has been answered successfully; // iCallId contains the call's ID, needed when controlling the call. } void CClientApp::DoCancel() { iTelephony->CancelAsync(CTelephony::EAnswerIncomingCallCancel); }
This describes how to answer a second call while another is in progress.
Put the first call on hold.
This is the same as holding a call in Call Hold Tutorial.
If the other call was not dialled or answered by you then you cannot control it, and so you cannot put it on hold. If it is not on hold already (CTelephony::EStatusHold) then you cannot answer the call.
Answer the second call.
This is the same as answering the first call. AnswerIncomingCall() will return a different call ID from the first call.
If the operation fails, remember to resume the original call.
As a result, the first call is on-hold and the second call is active.