Hi,
Now I try to use two active objects, one for observing incoming calls and other events, and one for answering the incoming call. I have changed the code like below. But when app gets a call, phone reboots. I read lots of threads and some docs, but I couldn't manage it.
Please help me answering calls without exting.
Regards, thanks.
CallObserver.cpp
Code:
void CCallObserver::Start()
{
iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, iLineStatusPckg );
SetActive();
}
void CCallObserver::Stop()
{
Cancel() ;
}
void CCallObserver::RunL()
{
if(iStatus == KErrNone)
{
CTelephony::TCallStatus status = iLineStatus.iStatus;
if(CTelephony::EStatusRinging == status)
{
AnswerCall(}
}
iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, iLineStatusPckg );
SetActive();
}
void CCallObserver::AnswerCall()
{
callAnswer = new (ELeave) CAnswerCall( iTelephony ) ;
callAnswer->AnswerCall() ;
}
AnswerCall.cpp
Code:
#include "AnswerCall.h"
CAnswerCall::CAnswerCall(CTelephony* aTelephony)
: CActive(EPriorityStandard),
iTelephony(aTelephony)
{
//default constructor
}
void CAnswerCall::AnswerCall()
{
iTelephony->AnswerIncomingCall(iStatus, iCallId);
SetActive();
}
void CAnswerCall::RunL()
{
if(iStatus==KErrNone)
{} // The call has been answered successfully;
}
void CAnswerCall::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EAnswerIncomingCallCancel);
}