Problem in CTelephony AnswerIncomingCall in Symbian 9.1

Login to reply to this topic.
Thu, 2007-02-08 16:20
Joined: 2006-12-15
Forum posts: 45
Hi Everyone,

I am able to answer the incoming call in my application but after answering the phone hangs up permanently... even I can't restart or switch off. I need to remove the battery to stop that... no keys were functioning  Angry .

My application works this way...
It stays in background and when a incoming call comes my app comes to front. Then I want to answer the call using green EKeyYes key of my E61 phone. But this way fails.. the call can't be answered. Then I add a menu to my app to answer the call throgh this menu selection. And this way worked ! I can answer the call. But then the phone gets hanged. I can't do anything. My intension was to send the app background when call is answered.

Could anyone plz throw some light... I am got stuck to the problem.  Huh

My RunL is:
Code:
RunL()
    {

    if( iStatus == KErrNone )
       {
       

if( iLineStatus.iStatus == CTelephony::EStatusRinging )
{

iAppUi -> ActivateLocalViewL(KView2Id);


}
else
iAppUi -> ActivateLocalViewL(KView1Id);

       // Request the next notification

iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, iLineStatusPckg );
        SetActive();


   
       }

   
}

and the metho to answer the call :-

Code:
AnswerCall ()
{
//Cancel();

if( iLineStatus.iStatus == CTelephony::EStatusRinging )
{

iAppUi -> ActivateLocalViewL((KViewId));  // activate the 1st view i.e send to background

iTelephony->CancelAsync( CTelephony::EVoiceLineStatusChangeCancel ); // cancel outstanding req



// iAppUi -> ActivateLocalViewL((KViewId));  // activate the 1st view i.e send to background

iTelephony->AnswerIncomingCall( iStatus, iCallId, CTelephony::EVoiceLine );
SetActive(); 


/*  this code didn't work


TRawEvent ev1;
ev1.Set(TRawEvent::EKeyDown, EStdKeyYes);
UserSvr::AddEvent(ev1); // SwEvent
User::After(100000);
TRawEvent ev2;
ev2.Set(TRawEvent::EKeyUp, EStdKeyYes);
UserSvr::AddEvent(ev2); // SwEvent
*/
}
}

Please help....

Thanks in advance,
Tushar

Tushar Bhattacharyya


Sun, 2007-02-25 14:38
Joined: 2006-12-15
Forum posts: 45
Re: Problem in CTelephony AnswerIncomingCall in Symbian 9.1

I have solved the app hang problem ( well, without a single reply from anybody  Undecided ). My app code was requesting two asynchronous methods simultaneously.


Tushar Bhattacharyya

Mon, 2007-03-12 13:33
Joined: 2007-03-12
Forum posts: 8
Re: Problem in CTelephony AnswerIncomingCall in Symbian 9.1
Hi,

I am fetching some problem application foreground when there is an incoming call.

Do you have solved this?
If yes, please post some sample code.
If it is possible please send me a copy to zahangirbd@gmail.com
Mon, 2007-03-12 16:01
Joined: 2006-12-15
Forum posts: 45
Re: Problem in CTelephony AnswerIncomingCall in Symbian 9.1
Hello Zahangir,

Did you mean problem regarding setting app foreground during incoming call ?

In that case use SetOrdinalPosition(). search on this forum and also in the SDK to know how to use it. You can use this method to set ur app on top of everything even the system incoming dialog.

Plz specify ur probelm in more  detail if posible if this is not requirement.

Regards,
tushar

Tushar Bhattacharyya

Tue, 2007-03-13 05:31
Joined: 2007-03-12
Forum posts: 8
Re: Problem in CTelephony AnswerIncomingCall in Symbian 9.1
Hi Tushar,

According to some solutions about it, I have understood that three main things are important those are.
1. CActive with 'EPriorityHigh' for incoming call listener
2. Application's thread with 'EPriorityAbsoluteHigh'
3. BringForeGround using TApaTask

I have tried this within the following code. But Still native caller screen seen. MyTest1 application comes foregroundand then goes background and then native caller screen comes foreground.

I am sure that definitely some mistakes are here. Please clear it.

My development Points are:
0. SDK: S60 3rd edition and CTelephony API
1. My application name is : MyTest1
2. I have created a call manager for income call listenter with CActive( EPriorityHigh ). CallManager class is like this:
----------------------------------------------------------------
class CCallManager : public CActive
{
public:
    static CCallManager* NewL(CTelephony* aTelephony, CInCallListener & aInCallListener);
    void Start();
    void Stop();
public:
    virtual ~CCallManager();
private:
    CCallManager(CTelephony* aTelephony, CInCallListener & aInCallListener);
    void ConstructL();
private:
    void RequestNotification();
protected:
    virtual void RunL(); // Inherited from CActive
    virtual void DoCancel();
private:
    CTelephony* iTelephony;
    CInCallListener & iInCallListener;
    CTelephony::TCallStatusV1 iLineStatus;
   CTelephony::TCallStatusV1Pckg iLineStatusPckg;
};

//Start of CallManager.cpp file
CCallManager* CCallManager::NewL(CTelephony* aTelephony, CInCallListener & aInCallListener)
{
  CCallManager * self = new (ELeave) CCallManager(aTelephony, aInCallListener);
  CleanupStack::PushL(self);
  self->ConstructL();
  CleanupStack::Pop(self);
  return self;
}

void CCallManager::Start()
{
  Cancel();
  RequestNotification();
}
void CCallManager::Stop()
{
  Cancel();
}
CCallManager::CCallManager(CTelephony* aTelephony, CInCallListener & aInCallListener)
: CActive( EPriorityHigh ),
iTelephony(aTelephony),
iInCallListener(aInCallListener),
iLineStatusPckg( iLineStatus )
{
  iLineStatus.iStatus = CTelephony::EStatusUnknown;
  CActiveScheduler::Add(this);
}
CCallManager::~CCallManager()
{
  Cancel();
}
void CCallManager::ConstructL()
{
}
void CCallManager::RequestNotification()
{
  if(IsActive())
  {
    return;
  }
  if(iTelephony)
  {
    iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange,
iLineStatusPckg );
    SetActive();
  }
}
void CCallManager::RunL()
{
  if( iStatus==KErrNone )
  {
    if( iLineStatus.iStatus == CTelephony::EStatusRinging )
    {
    // Answer call by calling 'AnswerIncomingCall()'
     iInCallListener.NewInCallArrived();
    }
  }
}
void CCallManager::DoCancel()
{
  if(iTelephony)
  {
    iTelephony->CancelAsync( CTelephony::EVoiceLineStatusChangeCancel );
  }
}
//end of CallManager.cpp file
3. Application's priority setting is:
//SetPriority Code
void CMyTest1AppUi::SetPriority()
{
#if !defined(__WINS__) //FIXFIXME
    CEikonEnv::Static()->WsSession().ComputeMode(RWsSession::EPriorityControlDisabled);
  RThread T;
  TFindThread fr(_L("MyTest1*"));
  TFullName fn;
  if (fr.Next(fn) == KErrNone) //for thread
  {
    if (T.Open(fn) == KErrNone)
    {
     T.SetPriority(EPriorityAbsoluteHigh);
     T.Close();
    }
  }
#endif
}
// end of SetPriority Code

4. BringForeGround code
//BringForeGround
void CMyTest1AppUi::BringForeGroundL()
{
// Construct en empty TApaTask object
// giving it a reference to the Window Server session
  TApaTask task(iEikonEnv->WsSession( ));

// Initialise the object with the window group id of
// our application (so that it represent our app)
  task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());

// Request window server to bring our application
// to foreground
  task.BringToForeground();
}
//end of BringForeground

5. on incoming call notification from CallManager
//Code
void CMyTest1AppUi::NewInCallArrived()
{
  BringForeGroundL();
  ShowGlobalConfQueryL();
}
//end code

-------------------------------------------------
Could you verify it?

Regards,
Zahangir

Tue, 2007-03-13 07:23
Joined: 2006-12-15
Forum posts: 45
Re: Problem in CTelephony AnswerIncomingCall in Symbian 9.1
Hello Zahangir,

try this code in side your BringForeGroundL() instead of TApaTask.

Code:

RWindowGroup iMyWindowGroup2 = iCoeEnv->RootWin();
iMyWindowGroup2.SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);




and let me know whether it worked.

Regards,
Tushar

Tushar Bhattacharyya

Tue, 2007-03-20 12:26
Joined: 2007-03-12
Forum posts: 8
Re: Problem in CTelephony AnswerIncomingCall in Symbian 9.1
Hi Tushar,

I have done it but still some times it works fine but some times it does not work, it goes to background Telephone app comes foregorund. I am working in Symbain 9.1 and using CTelephony API. What I have done that are as follows

1.  My Incoming call notifier is an CActive Object. And set it EPriorityHigh
2. SetProcessPriority as high from ConstructL of AppUi
3. SetThreadPriority as high from ConstructL of AppUi
4. Bring to foreground using SetOrdinalPosition on Incoming call

Is there any trick is missing.....

If any idea the please share it.







Tue, 2007-03-20 15:53
Joined: 2006-12-15
Forum posts: 45
Re: Problem in CTelephony AnswerIncomingCall in Symbian 9.1
Hello zahangir,

If your code design is ok, there should not be any problem. It will be more convenient if you post some of your code sniffet here.

By the way, how many views are there in your code? and the important thing is that the SetOrdinalPosition will be used in anywhere  successfully if used in proper way.

If possible post the ur view::ConstructL(), DoActivateL() and container::ConstructL() and phone::RunL() part to better recognise the problem.


Regards,
Tushar



Tushar Bhattacharyya

  • Login to reply to this topic.