I want to reject a call fastlyyyyyyyyyyy
Login to reply to this topic.
Sat, 2006-06-03 23:21
Joined: 2006-03-20
Forum posts: 24
Hi all...

I'm facing a biggggggggggg problem... I need to reject a call before it starts to ring in the callers side (to give him the illusion that the other side is busy)... This means that i should fastlyyyyyyyyy reject a call... My problem is that is rings one time before it rejects the call and i don't know whyyyyyy  Sad   Pleaaaaaaaaaaase help me to find a solution for this... my code is as follows
Code:
#include <eikenv.h>
#include <etelmm.h>
#include <AknNoteWrappers.h>

#include "BSMCallHandler.h"

CBSMCallHandler::CBSMCallHandler(MBSMCallHandler& aListener)
: CActive(EPriorityRealTime), iListener(aListener)
{
CActiveScheduler::Add(this);
}

CBSMCallHandler* CBSMCallHandler::NewL(MBSMCallHandler& aListener)
{
CBSMCallHandler* self = new (ELeave) CBSMCallHandler(aListener);

CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(); // self

return self;
}

void CBSMCallHandler::ConstructL()
{
User::LeaveIfError(iTelServer.Connect());
RTelServer::TPhoneInfo phoneInfo;
User::LeaveIfError(iTelServer.GetPhoneInfo(0, phoneInfo));
User::LeaveIfError(iPhone.Open(iTelServer, phoneInfo.iName));
RPhone::TLineInfo lineInfo;
User::LeaveIfError(iPhone.GetLineInfo(0, lineInfo));
User::LeaveIfError(iLine.Open(iPhone, lineInfo.iName));
}

CBSMCallHandler::~CBSMCallHandler()
{
Cancel();

iLine.Close();
iPhone.Close();
iTelServer.Close();
}

void CBSMCallHandler::StartListening()
{
  iLine.NotifyIncomingCall(iStatus, iCallName);
  SetActive();
}

//***************************** RunL()********************************//
void CBSMCallHandler::RunL()
{

RCall::TStatus iCallStatus;
User::LeaveIfError(iStatus.Int());
iListener.IncomingCall(iCallName);

//-----------------------------------------------
   iLine.GetStatus(iCallStatus);

      switch(iCallStatus)
      {
         case RCall::EStatusUnknown:
         break;

         case RCall::EStatusIdle:
        break;

         case RCall::EStatusDialling:
         break;

         case RCall::EStatusRinging:
User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));
iCall.HangUp();
iCall.Close();
         break;

         case RCall::EStatusAnswering:
         break;

         case RCall::EStatusConnecting:
User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));
    iCall.HangUp();
iCall.Close();
         break;

         case RCall::EStatusConnected:
User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));
    iCall.HangUp();
iCall.Close();
         break;

         case RCall::EStatusHangingUp:
         break;

      }
      SetActive();

//------------------------------------------------


}

TInt CBSMCallHandler::RunError(TInt /*aError*/)
{
return KErrNone;
}

void CBSMCallHandler::DoCancel()
{
iLine.NotifyIncomingCallCancel();
}


Thanks in advance

Making a living is not the same thing as making a life


Mon, 2006-06-05 14:35
Joined: 2005-08-24
Forum posts: 33
Hi Sarah,

Firstly, tell me logically how is it possible to reject a call before it has arrived?? For detecting an incoming call, u have 2 deal with 2 states,
1) Waiting state, where ur RLine instance notifies that an incoming call is detected which changes the state to Ringing

2) Ringing state, where the device is actually ringing & the user is in a position to accept or reject the call

Now, u have to first decide what exactly u want to do after these 2 states happen

Well as far as rejecting the call is concerned, the code that u have written below
Quote
case RCall::EStatusRinging:
         User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));
   iCall.HangUp();
         iCall.Close();
itself is the solution to your question what u say that its rings once before it gets rejected or hunged up

Since u r calling the function OpenExisitingCall, it accepts the call n then immediately rejects it which is why u are facing the problem

I will advice you to first go thru the CTelephony API in the SDK to study the process which is happening when an incoming call arrives


Regards,

Yogesh
Tue, 2006-06-06 00:20
Joined: 2006-03-20
Forum posts: 24
My problem is that I'm so confused regarding what happens when a call come... And i can't find enough tutorials or documents that can help me in understanding this....

So... What I understood is that i should implement my code in the waiting state and ringing state?... How can i know exactly that I'm in a waiting state?

Actually in my code when i get a call i should first know the phone number of the caller and then do some checking which I managed to make .. So I'm not gonna reject the call immediatly when it comes... shouldn't I open the call before rejecting it? because if I didn't my application crashes Sad

Also... I don't understand what do u mean by saying that I rejected the call before it arrived" ?

Can I hope with more clarification?  Sad

I'm so confused towards this... and I know I'm asking very silly questions...so pardon me Sad

Making a living is not the same thing as making a life

Tue, 2006-06-06 10:53
Joined: 2005-08-24
Forum posts: 33
Hi Sarah,

It was upon the question that u asked,
Quote
I need to reject a call before it starts to ring in the callers side

Hence i asked u how is it possible to reject a call before it arrives or for that matter before it rings??? It just cant be possible

So if u want to reject a call then u need to anyhow first answer it, i mean, call the OpenExistingCall() function & then use the function to hang OR reject the call...

Make proper use of asynchronous process to differentiate betwn the two

Also try downloading the Series 60 examples of EMCCSoft  which has an example dealing with answering of calls... try that out n it shld help u in solving all ur doubts...

All the Best...

Yogesh Smiley
Tue, 2006-06-06 17:34
Joined: 2006-03-20
Forum posts: 24
Thanks for replying...

I heard about applications that listens to a call and when it comes it gives the user the choice to either accept or reject this call... So, what I meant is that I want to wait until the call is connected but i want to disable the ringing until I make a decision about this call... can't this be realized?  Huh

Making a living is not the same thing as making a life

Wed, 2006-06-07 08:15
Joined: 2005-02-12
Forum posts: 98
You need to just simulate left soft key (for silent option)and pass it to telephone application.

This is the way Most video Tone Application uses as myself application too  Smiley
Wed, 2006-06-07 22:34
Joined: 2006-03-20
Forum posts: 24
Yes but simulating the left key makes it silent to the callee not to the caller... My point is that I want the caller to feel that the other side is busy with another call , I don't want him to recognize that he was rejected...

                                                                      Sarah

Making a living is not the same thing as making a life

Thu, 2006-06-08 03:30
Joined: 2006-04-17
Forum posts: 78
Hello Sarah
I am playing a bit with audio streaming nowadays..

It seems you have changed your code to AO - nice.
My code is similar to your one, infact it is doing a bit more logging, callabacks etc. I have tried my code on Nokia 6600 and MOSTLY I dont hear any ring when call is rejected on other side.
I have looked into Symbian API deeply, I couldnt find any thing that we can do underneeth.
In BTW i have tested my code on N 6630 (what you have got) and it behaves same (sometimes I hear half ring..)

I shall let you know by Message, if i found some content.
In BTW, is that always you are hearing 2 or 1 ring ...

Kind Regards
Faiq
Thu, 2006-06-08 03:38
Joined: 2006-04-17
Forum posts: 78
I suspect this undeterministic behaviour is because of scheduling, what if we do our AO to higher prioirty.. ..
Lets try out this
Thu, 2006-06-08 18:05
Joined: 2006-03-20
Forum posts: 24
Hi Faiq...

It gives me a half ring or no ring (busy signal at once) when my application is in Foreground....  But it gives my ONE COMPLETE ring when the application is working on the background...  Huh

I tried to increase the priority of my active object but still no change (I changed it to EPriorityHigh and EPriorityRealTime but no change)...  Huh

So, I wonder what could be the problem of putting the application in to background....  Undecided

Thanks

Making a living is not the same thing as making a life

Fri, 2006-06-09 01:09
Joined: 2006-04-17
Forum posts: 78
Hello Sarah..

Yes it didnt help ..
But i think this is the way we can do, there is some trick out here..

As you have said
"when my application goes in background I hear one COMPLETE  Smiley ring"
it means there is something about priorities.. As you know when application goes background its priority is switched in lower, and the Forground app is given higher..
I am not sure which way should we go

Kind regards
Faiq

Fri, 2006-06-09 11:43
Joined: 2006-03-20
Forum posts: 24
Hi....

I guess it is a problem in the background mode related to priority as u said... because when my application is in foreground mode, when i press the menu button for a reasonably long period it shows me the running applications mine first and then the telephone.... but when I do that when the application is in the background mode, the order is reversed (The telephone first then my application)... which means that the priority decreases.....

About how to solve this.... This is the code I use to go to background mode:
Code:
    TApaTask task(iEikonEnv->WsSession());
    task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
    task.SendToBackground();

I'm thinking of using a taskList... I saw a method encapsulated in it called CycleTasks... and I wonder, will it help? I don't understand exactly what it can do because I'm trying to do it and the compiler keeps on giving me the error: EForwards undeclared, first use of this function.. that's when i tried to add the following code to try it:

Code:
    TApaTask currentTask = taskList.FindByPos(0);
    const TUid KUidBSM = { 0x08E79C14 };
    //TApaTask ourAppTask = taskList.FindApp(KUidBSM);
    taskList.CycleTasks(currentTask.ThreadId(), EForwards);

Making a living is not the same thing as making a life

Tue, 2006-06-13 07:39
Joined: 2006-04-17
Forum posts: 78
Hello ...

I have found EForwards, its in class CEikServAppUiBase
- enum TTaskCycleDirection { EBackwards, EForwards };
So you need to code CEikServAppUiBase::EForwards

Well .. our app is stacked after Phone app becasue the main screen is the Phone app. So if we are on Main Screen the Phone app is in foreround actualy.
The stack (of opened apps) does not reflect priority in real sense, you can verify this by opening your app and some other app. In some case your app would be over Phone...
I hope you got my point..

But there is something about priorities indeed - still working on that  Grin

Kind Regards
Muhammed Faiq
Tue, 2006-06-13 07:45
Joined: 2006-04-17
Forum posts: 78

I put my apps Process, Thread, and AOs on high priority but still I hear half or full ring sometimes.
However by doing this probablty of hearing any ring, while other side rejects, decreased.
This was todays news  Roll Eyes
Tue, 2006-06-13 08:58
Joined: 2005-02-12
Forum posts: 98
Try to use also following code....
I used it in my videotone application...to get my application to foreground

void CTestPlayerAppUi::MakeHigherPriority()
{
      RWindowGroup *pWG = &CCoeEnv::Static()->RootWin();
      pWG->SetOrdinalPosition(0, 2000);
      MuteCallL();         
}

and also following functions as well (called in CTestPlayerAppUi::ConstrutL())

void CTestPlayerAppUi::SetProcessPriority()
{
    #if !defined(__WINS__) //FIXFIXME
    CEikonEnv::Static()->WsSession().ComputeMode(RWsSession::EPriorityControlDisabled);
    RProcess P;
    TFindProcess fp(_L("testplayer"));
    TFullName fn;
    if (fp.Next(fn)==KErrNone)
    {
        if (P.Open(fn) == KErrNone)
        {
            P.SetPriority(EPriorityHigh);
            P.Close();
        }
    }
    #endif
}


void CTestPlayerAppUi::SetThreadPriority()
{
    #if !defined(__WINS__) //FIXFIXME
    //CEikonEnv::Static()->WsSession().ComputeMode(RWsSession::EPriorityControlDisabled);
    RThread T;
    TFindThread ft(_L("testplayer"));
    TFullName fn;
    if (ft.Next(fn)==KErrNone)
    {
        if (T.Open(fn) == KErrNone)
        {
            T.SetPriority(EPriorityAbsoluteHigh);
            T.Close();
        }
    }
    #endif
}
Tue, 2006-06-13 11:23
Joined: 2006-03-20
Forum posts: 24
Thank you soooooooooooo much... it sounds to be workiiiiiiiiiiiiiinnnnnnnnnnnngggggggggg....

Thank you so much vikas_bansal, Faiq and yogesg  Smiley

                                                                      Sarah

Making a living is not the same thing as making a life


copyright 2003-2009 NewLC SARL