Discussion Board

Results 1 to 13 of 13
  1. #1
    Regular Contributor elviin's Avatar
    Join Date
    Jul 2008
    Posts
    416
    Hello Symbian developers,

    I would like to implement a feature which is capable to block an incoming call if a telephone number is specified. No sound or visual notification, just logged in the "received calls" log. Is there any general way (api) how to manage this task? The application should be a sort of a firewall - capable to filter outgoing and incoming calls.

    Thank you for a hint or clue where to begin.

  2. #2
    Nokia Developer Champion kkrish's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,029
    Quote Originally Posted by elviin View Post
    Hello,

    I would like to implement a feature which is capable to block an incoming call if a telephone number is specified. No sound or visual notification, just logged in the "received calls" log. Is there any general way (api) how to manage this task?
    Hi,

    I think it will not be easy to do but not impossible I have seen lots of applaction that do the same. For call handling you can use CTelephony. For removing call logs you can use CLogClient. I thing notification will not be come if call get disconnected as soon as it comes over phone.

  3. #3
    Registered User yogpan's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043
    Hi,
    You can have a incoming call listener application running in the background and whenever you receive a call it can compare the caller with the blocked number list and reject the call programmatically.
    You can start with this example of call listener
    http://wiki.forum.nokia.com/index.php/Call_Handling
    Maximus
    S60 Developer
    Impossible is nothing

  4. #4
    Regular Contributor elviin's Avatar
    Join Date
    Jul 2008
    Posts
    416
    Thank you yogpan.

    Is the task feasible with CTelephony? I have done an application using CTelephony with 9.1 SDK, but my testing device n95 8gb said that the application is not compatible during the installation process.

    There are four API's:

    3rd Party Telephony API (ETEL3RDPARTY,CTelephony)
    Telephony Multimode API
    ETEL CORE API
    Phone Client Extension API

    The example provided by yogpan are based on ETEL, which according to the S60 9.2 documentation is deprecated

    So using ETEL3RDPARTY should be the right way for S60 9.1> platforms. Is it possible to mute the call and disable the visual notification?

    This example
    says that one should use:
    Phone Client Extension API and 3rd party Telephony API (CTelephony) when using S60 3rd Edition, FP1. Is there any working example?

    Thank you.

  5. #5
    Registered User yogpan's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043
    Hi,
    The problem in CTelephony is that you cannot hangup the call without answering ie. you cannot reject an incoming call. RCall is available with that option and yes you can use it for your device.I have tested the RCall method in N95 and it works fine.I think this is the only way as of now to reject an incoming call wihtout answering it.
    Maximus
    S60 Developer
    Impossible is nothing

  6. #6
    Regular Contributor elviin's Avatar
    Join Date
    Jul 2008
    Posts
    416
    Thank you Yogpan.
    Please can you leave a pointer here how I can cancel unanswered call? I'm still facing the problem that I can receive a call but I'm not able to cancel it:


    in StartL():
    Code:
    iLine.NotifyIncomingCall(iStatus, iCallName) ;
    in RunL():
    Code:
    iSilentCallObserver.HandleCSilentCallChangedL(EAnswering);
    User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));
    //iCall.AnswerIncomingCall(iStatus); //I do not want this, just cancel            
    iCall.HangUp(iStatus); //does not work
    iCall.Close();
    Thank you very much.

  7. #7
    Regular Contributor mrudulpen's Avatar
    Join Date
    Feb 2007
    Location
    Tampere
    Posts
    368
    Hi,

    I think before the call to Hangup() you should call AnswerIncomingCall() to take ownership of the call, atleast thats what API suggests, that it can hangup only three types of calls.
    Regards

    - MVP
    "Dare To Dream" - A.P.J.Kalam

  8. #8
    Regular Contributor elviin's Avatar
    Join Date
    Jul 2008
    Posts
    416
    I'm using asynchronous methods and I think it's quite straightforward solution, but still it does not cancel any call

    Code:
    void CCancelIncomingCall::StartL()
    {
        Cancel(); // Cancel any request, just to be sure
        iLine.NotifyIncomingCall(iStatus, iCallName);
        
        SetActive(); // Tell scheduler a request is active
    }
    Code:
    void CCancelIncomingCall::RunL()
    {
        CAknInformationNote* note = new(ELeave) CAknInformationNote;
        TInt err = 0;
        TRAP(err, note->ExecuteLD(_L("CCancelIncomingCall::RunL()")));
        
        iLine.GetStatus(iCallStatus);
        
        if(iStatus == KErrNone)
        {
        
            switch (iCallStatus)
            {
            case  RCall::EStatusUnknown:
                {
                    TRAP(err, note->ExecuteLD(_L("RCall::EStatusUnknown")));
                    break;
                }
          
            case  RCall::EStatusIdle:
                {
                    iCall.NotifyStatusChangeCancel();
                    iCall.Close();
                    TRAP(err, note->ExecuteLD(_L("RCall::EStatusIdle")));        
                    break;
                }
          
            case  RCall::EStatusDialling:
                {
                    TRAP(err, note->ExecuteLD(_L("RCall::EStatusDialling")));        
                    break;
                }
          
            case  RCall::EStatusRinging:
                {
                    User::LeaveIfError(iCall.OpenExistingCall(iLine, iCallName));         
                    iCall.AnswerIncomingCall(iStatus);
                    TRAP(err, note->ExecuteLD(_L("RCall::EStatusRinging")));
                    SetActive();
                    break;
                }
          
            case  RCall::EStatusAnswering:
                {
                    iCall.HangUp(iStatus);
                    TRAP(err, note->ExecuteLD(_L("RCall::EStatusAnswering")));
                    SetActive();
                    break;
                }
          
            case  RCall::EStatusConnecting:
                {       
                    TRAP(err, note->ExecuteLD(_L("RCall::EStatusConnecting")));
                    break;
                }
          
            case  RCall::EStatusConnected:
                {
                    TRAP(err, note->ExecuteLD(_L("RCall::EStatusConnected")));
                    break;
                }
          
            case  RCall::EStatusHangingUp:
                {
                    iCall.NotifyStatusChangeCancel();
                    iCall.Close();
                    TRAP(err, note->ExecuteLD(_L("RCall::EStatusHangingUp")));
                    break;
                }
            
            default:
                {
                    __ASSERT_DEBUG(0, User::Panic(_L("CancelIncomingCall::RunL(): Undefined iCallStatus."),iCallStatus));
                    break;
                };
            };
        };
    }
    Code:
    void CCancelIncomingCall::ConstructL()
    {
        CActiveScheduler::Add( this); // Add to scheduler
        _LIT(KTSY,"phonetsy");
        User::LeaveIfError(iTelServer.Connect());
         
           // load the appropriate tsy
        User::LeaveIfError(iTelServer.LoadPhoneModule(KTSY));
         
        TInt numberPhones = 1;
        if (!numberPhones)
        {
            User::Leave(KErrNotFound);
        }
         
        // use the 1st available phone
         
        RTelServer::TPhoneInfo phoneInfo; 
        User::LeaveIfError(iTelServer.GetPhoneInfo(0, phoneInfo));
        User::LeaveIfError(iPhone.Open(iTelServer, phoneInfo.iName));
        TInt numberLines = 0;
        User::LeaveIfError(iPhone.EnumerateLines(numberLines));
        RPhone::TLineInfo lineInfo;
        TBool foundLine = EFalse;
         
         
         
        for (TInt a = 0; a < numberLines; a++)
        { 
           User::LeaveIfError(iPhone.GetLineInfo(a, lineInfo));
           if (lineInfo.iLineCapsFlags & RLine::KCapsVoice)
           {
              foundLine = ETrue;
              break;
           }
        }
        if (!foundLine)
        {
            User::Leave(KErrNotFound);
        }
         
        User::LeaveIfError(iLine.Open(iPhone, lineInfo.iName));
    }

  9. #9
    Regular Contributor elviin's Avatar
    Join Date
    Jul 2008
    Posts
    416
    Is ETEL working on N95 8gb? I'm stuck with state RCall::EStatusIdle.

    From AppUi there is LineManager instance calling StartL(). The LineManager initializes iLine and creates a new instance of CallManager if there is a new call on
    Code:
    iLine.NotifyIncomingCall(iStatus, iCallName);
    In the CallManager::StartL() CallManager calls
    Code:
     
        iCall.OpenExistingCall(iLineManager.GetLine(), iLineManager.GetCallName());
        iCall.NotifyStatusChange(iStatus, iCallStatus);
    ... and the CallManager::RunL method is waiting for a new event. Every time I get RCall::EStatusIdle The phone is ringing but there is no status RCall::EStatusRinging.

    Log file:
    Code:
    26.11.2008	09:19:54	CSilentCall2AppUi::ConstructL
    26.11.2008	09:19:54	CLineManager::ConstructL()
    26.11.2008	09:19:56	CLineManager::StartL()
    26.11.2008	09:20:19	CLineManager::RunL()
    26.11.2008	09:20:20	CCallManager::ConstructL
    26.11.2008	09:20:20	CCallManager::StartL
    26.11.2008	09:20:27	CCallManager::RunL
    26.11.2008	09:20:27	RCall::EStatusIdle
    26.11.2008	09:20:27	CCallManager::RunL
    26.11.2008	09:20:27	RCall::EStatusIdle
    Code:
    void CLineManager::StartL()
    {
        _LIT(KLogMessage,"CLineManager::StartL()");
        iFileLogger.WriteFormat(KLogMessage);   
        
        Cancel(); // Cancel any request, just to be sure
        iLine.NotifyIncomingCall(iStatus, iCallName);
        SetActive(); // Tell scheduler a request is active
    }
    
    void CLineManager::RunL()
    {
        _LIT(KLogMessage,"CLineManager::RunL()");
        iFileLogger.WriteFormat(KLogMessage);   
    
        if(iStatus == KErrNone)
        {
            CCallManager* newCallManager = CCallManager::NewLC(*this, iFileLogger); 
            iCallManagerArray.AppendL(newCallManager);
            newCallManager->StartL();
            CleanupStack::Pop(newCallManager);
        }
        else
        {
            SetActive(); // Tell scheduler a request is active    
        }
        
    }
    Code:
    void CCallManager::StartL()
    {
        _LIT(KLogMessage,"CCallManager::StartL");
        iFileLogger.WriteFormat(KLogMessage);
        
        Cancel(); // Cancel any request, just to be sure
        iCall.OpenExistingCall(iLineManager.GetLine(), iLineManager.GetCallName());
        iCall.NotifyStatusChange(iStatus, iCallStatus);    
        SetActive(); // Tell scheduler a request is active
    }
    
    void CCallManager::RunL()
    {
        _LIT(KLogMessage,"CCallManager::RunL");
        iFileLogger.WriteFormat(KLogMessage);
    
        
        iLineManager.GetLine().GetStatus(iCallStatus);
        
        if(iStatus == KErrNone)
        {
        
            switch (iCallStatus)
            {
            case  RCall::EStatusUnknown:
                {
                    _LIT(KLogMessage,"RCall::EStatusUnknown");
                    iFileLogger.WriteFormat(KLogMessage);    
                    iCall.NotifyStatusChange(iStatus, iCallStatus);
                    SetActive();
                    break;
                }
          
            case  RCall::EStatusIdle:
                {
                    ////iCall.NotifyStatusChangeCancel();
                    //iCall.Close();
                    _LIT(KLogMessage,"RCall::EStatusIdle");
                    iFileLogger.WriteFormat(KLogMessage);    
                    iCall.NotifyStatusChange(iStatus, iCallStatus);
                    SetActive();
                    break;
                }
          
            case  RCall::EStatusDialling:
                {
                    _LIT(KLogMessage,"RCall::EStatusDialling");
                    iFileLogger.WriteFormat(KLogMessage);    
                    iCall.NotifyStatusChange(iStatus, iCallStatus);        
                    SetActive();
                    break;
                }
          
            case  RCall::EStatusRinging:
                {
                    //User::LeaveIfError(iCall.OpenExistingCall(iLineManager.GetLine(), iLineManager.GetCallName()));         
                    //iCall.AnswerIncomingCall(iStatus);
                    //iCall.HangUp();
                    //iCall.Close();
                    _LIT(KLogMessage,"RCall::EStatusRinging");
                    iFileLogger.WriteFormat(KLogMessage);    
                    iCall.NotifyStatusChange(iStatus, iCallStatus);
                    SetActive();
                    break;
                } 
    <...>
    Why there is still status RCall::EStatusIdle when the phone is ringing?

  10. #10
    Nokia Developer Champion kkrish's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,029
    Hi,

    Check if any capability required then add it into your mmp.

  11. #11
    Regular Contributor elviin's Avatar
    Join Date
    Jul 2008
    Posts
    416
    Quote Originally Posted by kkrish View Post
    Hi,

    Check if any capability required then add it into your mmp.
    I used the capability scanner. I think I have enough capabilities registered:

    Code:
    Platform Security Scan Results
    
    * These capabilities were detected in your source code: 
     DEPENDENT**
    
    * These capabilities are defined in your project settings: 
     LocalServices WriteUserData WriteDeviceData ReadDeviceData ReadUserData NetworkServices SwEvent NetworkControl
    
    * You may need to add these capabilites to your project settings:
     DEPENDENT

  12. #12
    Regular Contributor elviin's Avatar
    Join Date
    Jul 2008
    Posts
    416
    Quote Originally Posted by yogpan View Post
    Hi,
    The problem in CTelephony is that you cannot hangup the call without answering ie. you cannot reject an incoming call. RCall is available with that option and yes you can use it for your device.I have tested the RCall method in N95 and it works fine.I think this is the only way as of now to reject an incoming call wihtout answering it.
    Hello Yogpan, you wrote the RCall is working on N95. Did you manage to catch the RCall::EStatusRinging event?

  13. #13
    Nokia Developer Champion kkrish's Avatar
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,029
    Hi,

    Just check with delay, like User:After(2000000) before this iLineManager.GetLine().GetStatus(iCallStatus); line.

    and might be the link will helpful to you.

Similar Threads

  1. Replies: 7
    Last Post: 2011-06-02, 11:35
  2. handling key events during incoming call
    By pronvit in forum Symbian C++
    Replies: 4
    Last Post: 2008-07-10, 23:13
  3. N73: Game music remains during incoming call recived
    By zappu in forum Mobile Java Games
    Replies: 0
    Last Post: 2008-06-24, 07:37
  4. Replies: 1
    Last Post: 2007-03-02, 20:26
  5. Missed call and incoming message indicator
    By saviourcat in forum Symbian C++
    Replies: 0
    Last Post: 2006-07-05, 10:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved