Problem with rejecting incoming call with CTelephony
| Thu, 2008-05-01 14:18 | |
|
Hi All, I'm developing one application in which I'm monitoring for incoming call and whenever there is incoming call, I want to reject it.
void CCallObserver::RunL()
{
hfxPutLogMessageL(_L8("In RunL()"));
if(iStatus == KErrNone)
{
///Get call status
CTelephony::TCallStatus callStatus = (*iCallStatusPkg)().iStatus;
switch(callStatus)
{
case CTelephony::EStatusRinging:
{
//TBDA:
TBuf8<KMaxLogMessageLength> szLog;
szLog.Copy(_L8("Call detected.."));
hfxPutLogMessageL(szLog);
//Reject call
switch(iState)
{
case EAnswering:
{
hfxPutLogMessageL(_L8("Before answering call.."));
iTelephony->AnswerIncomingCall(iStatus,iCallId);
hfxPutLogMessageL(_L8("After answering call.."));
szLog.Zero();
szLog.Copy(_L8("Call Id:"));
szLog.AppendNum(iCallId);
iState = EHanging;
break;
}
case EHanging:
{
hfxPutLogMessageL(_L8("Before Hanging call.."));
iTelephony->Hangup(iStatus,iCallId);
hfxPutLogMessageL(_L8("After Hanging call.."));
if(iStatus == KErrNone)
{
hfxPutLogMessageL(_L8("Call rejected.."));
}
break;
}
default:
break;
}
break;
}
default:
break;
}
ListenForIncomingCall();
}
}
void CCallObserver::ListenForIncomingCall()
{
iTelephony->NotifyChange(iStatus,CTelephony::EVoiceLineStatusChange, *iCallStatusPkg);
SetActive();
}
Problem in this code is that, when incoming call comes app. is answering it and app. hanging. It does not reject the call. Could anybody tell me what's the problem. Or any other idea for rejecting incoming call? Thanks |
|






Forum posts: 62
Hi,
You should call SetActive() after both AnswerIncomingCall() and Hangup(), otherwise you will get a stray signal panic.
Br