satengine/SatServer/Commands/SetUpCallCmd/src/CSetUpCallHandler.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     1 /*
     1 /*
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Handles SetUpCall command
    14 * Description:  Handles SetUpCall command
    15 *
    15 *
    16 */
    16 */
    17 #include    <e32base.h>
    17 
    18 #include    <etelmm.h>
    18 
       
    19 #include    <aiwinternaldialdata.h>
       
    20 #include    <aiwdialdataext.h>
       
    21 
    19 #include    <exterror.h>
    22 #include    <exterror.h>
       
    23 #include    <ccpdefs.h>
    20 
    24 
    21 #include    "MSatApi.h"
    25 #include    "MSatApi.h"
    22 #include    "MSatUtils.h"
    26 #include    "MSatUtils.h"
    23 #include    "MSatSystemState.h"
    27 #include    "MSatSystemState.h"
    24 #include    "MSatUiSession.h"
    28 #include    "MSatUiSession.h"
    25 #include    "SatSOpcodes.h"
    29 #include    "SatSOpcodes.h"
    26 #include    "MSatSUiClientHandler.h"
    30 #include    "MSatSUiClientHandler.h"
    27 #include    "csetupcallrequesthandler.h"
       
    28 #include    "CSetUpCallHandler.h"
    31 #include    "CSetUpCallHandler.h"
    29 #include    "TSatExtErrorUtils.h"
    32 #include    "TSatExtErrorUtils.h"
    30 #include    "SatLog.h"
    33 #include    "SatLog.h"
    31 
    34 
    32 const TUint8 KBCDAsterisk( 0x0A );
    35 const TUint8 KBCDAsterisk( 0x0A );
    39 const TUint8 KDashChar( 0x23 );
    42 const TUint8 KDashChar( 0x23 );
    40 const TUint8 KDTMFChar( 0x70 );
    43 const TUint8 KDTMFChar( 0x70 );
    41 const TUint8 KWildChar( 0x77 );
    44 const TUint8 KWildChar( 0x77 );
    42 const TUint8 KExpansionChar( 0x2E );
    45 const TUint8 KExpansionChar( 0x2E );
    43 
    46 
    44 /** Maximum name length. */ 
       
    45 const TInt KSatMaximumNameLength = 50;
       
    46 
       
    47 /** Maximum phone number length same as  used by phone. */ 
       
    48 const TInt KSatMaximumPhoneNumberLength = 100;
       
    49 
       
    50 /** The subaddress length, see ITU-T I.330 and 3GPP TS 11.14. */ 
       
    51 const TInt KSatSubAddressLength = 21;
       
    52 
       
    53 /** The maximum bearer length. The bearer capabilities as 
       
    54 defined in GSM 04.08. */ 
       
    55 const TInt KSatBearerLength = 14;
       
    56 
       
    57 
       
    58 _LIT( KFixedSimEmergencyNumber, "112" );
    47 _LIT( KFixedSimEmergencyNumber, "112" );
       
    48 _LIT8( KContentType, "*" );
       
    49 // 3GPP TS 24.008
       
    50 const TInt KMaximumPhoneNumberLength( 80 );
    59 
    51 
    60 // ======== MEMBER FUNCTIONS ========
    52 // ======== MEMBER FUNCTIONS ========
    61 
    53 
    62 // -----------------------------------------------------------------------------
    54 // -----------------------------------------------------------------------------
    63 // Two-phased constructor.
    55 // Two-phased constructor.
    85 CSetUpCallHandler::~CSetUpCallHandler()
    77 CSetUpCallHandler::~CSetUpCallHandler()
    86     {
    78     {
    87     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::~CSetUpCallHandler calling" )
    79     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::~CSetUpCallHandler calling" )
    88 
    80 
    89     Cancel();
    81     Cancel();
    90     
    82 
    91     delete iRequestHandler;
    83     if ( iServiceHandler )
    92     iRequestHandler = NULL;
    84         {
       
    85         delete iServiceHandler;
       
    86         iServiceHandler = NULL;
       
    87         }
       
    88 
       
    89     if ( iEmergencyCallApi )
       
    90         {
       
    91         delete iEmergencyCallApi;
       
    92         iEmergencyCallApi = NULL;
       
    93         }
    93 
    94 
    94     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::~CSetUpCallHandler exiting" )
    95     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::~CSetUpCallHandler exiting" )
    95     }
    96     }
    96 
    97 
    97 // -----------------------------------------------------------------------------
    98 // -----------------------------------------------------------------------------
   142     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ClientResponse calling" )
   143     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ClientResponse calling" )
   143 
   144 
   144     if ( iQueryRsp.iAccepted )
   145     if ( iQueryRsp.iAccepted )
   145         {
   146         {
   146         // User accepted the call, make the call
   147         // User accepted the call, make the call
   147         if( iRequestHandler )
   148         TRAPD( error, DoSetupCallL() );
   148             {
   149 
   149             DoSetupCall( *iRequestHandler );
   150         if ( KErrNone != error )
   150             }
   151             {
   151         else
   152             LOG2( NORMAL, 
   152             {
   153             "SETUPCALL: CSetUpCallHandler::ClientResponse Dial failed: %i", 
   153             CompleteSetupCall(
   154             error )
   154                 RSat::KMeUnableToProcessCmd,
   155 
   155                 RSat::KNoSpecificMeProblem );
   156             CompleteSetupCall( RSat::KCmdDataNotUnderstood );
   156             }
   157             }
   157         }
   158         }
   158     else
   159     else
   159         {
   160         {
   160         LOG( NORMAL, 
   161         LOG( NORMAL, 
   185 void CSetUpCallHandler::DoCancel()
   186 void CSetUpCallHandler::DoCancel()
   186     {
   187     {
   187     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoCancel calling" )
   188     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoCancel calling" )
   188 
   189 
   189     iUtils->USatAPI().NotifySetUpCallCancel();
   190     iUtils->USatAPI().NotifySetUpCallCancel();
   190     if( iRequestHandler )
       
   191         {
       
   192         iRequestHandler->Cancel();
       
   193         }
       
   194 
   191 
   195     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoCancel exiting" )
   192     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoCancel exiting" )
   196     }
   193     }
   197 
   194 
   198 // -----------------------------------------------------------------------------
   195 // -----------------------------------------------------------------------------
   392 
   389 
   393     if ( iEmergencyCall )
   390     if ( iEmergencyCall )
   394         {
   391         {
   395         LOG( SIMPLE, 
   392         LOG( SIMPLE, 
   396         "SETUPCALL: CSetUpCallHandler::HandleCommand iEmergencyCall true" )
   393         "SETUPCALL: CSetUpCallHandler::HandleCommand iEmergencyCall true" )
   397         if ( iRequestHandler )
   394         TRAPD( err, CreateEmergencyCallL() );
   398             {
   395         if ( KErrNone != err )
   399             CreateEmergencyCall( *iRequestHandler );
   396             {
   400             }
   397             LOG2( SIMPLE, 
   401         else
   398             "SETUPCALL: CSetUpCallHandler::HandleCommand DialEmergencyCallL \
   402             {
   399             failed: %d", err )
       
   400 
   403             iEmergencyCall = EFalse;
   401             iEmergencyCall = EFalse;
       
   402 
   404             // Set the terminal response info.
   403             // Set the terminal response info.
   405             CompleteSetupCall(
   404             CompleteSetupCall(
   406                 RSat::KMeUnableToProcessCmd,
   405                 RSat::KMeUnableToProcessCmd,
   407                 RSat::KNoSpecificMeProblem );
   406                 RSat::KNoSpecificMeProblem );
   408             }
   407             }
   519 
   518 
   520     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::UiLaunchFailed exiting" )
   519     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::UiLaunchFailed exiting" )
   521     }
   520     }
   522 
   521 
   523 // -----------------------------------------------------------------------------
   522 // -----------------------------------------------------------------------------
   524 // CSetUpCallHandler::SetupCallRequestComplete
   523 // From class MAiwNotifyCallback.
   525 // (other items were commented in a header).
   524 // Called when dial request is completed.
   526 // -----------------------------------------------------------------------------
   525 // -----------------------------------------------------------------------------
   527 //
   526 //
   528 void CSetUpCallHandler::SetupCallRequestComplete( TInt aErrCode )
   527 TInt CSetUpCallHandler::HandleNotifyL(
   529     {
   528     const TInt aCmdId,
   530     LOG( SIMPLE,
   529     const TInt aEventId,
   531     "SETUPCALL: CSetUpCallHandler::SetupCallRequestComplete calling" )
   530     CAiwGenericParamList& aEventParamList,
   532 
   531     const CAiwGenericParamList& /*aInParamList*/ )
   533     LOG2( NORMAL,
   532     {
   534     "SETUPCALL: CSetUpCallHandler::SetupCallRequestComplete aErrCode %d",
   533     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::HandleNotifyL calling" )
   535     aErrCode )
   534 
   536     
   535     if ( KAiwCmdCall == aCmdId )
   537     if( !iEmergencyCall )
   536         {
   538         {
   537         LOG2( SIMPLE, 
   539         CompleteSetupCallWithStatus( aErrCode );
   538         "SETUPCALL: CSetUpCallHandler::HandleNotifyL  event: %d", aEventId )
       
   539         switch ( aEventId )
       
   540             {
       
   541             case KAiwEventError:
       
   542             case KAiwEventCompleted:
       
   543             case EGenericParamError: // This is due CCaUiPlugin behaviour.
       
   544                                      // Also overlaps event KAiwEventStarted.
       
   545                 {
       
   546                 LOG( SIMPLE, 
       
   547                 "SETUPCALL: CSetUpCallHandler::HandleNotifyL SetupCall \
       
   548                 Completed" )
       
   549 
       
   550                 // Fetch completion status.
       
   551                 TInt index( 0 );
       
   552                 const TAiwGenericParam* param = aEventParamList.FindFirst(
       
   553                     index, EGenericParamError );
       
   554 
       
   555                 if ( param )
       
   556                     {
       
   557                     LOG( SIMPLE, 
       
   558                     "SETUPCALL: CSetUpCallHandler::HandleNotifyL param true" )
       
   559                     
       
   560                     // Converts error number to symbian-formatted before 
       
   561                     // calling CompleteSetupCallWithStatus.
       
   562                     TInt error = TccpErrorToSymbianError( 
       
   563                         param->Value().AsTInt32() );
       
   564                     CompleteSetupCallWithStatus( error );
       
   565                     }
       
   566                 else
       
   567                     {
       
   568                     CompleteSetupCall( RSat::KSuccess );
       
   569                     }
       
   570                 }
       
   571                 break;
       
   572 
       
   573             case KAiwEventCanceled:
       
   574             case KAiwEventStopped:
       
   575             case KAiwEventQueryExit:
       
   576                 {
       
   577                 LOG( SIMPLE, 
       
   578                 "SETUPCALL: CSetUpCallHandler::HandleNotifyL SetupCall \
       
   579                 cancelled" )
       
   580 
       
   581                 CompleteSetupCallWithStatus( KErrAbort );
       
   582                 }
       
   583                 break;
       
   584 
       
   585             case KAiwEventOutParamCheck:
       
   586             case KAiwEventInParamCheck:
       
   587                 {
       
   588                 LOG( SIMPLE, 
       
   589                 "SETUPCALL: CSetUpCallHandler::HandleNotifyL SetupCall param \
       
   590                 fail" )
       
   591 
       
   592                 CompleteSetupCall( RSat::KCmdDataNotUnderstood );
       
   593                 }
       
   594                 break;
       
   595 
       
   596             default:
       
   597                 {
       
   598                 LOG( SIMPLE, 
       
   599                 "SETUPCALL: CSetUpCallHandler::HandleNotifyL Unknown event \
       
   600                 id" )
       
   601                 }
       
   602                 break;
       
   603 
       
   604             }
       
   605         }
       
   606 
       
   607     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::HandleNotifyL exiting" )
       
   608     return KErrNone;
       
   609     }
       
   610 
       
   611 // -----------------------------------------------------------------------------
       
   612 // From class MAiwNotifyCallback.
       
   613 // Called when dial request is completed.
       
   614 // -----------------------------------------------------------------------------
       
   615 //
       
   616 void CSetUpCallHandler::HandleEmergencyDialL( const TInt aStatus )
       
   617     {
       
   618     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::HandleEmergencyDialL calling" )
       
   619 
       
   620     iEmergencyCall = EFalse;
       
   621 
       
   622     if ( KErrNone == aStatus )
       
   623         {
       
   624         // Set result
       
   625         CompleteSetupCall( RSat::KSuccess );
   540         }
   626         }
   541     else
   627     else
   542         {
   628         {
   543         iEmergencyCall = EFalse;
   629         CompleteSetupCall(
   544 
   630             RSat::KNetworkUnableToProcessCmd,
   545         if ( KErrNone == aErrCode )
   631             RSat::KNoSpecificMeProblem );
   546             {
   632 
   547             // Set result
   633         LOG( SIMPLE, 
   548             CompleteSetupCall( RSat::KSuccess );
   634         "SETUPCALL: CSetUpCallHandler::HandleEmergencyDialL Network unable \
   549             }
   635         to process this" )
   550         else
   636         }
   551             {
   637 
   552             // The emergency call implementation 
   638     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::HandleEmergencyDialL exiting" )
   553             // before S60 SAT migration from AIW to EtelMM
       
   554             // According current information, no requirement for this.
       
   555             // We don't return extended network error.
       
   556             CompleteSetupCall(
       
   557                 RSat::KNetworkUnableToProcessCmd,
       
   558                 RSat::KNoSpecificMeProblem );
       
   559 
       
   560             LOG( SIMPLE,
       
   561             "SETUPCALL: CSetUpCallHandler::HandleEmergencyDialL Network unable \
       
   562             to process this" )
       
   563             }
       
   564         }
       
   565     LOG2( NORMAL,
       
   566         "SETUPCALL: CSetUpCallHandler::SetupCallRequestComplete exiting %d", aErrCode )
       
   567     }
   639     }
   568 
   640 
   569 // -----------------------------------------------------------------------------
   641 // -----------------------------------------------------------------------------
   570 // C++ default constructor can NOT contain any code, that
   642 // C++ default constructor can NOT contain any code, that
   571 // might leave.
   643 // might leave.
   595 //
   667 //
   596 void CSetUpCallHandler::ConstructL()
   668 void CSetUpCallHandler::ConstructL()
   597     {
   669     {
   598     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ConstructL calling" )
   670     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ConstructL calling" )
   599 
   671 
   600     
       
   601     iRequestHandler = CSetupCallRequestHandler::NewL( iUtils->MultiModeApi(),
       
   602             this ); 
       
   603     // Create request handler. This is same that LaunchBrowser uses, so this
   672     // Create request handler. This is same that LaunchBrowser uses, so this
   604     // is needed also in HandleCommand - function.
   673     // is needed also in HandleCommand - function.
   605     iUtils->RegisterServiceRequestL(
   674     iUtils->RegisterServiceRequestL(
   606         ESatSProactiveQuery,
   675         ESatSProactiveQuery,
   607         ESatSProactiveQueryResponse,
   676         ESatSProactiveQueryResponse,
   608         this );
   677         this );
   609 
   678 
   610     iUtils->RegisterL( this, MSatUtils::ECallControlExecuting );
   679     iUtils->RegisterL( this, MSatUtils::ECallControlExecuting );
   611     iUtils->RegisterL( this, MSatUtils::ECallControlDone );
   680     iUtils->RegisterL( this, MSatUtils::ECallControlDone );
   612 
   681 
       
   682     // Create service handler for normal call setup.
       
   683     iServiceHandler = CAiwServiceHandler::NewL();
       
   684 
       
   685     // Create dynamic resource to attach service handler.
       
   686     RCriteriaArray interest;
       
   687     CAiwCriteriaItem* item = CAiwCriteriaItem::NewLC(
       
   688         KAiwCmdCall,
       
   689         KAiwCmdCall,
       
   690         KContentType );
       
   691 
       
   692     TUid serviceClassBase;
       
   693     serviceClassBase.iUid = KAiwClassBase;
       
   694     item->SetServiceClass( serviceClassBase );
       
   695 
       
   696     interest.AppendL( item );
       
   697 
       
   698     // Attach to call service.
       
   699     iServiceHandler->AttachL( interest );
       
   700 
       
   701     CleanupStack::PopAndDestroy( item );
       
   702 
   613     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ConstructL exiting" )
   703     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::ConstructL exiting" )
   614     }
   704     }
   615 
   705 
   616 // -----------------------------------------------------------------------------
   706 // -----------------------------------------------------------------------------
   617 // Performs the request to dial
   707 // Performs the request to dial
   618 // -----------------------------------------------------------------------------
   708 // -----------------------------------------------------------------------------
   619 //
   709 //
   620 void CSetUpCallHandler::DoSetupCall( CSetupCallRequestHandler& aHandler )
   710 void CSetUpCallHandler::DoSetupCallL()
   621     {
   711     {
   622     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoSetupCallL calling" )
   712     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoSetupCallL calling" )
   623     
   713 
   624     if( CheckSetupCallParam() )
   714     RSat::TSetUpCallType callType( iSetUpCallData.iType );
   625         {
   715 
   626 
   716     TDes& telNumber( iSetUpCallData.iAddress.iTelNumber );
   627         RSat::TSetUpCallType callType( iSetUpCallData.iType );
   717     CheckNumber( telNumber );
   628     
   718 
   629         TDes& telNumber( iSetUpCallData.iAddress.iTelNumber );
   719     // 80 is max length in SAT calls, AIW max length is 100
   630         CheckNumber( telNumber );
   720     if ( telNumber.Length() > KMaximumPhoneNumberLength )
   631 
   721         {
   632         RMobileCall::TMobileCallParamsV7 dialParams;
   722         LOG( SIMPLE, 
   633         RMobileCall::TMobileCallParamsV7Pckg package( dialParams );
   723         "SETUPCALL: CSetUpCallHandler::DoSetupCallL telNumber too long" )
   634     
   724         User::Leave( KErrArgument );
   635         //Redail has been removed from MCL, no redail support.
   725         }
   636         dialParams.iAutoRedial = EFalse;
   726 
   637         dialParams.iBearerMode = RMobileCall::EMulticallNewBearer;
   727     TBuf< AIWDialDataExt::KMaximumNameLength > name;
   638         dialParams.iCallParamOrigin = RMobileCall::EOriginatorSIM;
   728     if ( RSat::EAlphaIdProvided ==
   639         dialParams.iSubAddress = iSetUpCallData.iSubAddress;
   729          iSetUpCallData.iAlphaIdCallSetUpPhase.iStatus )
   640         dialParams.iBearerCap1 = iSetUpCallData.iCapabilityConfigParams;
   730         {
   641         
   731         LOG( SIMPLE, 
   642         dialParams.iBCRepeatIndicator = RMobileCall::EBCAlternateMode;
   732         "SETUPCALL: CSetUpCallHandler::DoSetupCallL EAlphaIdProvided" )
   643         
   733         name = iSetUpCallData.iAlphaIdCallSetUpPhase.iAlphaId;
   644         dialParams.iIconId.iQualifier = RMobileCall::ENoIconId;
       
   645         
       
   646         
       
   647         dialParams.iAlphaId = iSetUpCallData.iAlphaIdCallSetUpPhase.iAlphaId;
       
   648         LOG2( NORMAL, 
       
   649             "SETUPCALL: CSetUpCallHandler::DoSetupCallL id:%S",
       
   650             &dialParams.iAlphaId )
       
   651         
       
   652         LOG2( NORMAL, 
       
   653             "SETUPCALL: CSetUpCallHandler::DoSetupCallL number:%S",
       
   654             &iSetUpCallData.iAddress.iTelNumber )
       
   655         
       
   656         TBool terminateOtherCall( EFalse );
       
   657         // check if we need to disconnect other calls
       
   658         if ( ( RSat::EDisconnectOtherCalls == callType ) ||
       
   659              ( RSat::EDisconnectOtherCallsWithRedial == callType ) )
       
   660             {
       
   661             LOG( SIMPLE, 
       
   662             "SETUPCALL: CSetUpCallHandler::DoSetupCallL end other call" )
       
   663             terminateOtherCall = ETrue ;
       
   664             }
       
   665         
       
   666         aHandler.DialNumber( package, iSetUpCallData.iAddress.iTelNumber,
       
   667                 terminateOtherCall, iUtils->CreateAsyncToSyncHelper() );
       
   668         }
   734         }
   669     else
   735     else
   670         {
   736         {
   671         CompleteSetupCallWithStatus( KErrArgument );
   737         LOG( SIMPLE, 
   672         }
   738         "SETUPCALL: CSetUpCallHandler::DoSetupCallL set AlphaId" )
   673     
   739         name = iUtils->SatAppName();
       
   740         }
       
   741 
       
   742     // Make the phone call parameters.
       
   743     CAiwInternalDialData* dialData = CAiwInternalDialData::NewLC();
       
   744 
       
   745     dialData->SetCallType( CAiwDialData::EAIWVoice );
       
   746     dialData->SetWindowGroup( AIWDialData::KAiwGoToIdle );
       
   747     // coverity static analysis tool generates a false finding here 
       
   748     // eliminating that 
       
   749     // coverity[use_after_free]
       
   750     dialData->SetPhoneNumberL( telNumber );
       
   751     dialData->SetSATCall( ETrue );
       
   752     dialData->SetShowNumber( EFalse );
       
   753     // coverity static analysis tool generates a false finding here 
       
   754     // eliminating that 
       
   755     // coverity[use_after_free]
       
   756     dialData->SetNameL( name );
       
   757     dialData->SetAllowMatch( EFalse );
       
   758     // Remove the redial mechanism from S60 5.x.
       
   759     dialData->SetRedial( AIWDialDataExt::KAIWRedialOff );
       
   760 
       
   761     // check if we need to disconnect other calls
       
   762     if ( ( RSat::EDisconnectOtherCalls == callType ) ||
       
   763          ( RSat::EDisconnectOtherCallsWithRedial == callType ) )
       
   764         {
       
   765         LOG( SIMPLE, 
       
   766         "SETUPCALL: CSetUpCallHandler::DoSetupCallL end other call" )
       
   767         dialData->SetEndOtherCalls( ETrue );
       
   768         }
       
   769 
       
   770     if ( AIWInternalDialData::KAiwBearerLength >=
       
   771          iSetUpCallData.iCapabilityConfigParams.Length() )
       
   772         {
       
   773         LOG( NORMAL, 
       
   774         "SETUPCALL: CSetUpCallHandler::DoSetupCallL SetBearerL" )
       
   775         // coverity static analysis tool generates a false finding here 
       
   776         // eliminating that
       
   777         // coverity[use_after_free]
       
   778         dialData->SetBearerL( iSetUpCallData.iCapabilityConfigParams );
       
   779         }
       
   780 
       
   781     if ( AIWInternalDialData::KAiwSubAddressLength >=
       
   782          iSetUpCallData.iSubAddress.Length() )
       
   783         {
       
   784         LOG( NORMAL, 
       
   785         "SETUPCALL: CSetUpCallHandler::DoSetupCallL SetSubAddressL" )
       
   786         // coverity static analysis tool generates a false finding here 
       
   787         // eliminating that 
       
   788         // coverity[use_after_free]
       
   789         dialData->SetSubAddressL( iSetUpCallData.iSubAddress );
       
   790         }
       
   791 
       
   792     CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
       
   793     // coverity static analysis tool generates a false finding here 
       
   794     // eliminating that
       
   795     // coverity[use_after_free]
       
   796     dialData->FillInParamListL( paramList );
       
   797 
       
   798     iServiceHandler->ExecuteServiceCmdL(
       
   799         KAiwCmdCall,
       
   800         paramList,
       
   801         iServiceHandler->OutParamListL(),
       
   802         0,
       
   803         this );
       
   804 
       
   805     CleanupStack::PopAndDestroy( dialData );
       
   806 
   674     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoSetupCallL exiting" )
   807     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::DoSetupCallL exiting" )
   675     }
   808     }
   676 
   809 
   677 // -----------------------------------------------------------------------------
   810 // -----------------------------------------------------------------------------
   678 // Return terminal response filled according to dial result.
   811 // Return terminal response filled according to dial result.
   732                 CompleteSetupCall( RSat::KCallClearedBeforeConnectionOrReleased );
   865                 CompleteSetupCall( RSat::KCallClearedBeforeConnectionOrReleased );
   733                 break;
   866                 break;
   734                 }
   867                 }
   735 
   868 
   736             case KErrGeneral:
   869             case KErrGeneral:
   737             case KErrArgument:
       
   738                 {
   870                 {
   739                 LOG( SIMPLE, 
   871                 LOG( SIMPLE, 
   740                 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Data \
   872                 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Data \
   741                 not understood" )
   873                 not understood" )
   742                 CompleteSetupCall( RSat::KCmdDataNotUnderstood );
   874                 CompleteSetupCall( RSat::KCmdDataNotUnderstood );
   811             }
   943             }
   812         // Icon support for call setup phase not done.
   944         // Icon support for call setup phase not done.
   813         else if ( ( RSat::ESelfExplanatory == qualifier2 ) ||
   945         else if ( ( RSat::ESelfExplanatory == qualifier2 ) ||
   814                   ( RSat::ENotSelfExplanatory == qualifier2 ) )
   946                   ( RSat::ENotSelfExplanatory == qualifier2 ) )
   815             {
   947             {
   816             // Until 2009-10 the phone and NTSY not support the icon.
       
   817             // to be updated after the updating of the phone and NTSY
       
   818             result = RSat::KSuccessRequestedIconNotDisplayed;
   948             result = RSat::KSuccessRequestedIconNotDisplayed;
   819             LOG( SIMPLE, 
   949             LOG( SIMPLE, 
   820             "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Icon \
   950             "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus Icon \
   821             not shown" )
   951             not shown" )
   822             }
   952             }
   834                 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
   964                 "SETUPCALL: CSetUpCallHandler::CompleteSetupCallWithStatus \
   835                 iIconCommand true" )
   965                 iIconCommand true" )
   836                 result = RSat::KSuccessRequestedIconNotDisplayed;
   966                 result = RSat::KSuccessRequestedIconNotDisplayed;
   837                 }
   967                 }
   838             }
   968             }
       
   969 
   839         // Set result
   970         // Set result
   840         CompleteSetupCall( result );
   971         CompleteSetupCall( result );
   841         }
   972         }
   842 
   973 
   843     LOG( SIMPLE,
   974     LOG( SIMPLE,
   895 // -----------------------------------------------------------------------------
  1026 // -----------------------------------------------------------------------------
   896 //
  1027 //
   897 void CSetUpCallHandler::CheckNumber( TDes& aNumber ) const
  1028 void CSetUpCallHandler::CheckNumber( TDes& aNumber ) const
   898     {
  1029     {
   899     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckNumber calling" )
  1030     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckNumber calling" )
   900     
  1031 
   901     for ( TInt i = 0; i < aNumber.Length(); i++ )
  1032     for ( TInt i = 0; i < aNumber.Length(); i++ )
   902         {
  1033         {
   903         // check values
  1034         // check values
   904         if ( KBCDAsterisk == aNumber[i] )
  1035         if ( KBCDAsterisk == aNumber[i] )
   905             {
  1036             {
   934             LOG( SIMPLE, 
  1065             LOG( SIMPLE, 
   935             "SETUPCALL: CSetUpCallHandler::CheckNumber KExpansionChar" )
  1066             "SETUPCALL: CSetUpCallHandler::CheckNumber KExpansionChar" )
   936             aNumber[i] = KExpansionChar;
  1067             aNumber[i] = KExpansionChar;
   937             }
  1068             }
   938         }
  1069         }
   939     
       
   940     LOG2( SIMPLE, 
  1070     LOG2( SIMPLE, 
   941     "SETUPCALL: CSetUpCallHandler::CheckNumber length of aNumber: %d",
  1071     "SETUPCALL: CSetUpCallHandler::CheckNumber length of aNumber: %d",
   942      aNumber.Length() )
  1072      aNumber.Length() )
   943     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckNumber exiting" )
  1073     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckNumber exiting" )
   944     }
  1074     }
   945 
  1075 
   946 // -----------------------------------------------------------------------------
  1076 // -----------------------------------------------------------------------------
       
  1077 // Converts a TCCP error to the corresponding symbian error.
       
  1078 // -----------------------------------------------------------------------------
       
  1079 //
       
  1080 TInt CSetUpCallHandler::TccpErrorToSymbianError( const TInt aTccpError ) const
       
  1081     {
       
  1082     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::TccpErrorToSymbianError \
       
  1083         calling" )
       
  1084     
       
  1085     // Error to be returned after mapped from aTccpError;
       
  1086     // Initialized with default value KErrAccessDenied.
       
  1087     TInt retValue( KErrAccessDenied );
       
  1088     
       
  1089     // Convert TCCP Error to Symbian Error in the switch braces.
       
  1090     switch ( aTccpError )
       
  1091         {
       
  1092         case ECCPErrorNone:
       
  1093         case ECCPErrorNotFound:
       
  1094         case ECCPErrorGeneral:
       
  1095         case ECCPErrorCancel:
       
  1096         case ECCPErrorNoMemory:
       
  1097         case ECCPErrorNotSupported:
       
  1098         case ECCPErrorAlreadyInUse:
       
  1099         case ECCPErrorNotReady:
       
  1100             {
       
  1101             retValue = aTccpError;
       
  1102             break;
       
  1103             }
       
  1104             
       
  1105         case ECCPErrorCCCallRejected:
       
  1106             {
       
  1107             retValue = KErrGsmCCCallRejected;
       
  1108             break;
       
  1109             }
       
  1110             
       
  1111         case ECCPRequestFailure:
       
  1112             {
       
  1113             retValue = KErrGsmMMCongestion;
       
  1114             break;
       
  1115             }
       
  1116             
       
  1117         case ECCPErrorCCBearerCapabilityNotAuthorised:
       
  1118         case ECCPErrorBadRequest:
       
  1119             {
       
  1120             retValue = KErrGsmCCBearerCapabilityNotAuthorised;
       
  1121             break;
       
  1122             }
       
  1123             
       
  1124         case ECCPErrorAccessDenied:
       
  1125             {
       
  1126             retValue = KErrAccessDenied;
       
  1127             break;
       
  1128             }
       
  1129         
       
  1130          //The following are KErrGsmCallControlBase group.
       
  1131         case ECCPErrorNotReached:
       
  1132             {
       
  1133             retValue = KErrGsmCCUnassignedNumber;
       
  1134             break;
       
  1135             }
       
  1136             
       
  1137         case ECCPErrorBusy:
       
  1138             {
       
  1139             retValue = KErrGsmCCUserBusy;
       
  1140             break;
       
  1141             }
       
  1142             
       
  1143         case ECCPErrorMovedPermanently:
       
  1144             {
       
  1145             retValue = KErrGsmCCNumberChanged;
       
  1146             break;
       
  1147             }
       
  1148             
       
  1149         case ECCPErrorInvalidURI:
       
  1150             {
       
  1151             retValue = KErrGsmCCInvalidNumberFormat;
       
  1152             break;
       
  1153             }
       
  1154             
       
  1155         case ECCPErrorNetworkOutOfOrder:
       
  1156             {
       
  1157             retValue = KErrGsmCCNetworkOutOfOrder;
       
  1158             break;
       
  1159             }
       
  1160             
       
  1161         case ECCPErrorCCNoRouteToDestination:
       
  1162             {
       
  1163             retValue = KErrGsmCCNoRouteToDestination;
       
  1164             break;
       
  1165             }
       
  1166 
       
  1167         case ECCPErrorCCDestinationOutOfOrder:
       
  1168             {
       
  1169             retValue = KErrGsmCCDestinationOutOfOrder;
       
  1170             break;
       
  1171             }
       
  1172             
       
  1173         case ECCPErrorCCResourceNotAvailable:
       
  1174             {
       
  1175             retValue = KErrGsmCCResourceNotAvailable;
       
  1176             break;
       
  1177             }
       
  1178             
       
  1179 
       
  1180         case ECCPErrorCCInvalidTransitNetworkSelection:
       
  1181             {
       
  1182             retValue = KErrGsmCCInvalidTransitNetworkSelection;
       
  1183             break;
       
  1184             }
       
  1185             
       
  1186         case ECCPErrorCCIncompatibleDestination:
       
  1187             {
       
  1188             retValue = KErrGsmCCIncompatibleDestination;
       
  1189             break;
       
  1190             }
       
  1191             
       
  1192         case ECCPErrorCCIncompatibleMessageInCallState:
       
  1193             {
       
  1194             retValue = KErrGsmCCIncompatibleMessageInCallState;
       
  1195             break;
       
  1196             }
       
  1197 
       
  1198         case ECCPErrorCCIncompatibleMessageInProtocolState:
       
  1199             {
       
  1200             retValue = KErrGsmCCIncompatibleMessageInProtocolState;
       
  1201             break;
       
  1202             }
       
  1203             
       
  1204         case ECCPErrorCCNormalCallClearing:
       
  1205             {
       
  1206             retValue = KErrGsmCCNormalCallClearing;
       
  1207             break;
       
  1208             }
       
  1209             
       
  1210         case ECCPErrorCCUserAlertingNoAnswer:
       
  1211             {
       
  1212             retValue = KErrGsmCCUserAlertingNoAnswer;
       
  1213             break;
       
  1214             }
       
  1215 
       
  1216         case ECCPErrorCCUserNotResponding:
       
  1217             {
       
  1218             retValue = KErrGsmCCUserNotResponding;
       
  1219             break;
       
  1220             }
       
  1221 
       
  1222         case ECCPErrorCCPreemption:
       
  1223             {
       
  1224             retValue = KErrGsmCCPreemption;
       
  1225             break;
       
  1226             }
       
  1227             
       
  1228         case ECCPErrorCCFacilityRejected:
       
  1229             {
       
  1230             retValue = KErrGsmCCFacilityRejected;
       
  1231             break;
       
  1232             }
       
  1233 
       
  1234         case ECCPErrorCCResponseToStatusEnquiry:
       
  1235             {
       
  1236             retValue = KErrGsmCCResponseToStatusEnquiry;
       
  1237             break;
       
  1238             }
       
  1239             
       
  1240         case ECCPErrorCCInvalidMandatoryInformation:
       
  1241             {
       
  1242             retValue = KErrGsmCCInvalidMandatoryInformation;
       
  1243             break;
       
  1244             }
       
  1245             
       
  1246         case ECCPErrorCCNonExistentMessageType:
       
  1247             {
       
  1248             retValue = KErrGsmCCNonExistentMessageType;
       
  1249             break;
       
  1250             }
       
  1251 
       
  1252         case ECCPErrorCCNonExistentInformationElement:
       
  1253             {
       
  1254             retValue = KErrGsmCCNonExistentInformationElement;
       
  1255             break;
       
  1256             }
       
  1257 
       
  1258         case ECCPErrorCCNoChannelAvailable:
       
  1259             {
       
  1260             retValue = KErrGsmCCNoChannelAvailable;
       
  1261             break;
       
  1262             }
       
  1263 
       
  1264         case ECCPErrorCCRequestedFacilityNotSubscribed:
       
  1265             {
       
  1266             retValue = KErrGsmCCRequestedFacilityNotSubscribed;
       
  1267             break;
       
  1268             }
       
  1269 
       
  1270         case ECCPErrorCCIncomingCallsBarredInCug:
       
  1271             {
       
  1272             retValue = KErrGsmCCIncomingCallsBarredInCug;
       
  1273             break;
       
  1274             }
       
  1275             
       
  1276         case ECCPErrorUserNotInCug:
       
  1277             {
       
  1278             retValue = KErrGsmCCUserNotInCug;
       
  1279             break;
       
  1280             }
       
  1281             
       
  1282         case ECCPErrorCCRecoveryOnTimerExpiry:
       
  1283             {
       
  1284             retValue = KErrGsmCCRecoveryOnTimerExpiry;
       
  1285             break;
       
  1286             }
       
  1287 
       
  1288         case ECCPErrorCCBearerCapabilityNotCurrentlyAvailable:
       
  1289             {
       
  1290             retValue = KErrGsmCCBearerCapabilityNotCurrentlyAvailable;
       
  1291             break;
       
  1292             }
       
  1293 
       
  1294         case ECCPErrorCCServiceNotAvailable:
       
  1295             {
       
  1296             retValue = KErrGsmCCServiceNotAvailable;
       
  1297             break;
       
  1298             }
       
  1299 
       
  1300         case ECCPErrorCCBearerServiceNotImplemented:
       
  1301             {
       
  1302             retValue = KErrGsmCCBearerServiceNotImplemented;
       
  1303             break;
       
  1304             }
       
  1305 
       
  1306         case ECCPErrorCCOnlyRestrictedDigitalInformationBCAvailable:
       
  1307             {
       
  1308             retValue = KErrGsmCCOnlyRestrictedDigitalInformationBCAvailable;
       
  1309             break;
       
  1310             }
       
  1311             
       
  1312         case ECCPErrorCCServiceNotImplemented:
       
  1313             {
       
  1314             retValue = KErrGsmCCServiceNotImplemented;
       
  1315             break;
       
  1316             }
       
  1317             
       
  1318         case ECCPErrorCCUnspecifiedInterworkingError:
       
  1319             {
       
  1320             retValue = KErrGsmCCUnspecifiedInterworkingError;
       
  1321             break;
       
  1322             }
       
  1323             
       
  1324         case ECCPErrorSatControl:
       
  1325             {
       
  1326             retValue = KErrSatControl;
       
  1327             break;
       
  1328             }
       
  1329                 
       
  1330         default:
       
  1331             {
       
  1332             retValue = KErrAccessDenied;
       
  1333             break;
       
  1334             }
       
  1335         }
       
  1336         
       
  1337     LOG2( SIMPLE, 
       
  1338         "SETUPCALL: CSetUpCallHandler::TccpErrorToSymbianError TCCP error:%d",
       
  1339          aTccpError)
       
  1340     LOG2( SIMPLE, 
       
  1341         "SETUPCALL: CSetUpCallHandler::TccpErrorToSymbianError \
       
  1342         mapped Symbian Error:%d", retValue)
       
  1343     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::TccpErrorToSymbianError \
       
  1344         exiting" )
       
  1345     
       
  1346     return retValue;
       
  1347     }
       
  1348 
       
  1349 // -----------------------------------------------------------------------------
   947 // Create emergency call
  1350 // Create emergency call
   948 // -----------------------------------------------------------------------------
  1351 // -----------------------------------------------------------------------------
   949 //
  1352 //
   950 void CSetUpCallHandler::CreateEmergencyCall( 
  1353 void CSetUpCallHandler::CreateEmergencyCallL()
   951         CSetupCallRequestHandler& aHandler )
  1354     {
   952     {
  1355     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CreateEmergencyCallL calling" )
   953     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CreateEmergencyCall calling" )
       
   954    
       
   955     aHandler.DialEmergencyCall( iSetUpCallData.iAddress.iTelNumber );
       
   956     
  1356     
   957     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CreateEmergencyCall exiting" )    
  1357     if( !iEmergencyCallApi )
   958     }
  1358         {
   959 
  1359         // Create service handler for emergency call setup..
   960 // -----------------------------------------------------------------------------
  1360         LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CreateEmergencyCallL\
   961 // check setup call param.
  1361          create emergency call handler" )
   962 // -----------------------------------------------------------------------------
  1362         iEmergencyCallApi = CPhCltEmergencyCall::NewL( this );
   963 //
  1363         }
   964 TBool CSetUpCallHandler::CheckSetupCallParam()
       
   965     {
       
   966     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam calling" )
       
   967 
       
   968     TBool valid( ETrue );
       
   969     if ( iSetUpCallData.iAddress.iTelNumber.Length()
       
   970           > KSatMaximumPhoneNumberLength )
       
   971         {
       
   972         LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam num" )
       
   973         valid = EFalse;
       
   974         }    
       
   975     else if ( iSetUpCallData.iAlphaIdCallSetUpPhase.iAlphaId.Length()
       
   976                > KSatMaximumNameLength )
       
   977         {
       
   978         LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam name" )
       
   979         valid = EFalse;
       
   980         }    
       
   981     else if ( iSetUpCallData.iSubAddress.Length() > KSatSubAddressLength )
       
   982         {
       
   983         LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam sub" )
       
   984         valid = EFalse;
       
   985         }    
       
   986     else if ( iSetUpCallData.iCapabilityConfigParams.Length()
       
   987                > KSatBearerLength )
       
   988         {
       
   989         LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam bear" )
       
   990         valid = EFalse;
       
   991         }    
       
   992     LOG2( SIMPLE, 
       
   993     "SETUPCALL: CSetUpCallHandler::CheckSetupCallParam exiting %d", valid )
       
   994     
  1364     
   995     return valid;        
  1365     iEmergencyCallApi->DialEmergencyCallL( 
   996     }
  1366         iSetUpCallData.iAddress.iTelNumber );
       
  1367     LOG( SIMPLE, "SETUPCALL: CSetUpCallHandler::CreateEmergencyCallL exiting" )    
       
  1368     }
       
  1369 
   997 // End Of File
  1370 // End Of File