Problem with rejecting incoming call with CTelephony

Login to reply to this topic.
Thu, 2008-05-01 14:18
Joined: 2007-08-08
Forum posts: 4

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.
I'm using CTelephony API for observing incoming calls and reject it. I managed to detect incoming call, but while rejecting it I'm facing problem. I have written following code.

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.
I mean execution comtrol does not reaches in EHanging case. I'm not getting where the problem is?

Could anybody tell me what's the problem. Or any other idea for rejecting incoming call?

Thanks
Rahul


Mon, 2008-06-23 14:21
Joined: 2008-06-23
Forum posts: 62
Re: Problem with rejecting incoming call with CTelephony

Hi,

You should call SetActive() after both AnswerIncomingCall() and Hangup(), otherwise you will get a stray signal panic.

Br

  • Login to reply to this topic.