adaptationlayer/tsy/nokiatsy_dll/src/cmmcallmesshandler.cpp
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "cmmcallmesshandler.h"
       
    23 #include "cmmphonetsender.h"
       
    24 #include "cmmstaticutility.h"
       
    25 #include "cmmmessagerouter.h"
       
    26 #include "tsylogger.h"
       
    27 #include "cmmdataporthandler.h" // dataport includes
       
    28 #include "cmmdtmfmesshandler.h" //DTMF includes
       
    29 #include "osttracedefinitions.h"
       
    30 #ifdef OST_TRACE_COMPILER_IN_USE
       
    31 #include "cmmcallmesshandlertraces.h"
       
    32 #endif
       
    33 
       
    34 // ISI message coding/decoding functions
       
    35 #include <call_modemisi.h>
       
    36 #include <infoisi.h>
       
    37 #include <gpdsisi.h>
       
    38 #include <product_profile_definitions.h>
       
    39 #include <ctsy/serviceapi/gsmerror.h>
       
    40 #include <csdisi.h>
       
    41 #include <pipeisi.h>
       
    42 #include <pipe_sharedisi.h>
       
    43 
       
    44 // EXTERNAL DATA STRUCTURES
       
    45     // None
       
    46 
       
    47 // EXTERNAL FUNCTION PROTOTYPES
       
    48     // None
       
    49 
       
    50 // CONSTANTS
       
    51 const TUint8 KCallPadding = 0x00; // Filler byte for ISI messages
       
    52 
       
    53 // This needs to be distinct from TProductProfileRequestType values
       
    54 // in cmmcustommesshandler.h
       
    55 const TUint8 KHsdpaPpTransId = 5;
       
    56 
       
    57 // Delay for starting the emergency timer, 5 seconds
       
    58 const TUint KEmergencyTimerInterval = 5000000;
       
    59 
       
    60 // For shifting by one byte
       
    61 const TUint8 KShiftByOneByte = 8;
       
    62 
       
    63 // Preaddress length
       
    64 const TUint8 KPreAddressLength = 4;
       
    65 
       
    66 // CBST Data Rates coding
       
    67 const TUint KRateCodeAuto  = 0;
       
    68 const TUint KRateCode28800 = 130;
       
    69 const TUint KRateCode32000 = 131;
       
    70 const TUint KRateCode33600 = 132;
       
    71 const TUint KRateCode56000 = 133;
       
    72 const TUint KRateCode64000 = 134;
       
    73 
       
    74 //value for information which value is zero
       
    75 const TUint KZero = 0;
       
    76 
       
    77 // For call cause no cause
       
    78 const TUint8 KCallCauseNoCause = 0;
       
    79 
       
    80 // First PEP
       
    81 const TUint8 KFirstPepDevice = PN_DEV_HOST;      // Device Id of first PEP
       
    82 const TUint8 KFirstPepType   = PN_PEP_TYPE_COMM; // First PEP type
       
    83 
       
    84 // Second PEP
       
    85 const TUint8 KSecondPepDevice = PN_DEV_MODEM;    // Device Id of second PEP
       
    86 const TUint8 KSecondPepObject = 54; // PN_OBJ_CSD_SRV // Object Id of second PEP
       
    87 const TUint8 KSecondPepType   = PN_PEP_TYPE_GPRS; // Second PEP type
       
    88 
       
    89 // Redirect PEP
       
    90 const TUint8 KRedirectPepObject = 59; //PN_OBJ_CSD_WTB; // Object Id of redirected PEP
       
    91 
       
    92 const TUint8 KPipeTransID  = EIscNokiaDataport1;
       
    93 
       
    94 const TUint8 KInvalidPipeHandle = 0xFF;
       
    95 
       
    96 // MACROS
       
    97     // None
       
    98 
       
    99 // LOCAL CONSTANTS AND MACROS
       
   100     // None
       
   101 
       
   102 // MODULE DATA STRUCTURES
       
   103     // None
       
   104 
       
   105 // LOCAL FUNCTION PROTOTYPES
       
   106     // None
       
   107 
       
   108 // FORWARD DECLARATIONS
       
   109     // None
       
   110 
       
   111 // ============================= LOCAL FUNCTIONS ===============================
       
   112 
       
   113 // =============================================================================
       
   114 // CEmergencyTimer: Used for delaying Emergency call when PDP context deactivate
       
   115 // is ongoing
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CEmergencyTimer::CEmergencyTimer
       
   119 // C++ default constructor can NOT contain any code, that might leave.
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 CEmergencyTimer::CEmergencyTimer(
       
   123      CMmCallMessHandler& aCallMsgHandler )
       
   124         :CTimer( CActive::EPriorityHigh ),
       
   125         iCallMsgHandler( aCallMsgHandler )
       
   126     {
       
   127 TFLOGSTRING("TSY: CEmergencyTimer::CEmergencyTimer");
       
   128 OstTrace0( TRACE_NORMAL, CEMERGENCYTIMER_CEMERGENCYTIMER, "CEmergencyTimer::CEmergencyTimer" );
       
   129     }
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CEmergencyTimer::~CEmergencyTimer()
       
   133 // Destructor, deletes all allocated resources.
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 CEmergencyTimer::~CEmergencyTimer()
       
   137     {
       
   138 TFLOGSTRING("TSY: CEmergencyTimer::~CEmergencyTimer");
       
   139 OstTrace0( TRACE_NORMAL, DUP1_CEMERGENCYTIMER_CEMERGENCYTIMER, "CEmergencyTimer::~CEmergencyTimer" );
       
   140     Cancel();
       
   141     }
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // CEmergencyTimer::ConstructL()
       
   145 // Symbian 2nd phase constructor can leave.
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 void CEmergencyTimer::ConstructL()
       
   149     {
       
   150 TFLOGSTRING("TSY: CEmergencyTimer::ConstructL");
       
   151 OstTrace0( TRACE_NORMAL, CEMERGENCYTIMER_CONSTRUCTL, "CEmergencyTimer::ConstructL" );
       
   152     CTimer::ConstructL(); // Must be called
       
   153     CActiveScheduler::Add( this );
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CEmergencyTimer::RunL()
       
   158 // Called when timer elapses.
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 void CEmergencyTimer::RunL()
       
   162     {
       
   163 TFLOGSTRING("TSY: CEmergencyTimer::RunL - TIMER ELAPSED");
       
   164 OstTrace0( TRACE_NORMAL, CEMERGENCYTIMER_RUNL, "CEmergencyTimer::RunL" );
       
   165     iCallMsgHandler.GpdsContextsClearResp();
       
   166     }
       
   167 
       
   168 // -----------------------------------------------------------------------------
       
   169 // CEmergencyTimer::StartEmergencyTimer()
       
   170 // Start Emergency delay timer.
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 void CEmergencyTimer::StartEmergencyTimer()
       
   174     {
       
   175 TFLOGSTRING("TSY: CEmergencyTimer::StartEmergencyTimer");
       
   176 OstTrace0( TRACE_NORMAL, CEMERGENCYTIMER_STARTEMERGENCYTIMER, "CEmergencyTimer::StartEmergencyTimer" );
       
   177     Cancel();
       
   178     After( KEmergencyTimerInterval ); // 5 seconds
       
   179     }
       
   180 
       
   181 // -----------------------------------------------------------------------------
       
   182 // CEmergencyTimer::StopEmergencyTimer()
       
   183 // Stop Emergency delay timer.
       
   184 // -----------------------------------------------------------------------------
       
   185 //
       
   186 void CEmergencyTimer::StopEmergencyTimer()
       
   187     {
       
   188 TFLOGSTRING("TSY: CEmergencyTimer::StopEmergencyTimer");
       
   189 OstTrace0( TRACE_NORMAL, CEMERGENCYTIMER_STOPEMERGENCYTIMER, "CEmergencyTimer::StopEmergencyTimer" );
       
   190     Cancel();
       
   191     }
       
   192 
       
   193 
       
   194 
       
   195 // ============================ MEMBER FUNCTIONS ===============================
       
   196 
       
   197 // -----------------------------------------------------------------------------
       
   198 // CMmCallMessHandler::CMmCallMessHandler
       
   199 // C++ default constructor can NOT contain any code, that might leave.
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 CMmCallMessHandler::CMmCallMessHandler() : iEmergencyTimer( *this )
       
   203     {
       
   204 TFLOGSTRING("TSY: CEmergencyTimer::CMmCallMessHandler");
       
   205 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CMMCALLMESSHANDLER, "CMmCallMessHandler::CMmCallMessHandler" );
       
   206     }
       
   207 
       
   208 // -----------------------------------------------------------------------------
       
   209 // CMmCallMessHandler::ConstructL
       
   210 // Symbian 2nd phase constructor can leave.
       
   211 // -----------------------------------------------------------------------------
       
   212 //
       
   213 void CMmCallMessHandler::ConstructL()
       
   214     {
       
   215 TFLOGSTRING("TSY: CMmCallMessHandler::ConstructL");
       
   216 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CONSTRUCTL, "CMmCallMessHandler::ConstructL" );
       
   217 
       
   218     iSubAddress.Zero();
       
   219     iBearer.Zero();
       
   220     iReceivedUusData.Zero();
       
   221     iWaitingCall = KSymbianCallIdNone;
       
   222     iFDNErrorAlredyNotified = EFalse;
       
   223     iIs3rdPartyDial = EFalse;
       
   224     iIs3rdPartyAnswerIncomingCall = EFalse;
       
   225     iDataPortHandler = NULL;
       
   226     iGsmMmCauseError = KErrNone;
       
   227     iDestPostAddress.SetLength( 0 );
       
   228     iDtmfPostAddressCallId = 0;
       
   229     iDestPostAddressIncluded = EFalse;
       
   230     iUusData.iUUI.Zero();
       
   231     iUusData.iServiceReq = 0;
       
   232     iDataRateCode = KRateCode64000;
       
   233     iCallDirection = RMobileCall::EDirectionUnknown;
       
   234     iPipeHandle = KInvalidPipeHandle;
       
   235 
       
   236     iEmergCallDelayed = EFalse;
       
   237     iHSDPADisabledInPp = EFalse;
       
   238     iEmergencyTimer.ConstructL();
       
   239     // Read "HSDPA Disabled" status from product profile
       
   240     InfoPpDataReadReq();
       
   241 
       
   242     iSecondPepDeviceId = KSecondPepDevice;
       
   243     iSecondPepObjectId = KSecondPepObject;
       
   244 
       
   245     iCallOperationID = CSD_CALL_CREATE;
       
   246     iVideoCallMtReleased = EFalse;
       
   247     }
       
   248 
       
   249 // -----------------------------------------------------------------------------
       
   250 // CMmCallMessHandler::NewL
       
   251 // Two-phased constructor.
       
   252 // -----------------------------------------------------------------------------
       
   253 //
       
   254 CMmCallMessHandler* CMmCallMessHandler::NewL(
       
   255     CMmPhoNetSender* aPhoNetSender,
       
   256     CMmPhoNetReceiver* aPhoNetReceiver,
       
   257     CMmDtmfMessHandler* aDtmfMessHandler,
       
   258     CMmMessageRouter* aMessageRouter )
       
   259     {
       
   260 TFLOGSTRING("TSY: CMmCallMessHandler::NewL");
       
   261 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_NEWL, "CMmCallMessHandler::NewL" );
       
   262 
       
   263     CMmCallMessHandler* callMessHandler = new( ELeave ) CMmCallMessHandler();
       
   264 
       
   265     CleanupStack::PushL( callMessHandler );
       
   266     callMessHandler->iPhoNetSender = aPhoNetSender;
       
   267     callMessHandler->iMessageRouter = aMessageRouter;
       
   268     callMessHandler->ConstructL();
       
   269     aPhoNetReceiver->RegisterL( callMessHandler, PN_MODEM_CALL );
       
   270     aPhoNetReceiver->RegisterL(
       
   271         callMessHandler,
       
   272 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
   273         PN_INFO,
       
   274 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
   275         PN_MODEM_INFO,
       
   276 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
   277         INFO_PP_DATA_READ_RESP );
       
   278     aPhoNetReceiver->RegisterL(
       
   279         callMessHandler,
       
   280         PN_GPDS,
       
   281         GPDS_CONTEXTS_CLEAR_RESP );
       
   282 
       
   283     aPhoNetReceiver->RegisterL( callMessHandler, PN_CSD );
       
   284 
       
   285     aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_CREATE_RESP );
       
   286     aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_ENABLE_RESP );
       
   287     aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_RESET_RESP );
       
   288     aPhoNetReceiver->RegisterL( callMessHandler, PN_PIPE, PNS_PIPE_REMOVE_RESP );
       
   289 
       
   290     callMessHandler->iDtmfMessHandler = aDtmfMessHandler;
       
   291     CleanupStack::Pop( callMessHandler );
       
   292 
       
   293     return callMessHandler;
       
   294     }
       
   295 
       
   296 // -----------------------------------------------------------------------------
       
   297 // CMmCallMessHandler::~CMmCallMessHandler
       
   298 // Destructor, deletes all allocated resources.
       
   299 // -----------------------------------------------------------------------------
       
   300 //
       
   301 CMmCallMessHandler::~CMmCallMessHandler()
       
   302     {
       
   303 TFLOGSTRING("TSY: CMmCallMessHandler::~CMmCallMessHandler");
       
   304 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CMMCALLMESSHANDLER, "CMmCallMessHandler::~CMmCallMessHandler" );
       
   305 
       
   306     if ( iDataPortHandler )
       
   307         {
       
   308         delete iDataPortHandler;
       
   309         }
       
   310     // No else
       
   311     }
       
   312 
       
   313 // -----------------------------------------------------------------------------
       
   314 // CMmCallMessHandler::ReceiveMessageL
       
   315 // Entry point for messages received from Domestic OS. Switches the message
       
   316 // to the correct method.
       
   317 // (other items were commented in a header).
       
   318 // -----------------------------------------------------------------------------
       
   319 //
       
   320 void CMmCallMessHandler::ReceiveMessageL(
       
   321     const TIsiReceiveC &aIsiMessage // Received ISI message
       
   322     )
       
   323     {
       
   324     TInt resource (aIsiMessage.Get8bit( ISI_HEADER_OFFSET_RESOURCEID ));
       
   325     TInt messageId(aIsiMessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ));
       
   326 
       
   327 TFLOGSTRING3("TSY: CMmCallMessHandler::ReceiveMessageL. Resource:%d. MsgId:%d", resource, messageId);
       
   328 OstTraceExt2( TRACE_NORMAL, CMMCALLMESSHANDLER_RECEIVEMESSAGEL, "CMmCallMessHandler::ReceiveMessageL;resource=%d;messageId=%d", resource, messageId );
       
   329 
       
   330     // Switch according to the resource
       
   331     switch ( resource )
       
   332         {
       
   333         // Call server messages
       
   334         case PN_MODEM_CALL:
       
   335            {
       
   336             // Switch according to the message id
       
   337             // and call the appropriate messagehandler method
       
   338             switch( messageId )
       
   339                 {
       
   340                 // NOTE: ALL KErrNotFound lines should be removed after the
       
   341                 // message handlers have been rearranged
       
   342                 case CALL_MODEM_RELEASE_IND:
       
   343                     {
       
   344                     CallReleaseInd( aIsiMessage );
       
   345                     break;
       
   346                     }
       
   347                 case CALL_MODEM_TERMINATED_IND:
       
   348                     {
       
   349                     CallTerminatedInd( aIsiMessage );
       
   350                     break;
       
   351                     }
       
   352                 case CALL_MODEM_STATUS_IND:
       
   353                     {
       
   354                     CallStatusIndL( aIsiMessage );
       
   355                     break;
       
   356                     }
       
   357                 case CALL_MODEM_CONTROL_IND:
       
   358                     {
       
   359                     CallControlInd( aIsiMessage );
       
   360                     break;
       
   361                     }
       
   362                 case CALL_MODEM_PROPERTY_SET_RESP:
       
   363                     {
       
   364                     TUint8 transactId( aIsiMessage.Get8bit(
       
   365                         ISI_HEADER_OFFSET_TRANSID ) );
       
   366 
       
   367 TFLOGSTRING2("TSY: CMmCallMessHandler::ReceiveMessageL. CALL_MODEM_PROPERTY_SET_RESP. transactId:%d",transactId);
       
   368 OstTraceExt1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_RECEIVEMESSAGEL, "CMmCallMessHandler::ReceiveMessageL. CALL_MODEM_PROPERTY_SET_RESP. transactId=%hhu", transactId );
       
   369 
       
   370                     if ( KCallTransId == transactId )
       
   371                         {
       
   372                         CallPropertySetResp( aIsiMessage );
       
   373                         }
       
   374                     break;
       
   375                     }
       
   376                 case CALL_MODEM_NOTIFICATION_IND:
       
   377                     {
       
   378                     CallGsmNotificationInd( aIsiMessage );
       
   379                     break;
       
   380                     }
       
   381                 case CALL_MODEM_ANSWER_RESP:
       
   382                     {
       
   383                     CallAnswerResp( aIsiMessage );
       
   384                     break;
       
   385                     }
       
   386                 case CALL_MODEM_CONTROL_RESP:
       
   387                     {
       
   388                     CallControlResp( aIsiMessage );
       
   389                     break;
       
   390                     }
       
   391                 case CALL_MODEM_CREATE_RESP:
       
   392                     {
       
   393                     CallCreateResp( aIsiMessage );
       
   394                     break;
       
   395                     }
       
   396                 case CALL_MODEM_RELEASE_RESP:
       
   397                     {
       
   398                     CallReleaseResp( aIsiMessage );
       
   399                     break;
       
   400                     }
       
   401                 case CALL_MODEM_COMING_IND:
       
   402                     {
       
   403                     CallComingInd( aIsiMessage );
       
   404                     break;
       
   405                     }
       
   406                 case CALL_MODEM_SERVICE_DENIED_IND:
       
   407                     {
       
   408                     CallServiceDeniedInd( aIsiMessage );
       
   409                     break;
       
   410                     }
       
   411                 default:
       
   412                     {
       
   413                     // Needed because call server messages are also handled
       
   414                     // by DTMF and conference call message handlers
       
   415 TFLOGSTRING("TSY: CMmCallMessHandler::ReceiveMessageL, switch resource - case PN_MODEM_CALL, switch messageId - default.\n" );
       
   416 OstTrace0( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_RECEIVEMESSAGEL, "CMmCallMessHandler::ReceiveMessageL, switch resource - case PN_MODEM_CALL, switch messageId - default.\n" );
       
   417                     break;
       
   418                     }
       
   419                 }
       
   420             break;
       
   421             }
       
   422         // Info server messages
       
   423 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
   424         case PN_INFO:
       
   425 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
   426         case PN_MODEM_INFO:
       
   427 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
   428             {
       
   429             if ( INFO_PP_DATA_READ_RESP == messageId )
       
   430                 {
       
   431                 TUint8 transactId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
       
   432                 if ( KHsdpaPpTransId == transactId )
       
   433                     {
       
   434                     InfoPpDataReadResp( aIsiMessage );
       
   435                     }
       
   436                 }
       
   437             break;
       
   438             }
       
   439         // GPDS server messages
       
   440         case PN_GPDS:
       
   441             {
       
   442             if ( GPDS_CONTEXTS_CLEAR_RESP == messageId )
       
   443                 {
       
   444                 GpdsContextsClearResp();
       
   445                 }
       
   446             break;
       
   447             }
       
   448         // CSD server messages
       
   449         case PN_CSD:
       
   450             {
       
   451             // Switch according to the message id
       
   452             // and call the appropriate messagehandler method
       
   453             switch( messageId )
       
   454                 {
       
   455                 case CSD_CALL_CONTROL_RESP:
       
   456                     {
       
   457                     CsdCallControlResp( aIsiMessage );
       
   458                     break;
       
   459                     }
       
   460                 case CSD_VIDEO_CALL_STATUS_IND:
       
   461                     {
       
   462                     CsdVideoCallStatusInd( aIsiMessage );
       
   463                     break;
       
   464                     }
       
   465                 case CSD_MULTIMEDIA_DATA_RATE_IND:
       
   466                     {
       
   467                     CsdMultimediaDataRateInd( aIsiMessage );
       
   468                     break;
       
   469                     }
       
   470                 default:
       
   471                     {
       
   472 TFLOGSTRING("TSY: CMmCallMessHandler::ReceiveMessageL, switch resource - case PN_CSD, switch messageId - default.\n" );
       
   473 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_RECEIVEMESSAGEL, "CMmCallMessHandler::ReceiveMessageL, switch resource - case PN_CSD, switch messageId - default." );
       
   474                     break;
       
   475                     }
       
   476                 }
       
   477             break;
       
   478             }
       
   479         // ISI messages for Pipe Service
       
   480         case PN_PIPE:
       
   481             {
       
   482             switch( messageId )
       
   483                 {
       
   484                 case PNS_PIPE_CREATE_RESP:
       
   485                     {
       
   486                     PnsPipeCreateResp( aIsiMessage );
       
   487                     break;
       
   488                     }
       
   489                 case PNS_PIPE_ENABLE_RESP:
       
   490                     {
       
   491                     PnsPipeEnableResp( aIsiMessage );
       
   492                     break;
       
   493                     }
       
   494                 case PNS_PIPE_RESET_RESP:
       
   495                     {
       
   496                     PnsPipeResetResp( aIsiMessage );
       
   497                     break;
       
   498                     }
       
   499                 case PNS_PIPE_REMOVE_RESP:
       
   500                     {
       
   501                     PnsPipeRemoveResp( aIsiMessage );
       
   502                     break;
       
   503                     }
       
   504                 case PNS_PIPE_REDIRECT_RESP:
       
   505                     {
       
   506                     PnsPipeRedirectResp( aIsiMessage );
       
   507                     }
       
   508                 default:
       
   509                     {
       
   510 TFLOGSTRING("TSY: CMmCallMessHandler::ReceiveMessageL, switch resource - case PN_PIPE, switch messageId - default.\n" );
       
   511 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_RECEIVEMESSAGEL, "CMmCallMessHandler::ReceiveMessageL, switch resource - case PN_PIPE, switch messageId - default.\n" );
       
   512                     break;
       
   513                     }
       
   514                 }
       
   515             break;
       
   516             }
       
   517         default:
       
   518             {
       
   519 TFLOGSTRING("TSY: CMmCallMessHandler::ReceiveMessageL, switch resource - default.\n" );
       
   520 OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_RECEIVEMESSAGEL, "CMmCallMessHandler::ReceiveMessageL, switch resource - default.\n" );
       
   521             break;
       
   522             }
       
   523         }
       
   524     }
       
   525 
       
   526 // -----------------------------------------------------------------------------
       
   527 // CMmCallMessHandler::ExtFuncL
       
   528 // Entry point for messages received from Symbian OS layer (Message manager)
       
   529 // (other items were commented in a header).
       
   530 // -----------------------------------------------------------------------------
       
   531 //
       
   532 TInt CMmCallMessHandler::ExtFuncL(
       
   533     TInt aIpc,
       
   534     const CMmDataPackage* aDataPackage )
       
   535     {
       
   536 TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL - aIpc: %d", aIpc );
       
   537 OstTrace1( TRACE_NORMAL, CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL;aIpc=%d", aIpc );
       
   538 
       
   539     TInt ret( KErrNone );
       
   540     TUint8 messageId( 0 );
       
   541     TUint8 isiCallId( 0 );
       
   542     TInt callId( KSymbianCallIdNone );
       
   543     TUint8 dosCallId( CALL_MODEM_ID_NONE );
       
   544     RMobilePhone::TMobileService callMode( RMobilePhone::EServiceUnspecified );
       
   545     TBool requestDirectedToDataPort( EFalse );
       
   546     TBool callCreatedAlready( EFalse );
       
   547 
       
   548     const CCallDataPackage* callData(
       
   549         reinterpret_cast<const CCallDataPackage*>( aDataPackage ) );
       
   550 
       
   551     // In case of emergency call CMmDataPackage is used and it doesn't contain
       
   552     // call ID or call mode. CCallDataPackage is used in case of normal call.
       
   553     if ( EMobileCallDialEmergencyCall != aIpc )
       
   554         {
       
   555         callData->GetCallIdAndMode( callId, callMode );
       
   556 TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL. CallMode:%d", callMode );
       
   557 OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL;callMode=%d", callMode );
       
   558         }
       
   559 
       
   560     if ( KSymbianCallIdNone == callId )
       
   561         {
       
   562         dosCallId = CALL_MODEM_ID_NONE;
       
   563         }
       
   564     else
       
   565         {
       
   566         dosCallId = static_cast<TUint8>( callId );
       
   567         }
       
   568 
       
   569     TIsiSend callReq( iPhoNetSender->SendBufferDes() );
       
   570 
       
   571     // Resource ID
       
   572     callReq.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_CALL );
       
   573 
       
   574     // Transaction ID
       
   575     callReq.Set8bit( ISI_HEADER_OFFSET_TRANSID, KCallTransId );
       
   576 
       
   577     switch( aIpc )
       
   578         {
       
   579         case EMobileCallDialEmergencyCall:
       
   580             {
       
   581             aDataPackage->UnPackData( iTelEmergNumber );
       
   582 TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL - emergency dial number is %S", &iTelEmergNumber);
       
   583 OstTraceExt1( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - emergency dial number is=%S", iTelEmergNumber );
       
   584 #ifdef NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
       
   585             if ( iHSDPADisabledInPp )
       
   586                 {
       
   587                 // HSPDA is disabled in PP; no need to delay the emergency
       
   588                 // call setup.
       
   589 #endif //NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
       
   590                 dosCallId = CALL_MODEM_ID_NONE;
       
   591                 // In the case when emergency number checking is needed to be ignored
       
   592                 // the destination address is delivered
       
   593                 EmergencyCallCreateReq( &callReq );
       
   594                 // Emergency calls are created immediately, without
       
   595                 // setting properties
       
   596                 messageId = CALL_MODEM_CREATE_REQ;
       
   597                 isiCallId = CALL_MODEM_CREATE_REQ_OFFSET_CALLID;
       
   598 #ifdef NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
       
   599                 }
       
   600             else
       
   601                 {
       
   602                 // Destroy all data connections before attempting emergency
       
   603                 // call. The call will be set up in GpdsContextsClearResp.
       
   604 TFLOGSTRING( "TSY: CMmCallMessHandler::ExtFuncL - HSDPA workaround. Emergency call delayed, data connections have to be closed first." );
       
   605 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - HSDPA workaround. Emergency call delayed, data connections have to be closed first." );
       
   606                 iEmergCallDelayed = ETrue;
       
   607                 GpdsContextsClearReq();
       
   608                 }
       
   609 #endif //NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
       
   610             break;
       
   611             }
       
   612         case EEtelCallDial:
       
   613         case EMobileCallDialISV:
       
   614         case EMobileCallDialNoFdnCheck:
       
   615             {
       
   616             // Set iNoFDNDial flag in correct state
       
   617             if ( EMobileCallDialNoFdnCheck == aIpc )
       
   618                 {
       
   619                 iNoFdnDial = ETrue;
       
   620                 }
       
   621             else
       
   622                 {
       
   623                 iNoFdnDial = EFalse;
       
   624                 }
       
   625             if ( RMobilePhone::ECircuitDataService == callMode )
       
   626                 {
       
   627                 iFDNErrorAlredyNotified = EFalse;
       
   628                 ret = DialDataCall( callData );
       
   629                 requestDirectedToDataPort = ETrue;
       
   630                 }
       
   631             else if ( RMobilePhone::EVoiceService == callMode )
       
   632                 {
       
   633                 iCallMode = CALL_MODEM_MODE_SPEECH;
       
   634                 }
       
   635             else
       
   636                 {
       
   637                 iCallMode = CALL_MODEM_MODE_ALS_LINE_2;
       
   638                 }
       
   639 
       
   640             if ( ! requestDirectedToDataPort )
       
   641                 {
       
   642                 iIs3rdPartyDial = EFalse;
       
   643 
       
   644                 // If 3rd party client
       
   645                 if ( EMobileCallDialISV == aIpc )
       
   646                     {
       
   647                     iIs3rdPartyDial = ETrue;
       
   648                     }
       
   649                 // No else
       
   650 
       
   651                 // Check if CUG info is needed
       
   652                 RMobileCall::TMobileCallParamsV1Pckg* callParams( NULL );
       
   653                 RMobileCall::TMobileCallInfoV1* callInfo( NULL );
       
   654 
       
   655                 aDataPackage->UnPackData( &callParams, &callInfo );
       
   656 
       
   657                 RMobileCall::TMobileCallParamsV1Pckg* paramsPckgV1(
       
   658                     reinterpret_cast<RMobileCall::TMobileCallParamsV1Pckg*>
       
   659                         ( callParams ) );
       
   660 
       
   661                 RMobileCall::TMobileCallParamsV1 recentCallParams(
       
   662                     ( *paramsPckgV1 )() );
       
   663 
       
   664                 if ( RMmCustomAPI::KETelCustomExtCustomCallParamsV3 ==
       
   665                         recentCallParams.ExtensionId() )
       
   666                     {
       
   667 TFLOGSTRING("TSY: CMmCallMessHandler::ExtFuncL - Custom API call params in use ");
       
   668 OstTrace0( TRACE_NORMAL, DUP7_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - Custom API call params in use" );
       
   669 
       
   670                     // Unpack custom call parameters
       
   671                     RMmCustomAPI::TCustomCallParamsPckg* customparamsPckgV1(
       
   672                         reinterpret_cast<RMmCustomAPI::TCustomCallParamsPckg*>
       
   673                             ( paramsPckgV1 ) );
       
   674 
       
   675                     RMmCustomAPI::TCustomCallParams& aCustomParams(
       
   676                         ( *customparamsPckgV1 )() );
       
   677                     iSubAddress.Copy( aCustomParams.iSubAddress );
       
   678                     iBearer.Copy( aCustomParams.iBearer );
       
   679                     }
       
   680             #if ( NCP_COMMON_S60_VERSION_SUPPORT >= S60_VERSION_50 )
       
   681                 else if ( RMobileCall::KETelMobileCallParamsV7 == recentCallParams.ExtensionId() )
       
   682                     {
       
   683 TFLOGSTRING("TSY: CMmCallMessHandler::ExtFuncL - V7 call params in use ");
       
   684 OstTrace0( TRACE_NORMAL, DUP8_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - V7 call params in use" );
       
   685 
       
   686                     RMobileCall::TMobileCallParamsV7Pckg* paramsPckgV7(
       
   687                         reinterpret_cast<RMobileCall::TMobileCallParamsV7Pckg*>
       
   688                             ( callParams ) );
       
   689 
       
   690                     RMobileCall::TMobileCallParamsV7 recentCallParamsV7(
       
   691                         ( *paramsPckgV7 )() );
       
   692 
       
   693                     iSubAddress.Copy( recentCallParamsV7.iSubAddress );
       
   694                     // At the moment only 1 bearer capability is supported in SET UP CALL PCmd
       
   695                     iBearer.Copy( recentCallParamsV7.iBearerCap1 );
       
   696 
       
   697                     // Prevent FDN check if call is SIM originated (SET UP CALL)
       
   698                     if ( RMobileCall::EOriginatorSIM == recentCallParamsV7.iCallParamOrigin )
       
   699                         {
       
   700                         iNoFdnCheck = ETrue;
       
   701                         }
       
   702                     else
       
   703                         {
       
   704                         iNoFdnCheck = EFalse;
       
   705                         }
       
   706                     }
       
   707             #endif
       
   708                 else
       
   709                     {
       
   710                     iSubAddress.Zero();
       
   711                     iBearer.Zero();
       
   712                     }
       
   713 
       
   714 TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL - Cug explicit invoked: %d", recentCallParams.iCug.iExplicitInvoke );
       
   715 OstTrace1( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - Cug explicit invoked: %d", recentCallParams.iCug.iExplicitInvoke );
       
   716                 // if CUG is explicitly invoked by
       
   717                 // the other entries in this structure will be filled in
       
   718                 // function CallPropertySetReq.
       
   719                 if ( recentCallParams.iCug.iExplicitInvoke )
       
   720                     {
       
   721                     // Non-emergency calls set properties first. CallCreateReq will
       
   722                     // be called after CallPropertySetResp response has come.
       
   723                     messageId = CALL_MODEM_PROPERTY_SET_REQ;
       
   724                     dosCallId = CALL_MODEM_PROP_CUG_INFO;
       
   725 
       
   726                     CallPropertySetReq( &callReq, callData );
       
   727                     }
       
   728                 else
       
   729                     {
       
   730 //                    RMobileCall::TMobileCallParamsV1Pckg* callParams( NULL );
       
   731 //                    RMobileCall::TMobileCallInfoV1* callInfo( NULL );
       
   732 //                    aDataPackage->UnPackData( &callParams, &callInfo );
       
   733                     iTelNumber = callInfo->iDialledParty.iTelNumber;
       
   734 TFLOGSTRING2("TSY: CMmCallMessHandlerExtFuncL - iTelNumber: %S", &iTelNumber);
       
   735 OstTraceExt1( TRACE_NORMAL, DUP6_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL - iTelNumber=%s", iTelNumber );
       
   736                     iIdRestrict = recentCallParams.iIdRestrict;
       
   737 
       
   738                     CallCreateReq();
       
   739                     callCreatedAlready = ETrue;
       
   740                     // Reset information
       
   741                     iSubAddress.Zero();
       
   742                     iBearer.Zero();
       
   743                     }
       
   744                 }
       
   745             // No else
       
   746             break;
       
   747             }
       
   748         case EMobileCallSwap:
       
   749             {
       
   750             // Set special call Id
       
   751             dosCallId = CALL_MODEM_ID_ACTIVE;
       
   752             messageId = CALL_MODEM_CONTROL_REQ;
       
   753             isiCallId = CALL_MODEM_CONTROL_REQ_OFFSET_CALLID;
       
   754             CallControlReq( &callReq, aIpc );
       
   755             break;
       
   756             }
       
   757         case EMobileCallHold:
       
   758         case EMobileCallResume:
       
   759         case EMobileCallGoOneToOne:
       
   760         case EMobileCallTransfer:
       
   761         case EMobileCallActivateCCBS:
       
   762         case EMobilePhoneAcceptCCBSRecall:
       
   763             {
       
   764             messageId = CALL_MODEM_CONTROL_REQ;
       
   765             isiCallId = CALL_MODEM_CONTROL_REQ_OFFSET_CALLID;
       
   766             CallControlReq( &callReq, aIpc );
       
   767             break;
       
   768             }
       
   769         case EMobileCallAnswerISV:
       
   770         case EEtelCallAnswer:
       
   771             {
       
   772             if ( RMobilePhone::ECircuitDataService == callMode )
       
   773                 {
       
   774                 ret = AnswerIncomingDataCall( callData );
       
   775                 requestDirectedToDataPort = ETrue;
       
   776                 }
       
   777             else
       
   778                 {
       
   779                 iIs3rdPartyAnswerIncomingCall = EFalse;
       
   780 
       
   781                 // Is it from a 3rd party client or not
       
   782                 if ( EMobileCallAnswerISV == aIpc )
       
   783                     {
       
   784                     iIs3rdPartyAnswerIncomingCall = ETrue;
       
   785                     }
       
   786                 // No else
       
   787                 messageId = CALL_MODEM_ANSWER_REQ;
       
   788                 isiCallId = CALL_MODEM_ANSWER_REQ_OFFSET_CALLID;
       
   789                 callReq.Set8bit(
       
   790                     ISI_HEADER_SIZE + CALL_MODEM_ANSWER_REQ_OFFSET_SUBBLOCKS,
       
   791                     KCallPadding );
       
   792                 }
       
   793             break;
       
   794             }
       
   795         case EEtelCallHangUp:
       
   796             {
       
   797             // Call mode for emergency call is voice
       
   798             if ( RMobilePhone::EVoiceService == callMode )
       
   799                 {
       
   800                 iEmergCallDelayed = EFalse;
       
   801                 }
       
   802 
       
   803             if ( RMobilePhone::ECircuitDataService == callMode )
       
   804                 {
       
   805                 ret = HangUp( callId );
       
   806                 requestDirectedToDataPort = ETrue;
       
   807                 }
       
   808             else
       
   809                 {
       
   810                 messageId = CALL_MODEM_RELEASE_REQ;
       
   811                 isiCallId = CALL_MODEM_RELEASE_REQ_OFFSET_CALLID;
       
   812                 CallReleaseReq( &callReq, callData );
       
   813                 }
       
   814             // No else
       
   815             break;
       
   816             }
       
   817         case EMobilePhoneClearBlacklist:
       
   818             {
       
   819             messageId = CALL_MODEM_BLACKLIST_CLEAR_REQ;
       
   820             break;
       
   821             }
       
   822         // CSD fearures
       
   823         case EEtelCallLoanDataPort:
       
   824             {
       
   825             if ( iDataPortHandler )
       
   826                 {
       
   827                 ret = iDataPortHandler->LoanDataPort( callData );
       
   828                 }
       
   829             else
       
   830                 {
       
   831                 ret = KErrNotReady;
       
   832                 }
       
   833             requestDirectedToDataPort = ETrue;
       
   834             break;
       
   835             }
       
   836         case EEtelCallRecoverDataPort:
       
   837             {
       
   838             if ( iDataPortHandler )
       
   839                 {
       
   840                 ret = iDataPortHandler->RecoverDataPort( callData );
       
   841                 }
       
   842             else
       
   843                 {
       
   844                 ret = KErrNotReady;
       
   845                 }
       
   846             requestDirectedToDataPort = ETrue;
       
   847             break;
       
   848             }
       
   849         case EMobileCallActivateUUS:
       
   850             {
       
   851             ret = ActivateUUS( aDataPackage );
       
   852             break;
       
   853             }
       
   854         default:
       
   855             {
       
   856 TFLOGSTRING2("TSY: CMmCallMessHandler::ExtFuncL - Unknown IPC: %d", aIpc);
       
   857 OstTrace1( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_EXTFUNCL, "CMmCallMessHandler::ExtFuncL; - Unknown IPC=%d", aIpc );
       
   858             ret = KErrNotSupported;
       
   859             break;
       
   860             }
       
   861         }
       
   862 
       
   863     if ( ! requestDirectedToDataPort && !callCreatedAlready
       
   864 #ifdef NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
       
   865          && !iEmergCallDelayed
       
   866 #endif //NCP_COMMON_HSDPA_EMERGCALL_WORKAROUND
       
   867          )
       
   868         {
       
   869         // Create ISI message
       
   870         callReq.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, messageId );
       
   871 
       
   872         // Every message definition doesn't contains call ID
       
   873         if ( 0 != isiCallId )
       
   874             {
       
   875             callReq.Set8bit( ISI_HEADER_SIZE + isiCallId, dosCallId );
       
   876             }
       
   877         // No else
       
   878 
       
   879         if ( KErrNone == ret )
       
   880             {
       
   881             // Send message to PhoNet
       
   882             ret = iPhoNetSender->Send( callReq.Complete() );
       
   883             }
       
   884         // No else
       
   885         }
       
   886     // No else
       
   887 
       
   888     return ret;
       
   889     }
       
   890 
       
   891 // -----------------------------------------------------------------------------
       
   892 // CMmCallMessHandler::CallPropertySetReq
       
   893 // Constructs CALL_MODEM_PROPERTY_SET_REQ message (first phase of voice dial request)
       
   894 // (other items were commented in a header).
       
   895 // -----------------------------------------------------------------------------
       
   896 //
       
   897 void CMmCallMessHandler::CallPropertySetReq(
       
   898     TIsiSend* aCallReq,
       
   899     const CCallDataPackage* aDataPackage )
       
   900     {
       
   901 TFLOGSTRING("TSY: CMmCallMessHandler::CallPropertySetReq");
       
   902 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLPROPERTYSETREQ, "CMmCallMessHandler::CallPropertySetReq" );
       
   903 
       
   904     RMobileCall::TMobileCallParamsV1Pckg* callParams( NULL );
       
   905     RMobileCall::TMobileCallInfoV1* callInfo( NULL );
       
   906     aDataPackage->UnPackData( &callParams, &callInfo );
       
   907 
       
   908     RMobileCall::TMobileCallParamsV1Pckg* paramsPckgV1(
       
   909         reinterpret_cast<RMobileCall::TMobileCallParamsV1Pckg*>( callParams ) );
       
   910 
       
   911     RMobileCall::TMobileCallParamsV1 recentCallParams( ( *paramsPckgV1 )() );
       
   912 
       
   913     TBool suppressPref( recentCallParams.iCug.iSuppressPrefCug );
       
   914     TBool suppressOA( recentCallParams.iCug.iSuppressOA );
       
   915     TInt cugIndex( recentCallParams.iCug.iCugIndex );
       
   916 
       
   917     aCallReq->Set8bit( ISI_HEADER_SIZE + CALL_MODEM_PROPERTY_SET_REQ_OFFSET_SUBBLOCKS, 2 );
       
   918 
       
   919 TFLOGSTRING("TSY: CMmCallMessHandler::CallPropertySetReq - Call Property Info sub block ");
       
   920 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CALLPROPERTYSETREQ, "CMmCallMessHandler::CallPropertySetReq - Call Property Info sub block" );
       
   921 
       
   922     // Initialize message offset
       
   923     TInt currentMsgOffset(
       
   924         ISI_HEADER_SIZE + CALL_MODEM_PROPERTY_SET_REQ_OFFSET_PROPERTYINFO );
       
   925 
       
   926     // Create call property info sub block CALL_MODEM_SB_PROPERTY_INFO
       
   927     TBuf8<SIZE_CALL_MODEM_SB_PROPERTY_INFO> propertyInfoBuf;
       
   928     TIsiSubBlock propertyInfoSb(
       
   929         propertyInfoBuf,
       
   930         CALL_MODEM_SB_PROPERTY_INFO,
       
   931         EIsiSubBlockTypeId8Len8 );
       
   932 
       
   933     propertyInfoBuf.Append( CALL_MODEM_PROP_CUG_INFO ); // Property
       
   934     propertyInfoBuf.Append( KCallPadding ); // Padding
       
   935 
       
   936     // Add subblock to the message
       
   937     aCallReq->CopyData( currentMsgOffset, propertyInfoSb.CompleteSubBlock() );
       
   938 
       
   939     // Set new offset
       
   940     currentMsgOffset = currentMsgOffset + SIZE_CALL_MODEM_SB_PROPERTY_INFO;
       
   941 
       
   942 TFLOGSTRING("TSY: CMmCallMessHandler::CallPropertySetReq - Call Modem Cug Info sub block ");
       
   943 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_CALLPROPERTYSETREQ, "CMmCallMessHandler::CallPropertySetReq - Call Modem Cug Info sub block" );
       
   944 
       
   945     // Create call GSM CUG info subblock
       
   946     TBuf8< SIZE_CALL_MODEM_SB_CUG_INFO > callGsmCugInfoBuf;
       
   947     TIsiSubBlock callGsmCugInfoSb(
       
   948         callGsmCugInfoBuf,
       
   949         CALL_MODEM_SB_CUG_INFO,
       
   950         EIsiSubBlockTypeId8Len8 );
       
   951 
       
   952     if ( !suppressPref )
       
   953         {
       
   954         callGsmCugInfoBuf.Append( CALL_MODEM_CUG_PREF );
       
   955         cugIndex = CALL_MODEM_CUG_DEFAULT;
       
   956         }
       
   957     else
       
   958         {
       
   959         callGsmCugInfoBuf.Append( CALL_MODEM_CUG_PREF_SUPPRESS );
       
   960         if ( 0 == cugIndex )
       
   961             {
       
   962             cugIndex = CALL_MODEM_CUG_DEFAULT;
       
   963             }
       
   964         // No else
       
   965         }
       
   966 
       
   967     if ( !suppressOA )
       
   968         {
       
   969         callGsmCugInfoBuf.Append( CALL_MODEM_CUG_OA );
       
   970         }
       
   971     else
       
   972         {
       
   973         callGsmCugInfoBuf.Append( CALL_MODEM_CUG_OA_SUPPRESS );
       
   974         }
       
   975 
       
   976 TFLOGSTRING("TSY: CMmCallMessHandler::CallPropertySetReq - Cug Index copy 16 to 8 ");
       
   977 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_CALLPROPERTYSETREQ, "CMmCallMessHandler::CallPropertySetReq - Cug Index copy 16 to 8" );
       
   978 
       
   979     callGsmCugInfoBuf.Append( static_cast<TUint8>( cugIndex >> KShiftByOneByte ) );
       
   980     callGsmCugInfoBuf.Append( static_cast<TUint8>( cugIndex ) );
       
   981 
       
   982     callGsmCugInfoBuf.Append( KCallPadding );
       
   983     callGsmCugInfoBuf.Append( KCallPadding );
       
   984 
       
   985     // Complete subblock and add subblock to the message
       
   986     aCallReq->CopyData(
       
   987         currentMsgOffset,
       
   988         callGsmCugInfoSb.CompleteSubBlock() );
       
   989 
       
   990     iTelNumber = callInfo->iDialledParty.iTelNumber;
       
   991 TFLOGSTRING2("TSY: CMmCallMessHandler::CallPropertySetReq - iTelNumber: %S", &iTelNumber);
       
   992 OstTraceExt1( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_CALLPROPERTYSETREQ, "CMmCallMessHandler::CallPropertySetReq - iTelNumber=%S", iTelNumber );
       
   993     iIdRestrict = recentCallParams.iIdRestrict;
       
   994     }
       
   995 
       
   996 // -----------------------------------------------------------------------------
       
   997 // CMmCallMessHandler::CallPropertySetResp
       
   998 // Breaks CALL_MODEM_PROPERTY_SET_RESP message (first phase of voice dial request).
       
   999 // If a success result is received from Domestic OS, this method send the
       
  1000 // actual Dial request to the Domestic OS. In case of failure, Dial request
       
  1001 // will be completed to the Symbian OS layer.
       
  1002 // (other items were commented in a header).
       
  1003 // -----------------------------------------------------------------------------
       
  1004 //
       
  1005 void CMmCallMessHandler::CallPropertySetResp(
       
  1006     const TIsiReceiveC &aIsiMessage )
       
  1007     {
       
  1008 TFLOGSTRING("TSY: CMmCallMessHandler::CallPropertySetResp");
       
  1009 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLPROPERTYSETRESP, "CMmCallMessHandler::CallPropertySetResp" );
       
  1010 
       
  1011     // Create call property get response
       
  1012     // if property set request fails, complete dial
       
  1013 
       
  1014     TUint sbStartOffSet( 0 );
       
  1015 
       
  1016     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  1017         ISI_HEADER_SIZE + SIZE_CALL_MODEM_PROPERTY_SET_RESP,
       
  1018         CALL_MODEM_SB_CAUSE,
       
  1019         EIsiSubBlockTypeId8Len8,
       
  1020         sbStartOffSet ) )
       
  1021         {
       
  1022         // Get cause type
       
  1023         TUint8 causeType( aIsiMessage.Get8bit(
       
  1024             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE) );
       
  1025 
       
  1026         // Get cause value
       
  1027         TUint8 causeValue( aIsiMessage.Get8bit(
       
  1028             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE ) );
       
  1029 
       
  1030         // Complete dial with error value
       
  1031         TInt result( CMmStaticUtility::CSCauseToEpocError(
       
  1032             PN_MODEM_CALL,
       
  1033             causeType,
       
  1034             causeValue ) );
       
  1035 
       
  1036         // Unique call id (without possible generic id)
       
  1037         //(three bits (1-3) contain unique call ID)
       
  1038         TInt callId( static_cast<TInt>( aIsiMessage.Get8bit(
       
  1039             ISI_HEADER_SIZE + CALL_MODEM_PROPERTY_GET_RESP_OFFSET_MESSAGEID )
       
  1040                 & KMaskBits1to3 ) );
       
  1041 
       
  1042         // Create call package
       
  1043         CCallDataPackage callData;
       
  1044         // Pack the data for sending to the manager
       
  1045         callData.SetCallIdAndMode( callId, RMobilePhone::EVoiceService );
       
  1046 
       
  1047         if ( iIs3rdPartyDial )
       
  1048             {
       
  1049             // 3rd party client, process is over
       
  1050             iIs3rdPartyDial = EFalse;
       
  1051 
       
  1052             // Complete failed dial request
       
  1053             iMessageRouter->Complete(
       
  1054                 EMobileCallDialISV,
       
  1055                 &callData,
       
  1056                 result );
       
  1057             }
       
  1058         else if ( iNoFdnDial )
       
  1059             {
       
  1060             // Complete failed dial request
       
  1061             iMessageRouter->Complete(
       
  1062                 EMobileCallDialNoFdnCheck,
       
  1063                 &callData,
       
  1064                 result );
       
  1065             // Reset internal flag
       
  1066             iNoFdnDial = EFalse;
       
  1067             }
       
  1068         else
       
  1069             {
       
  1070             // Complete failed dial request
       
  1071             iMessageRouter->Complete( EEtelCallDial, &callData, result );
       
  1072             }
       
  1073         }
       
  1074     // Else send the actual dial request
       
  1075     else
       
  1076         {
       
  1077         CallCreateReq();
       
  1078         }
       
  1079 
       
  1080     // Reset information
       
  1081     iSubAddress.Zero();
       
  1082     iBearer.Zero();
       
  1083     }
       
  1084 
       
  1085 // -----------------------------------------------------------------------------
       
  1086 // CMmCallMessHandler::CallCreateReq
       
  1087 // Constructs the dial request message.and sends it to the domestic OS.
       
  1088 // (other items were commented in a header).
       
  1089 // -----------------------------------------------------------------------------
       
  1090 //
       
  1091 TInt CMmCallMessHandler::CallCreateReq()
       
  1092     {
       
  1093 TFLOGSTRING("TSY: CMmCallMessHandler::CallCreateReq");
       
  1094 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLCREATEREQ, "CMmCallMessHandler::CallCreateReq" );
       
  1095 
       
  1096     TIsiSend isimsg( iPhoNetSender->SendBufferDes() );
       
  1097     isimsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_CALL );
       
  1098     isimsg.Set8bit(
       
  1099         ISI_HEADER_SIZE + CALL_MODEM_CREATE_REQ_OFFSET_TRID,
       
  1100         KCallTransId );
       
  1101 
       
  1102     isimsg.Set8bit(
       
  1103         ISI_HEADER_SIZE + CALL_MODEM_CREATE_REQ_OFFSET_MESSAGEID,
       
  1104         CALL_MODEM_CREATE_REQ );
       
  1105 
       
  1106     // Number of subblocks( also SAT originated subblocks)
       
  1107     TUint8 numOfSbInMessage( 0 );
       
  1108 
       
  1109     // Initialize message offset
       
  1110     TInt currentMsgOffset( ISI_HEADER_SIZE + CALL_MODEM_CREATE_REQ_OFFSET_MODE );
       
  1111 
       
  1112     // Create subblocks for CALL_MODEM_CREATE_REQ
       
  1113     GetCallCreateReqSubBlock(
       
  1114         iCallMode,
       
  1115         dynamic_cast<TDesC16&>( iTelNumber ),
       
  1116         iIdRestrict,
       
  1117         isimsg,
       
  1118         numOfSbInMessage,
       
  1119         currentMsgOffset );
       
  1120 
       
  1121 #if ( NCP_COMMON_S60_VERSION_SUPPORT >= S60_VERSION_50 )
       
  1122     GetSatOriginatedSubBlocks(
       
  1123         isimsg,
       
  1124         numOfSbInMessage,
       
  1125         currentMsgOffset );
       
  1126 #else
       
  1127     GetSatOriginatedSubBlocks(
       
  1128         iSubAddress,
       
  1129         iBearer,
       
  1130         isimsg,
       
  1131         numOfSbInMessage,
       
  1132         currentMsgOffset );
       
  1133 #endif
       
  1134 
       
  1135     // Set number of subblocs in CALL_MODEM_CREATE_REQ message
       
  1136     isimsg.Set8bit(
       
  1137         ISI_HEADER_SIZE + CALL_MODEM_CREATE_REQ_OFFSET_SUBBLOCKS,
       
  1138         numOfSbInMessage );
       
  1139 
       
  1140     // Message sent via Phonet
       
  1141     return ( iPhoNetSender->Send( isimsg.Complete() ) );
       
  1142     }
       
  1143 
       
  1144 
       
  1145 // -----------------------------------------------------------------------------
       
  1146 // CMmCallMessHandler::CallCreateResp
       
  1147 // Breaks the response to the Dial request. Completes the Dial request in case
       
  1148 // of failure. Otherwise does not do anything (status indications handle the
       
  1149 // successful case).
       
  1150 // (other items were commented in a header).
       
  1151 // -----------------------------------------------------------------------------
       
  1152 //
       
  1153 void CMmCallMessHandler::CallCreateResp(
       
  1154     const TIsiReceiveC &aIsiMessage )
       
  1155     {
       
  1156 TFLOGSTRING("TSY: CMmCallMessHandler::CallCreateResp");
       
  1157 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLCREATERESP, "CMmCallMessHandler::CallCreateResp" );
       
  1158 
       
  1159     TUint sbStartOffSet( 0 );
       
  1160 
       
  1161     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  1162         ISI_HEADER_SIZE + SIZE_CALL_MODEM_CREATE_RESP,
       
  1163         CALL_MODEM_SB_CAUSE,
       
  1164         EIsiSubBlockTypeId8Len8,
       
  1165         sbStartOffSet ) )
       
  1166         {
       
  1167         RMobileCall::TMobileCallInfoV1 mobileCallInfo;
       
  1168         RMobileCall::TMobileCallStatus statusETel( RMobileCall::EStatusIdle );
       
  1169 
       
  1170         mobileCallInfo.iService = RMobilePhone::EVoiceService;
       
  1171 
       
  1172         if ( CALL_MODEM_MODE_ALS_LINE_2 == iCallMode )
       
  1173             {
       
  1174             mobileCallInfo.iService = RMobilePhone::EAuxVoiceService;
       
  1175             }
       
  1176 
       
  1177         mobileCallInfo.iStatus = statusETel;
       
  1178 
       
  1179         // Get Cause Type
       
  1180         TUint8 causeType( aIsiMessage.Get8bit(
       
  1181             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE ) );
       
  1182 
       
  1183         // Get Cause Value
       
  1184         TUint8 causeValue( aIsiMessage.Get8bit(
       
  1185             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE ) );
       
  1186 
       
  1187         // Map error value to Symbian OS error value
       
  1188         mobileCallInfo.iExitCode = CMmStaticUtility::CSCauseToEpocError(
       
  1189             PN_MODEM_CALL,
       
  1190             causeType,
       
  1191             causeValue );
       
  1192 
       
  1193         // To prevent FDN error to be completed again from CallServiceDeniedInd
       
  1194         if ( CALL_MODEM_CAUSE_FDN_NOT_OK == causeValue )
       
  1195             {
       
  1196             iFDNErrorAlredyNotified = ETrue;
       
  1197             }
       
  1198 
       
  1199         // Unique call id (without possible generic id)
       
  1200         // (three bits (1-3) contain unique call ID)
       
  1201         mobileCallInfo.iCallId = static_cast<TInt>( aIsiMessage.Get8bit(
       
  1202             ISI_HEADER_SIZE + CALL_MODEM_CREATE_RESP_OFFSET_CALLID )
       
  1203                 & KMaskBits1to3 );
       
  1204 
       
  1205         // Create call package
       
  1206         CCallDataPackage callData;
       
  1207         // Pack the data for sending to the manager
       
  1208         callData.SetCallIdAndMode(
       
  1209             mobileCallInfo.iCallId,
       
  1210             mobileCallInfo.iService );
       
  1211 
       
  1212         if ( CALL_MODEM_ID_NONE == mobileCallInfo.iCallId ) // Call has no ID
       
  1213             {
       
  1214             if ( iNoFdnDial )
       
  1215                 {
       
  1216                 // Complete failed dial request
       
  1217                 iMessageRouter->Complete(
       
  1218                     EMobileCallDialNoFdnCheck,
       
  1219                     &callData,
       
  1220                     mobileCallInfo.iExitCode );
       
  1221                 }
       
  1222             else if ( iIs3rdPartyDial )
       
  1223                 {
       
  1224                 // 3rd party client
       
  1225                 // Process is over
       
  1226                 iIs3rdPartyDial = EFalse;
       
  1227                 iMessageRouter->Complete(
       
  1228                     EMobileCallDialISV,
       
  1229                     &callData,
       
  1230                     mobileCallInfo.iExitCode );
       
  1231                 }
       
  1232             else
       
  1233                 {
       
  1234                 // Complete failed dial request with error value
       
  1235                 iMessageRouter->Complete(
       
  1236                     EEtelCallDial,
       
  1237                     &callData,
       
  1238                     mobileCallInfo.iExitCode );
       
  1239                 }
       
  1240             }
       
  1241         else
       
  1242             {
       
  1243             // COMPLETE MOBILE CALL INFO CHANGE
       
  1244             // (Mobile call information is always completed before call status)
       
  1245             // Pack mobile call info
       
  1246             callData.PackData( &mobileCallInfo );
       
  1247             // Complete mobile call info change
       
  1248             iMessageRouter->Complete(
       
  1249                 EMobileCallGetMobileCallInfo,
       
  1250                 &callData,
       
  1251                 KErrNone );
       
  1252 
       
  1253             // COMPLETE MOBILE CALL STATUS CHANGE
       
  1254             // Pack call status
       
  1255             callData.PackData( &statusETel );
       
  1256             // Complete status change indication
       
  1257             iMessageRouter->Complete(
       
  1258                 EMobileCallNotifyMobileCallStatusChange,
       
  1259                 &callData,
       
  1260                 mobileCallInfo.iExitCode );
       
  1261             }
       
  1262         }
       
  1263     // Reset internal flag
       
  1264     iNoFdnDial = EFalse;
       
  1265     iNoFdnCheck = EFalse;
       
  1266     }
       
  1267 
       
  1268 // -----------------------------------------------------------------------------
       
  1269 // CMmCallMessHandler::EmergencyCallCreateReq
       
  1270 // Created emergency call request message.
       
  1271 // (other items were commented in a header).
       
  1272 // -----------------------------------------------------------------------------
       
  1273 //
       
  1274 void CMmCallMessHandler::EmergencyCallCreateReq(
       
  1275     TIsiSend* aCallReq )
       
  1276     {
       
  1277 TFLOGSTRING("TSY: CMmCallMessHandler::EmergencyCallCreateReq");
       
  1278 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_EMERGENCYCALLCREATEREQ, "CMmCallMessHandler::EmergencyCallCreateReq" );
       
  1279 
       
  1280     // (TAN) Save the call mode of the latest CALL_MODEM_CREATE_REQ. This is
       
  1281     // used when CALL_MODEM_CREATE_RESP is received and message handler should
       
  1282     // be able to identify if the resp is emergency or speech call.
       
  1283     iCallMode = CALL_MODEM_MODE_EMERGENCY;
       
  1284 
       
  1285     // Number of Subblocks
       
  1286     TUint8 numOfSbInMessage( 0 );
       
  1287 
       
  1288     // Initialize message offset
       
  1289     TInt currentMsgOffset( ISI_HEADER_SIZE + CALL_MODEM_CREATE_REQ_OFFSET_MODE );
       
  1290 
       
  1291     // Create subblocks for CallCreateReq
       
  1292     GetCallCreateReqSubBlock(
       
  1293         iCallMode,
       
  1294         iTelEmergNumber,
       
  1295         RMobileCall::ESendMyId,
       
  1296         *aCallReq,
       
  1297         numOfSbInMessage,
       
  1298         currentMsgOffset );
       
  1299 
       
  1300     // Set number of subblocs in CALL_MODEM_CREATE_REQ message
       
  1301     aCallReq->Set8bit(
       
  1302         ISI_HEADER_SIZE + CALL_MODEM_CREATE_REQ_OFFSET_SUBBLOCKS,
       
  1303         numOfSbInMessage );
       
  1304 
       
  1305     iTelEmergNumber.Zero();
       
  1306     }
       
  1307 
       
  1308 // -----------------------------------------------------------------------------
       
  1309 // CMmCallMessHandler::MapCallStatus
       
  1310 // Maps Domestic OS status value to Symbian OS status.
       
  1311 // (other items were commented in a header).
       
  1312 // -----------------------------------------------------------------------------
       
  1313 //
       
  1314 RMobileCall::TMobileCallStatus CMmCallMessHandler::MapCallStatus(
       
  1315     TUint8 aCallStatus )
       
  1316     {
       
  1317 TFLOGSTRING("TSY: CMmCallMessHandler::MapCallStatus");
       
  1318 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_MAPCALLSTATUS, "CMmCallMessHandler::MapCallStatus" );
       
  1319 
       
  1320     RMobileCall::TMobileCallStatus symbianStatus( RMobileCall::EStatusUnknown );
       
  1321 
       
  1322     switch ( aCallStatus )
       
  1323         {
       
  1324         case CALL_MODEM_STATUS_IDLE:
       
  1325             {
       
  1326             symbianStatus = RMobileCall::EStatusIdle;
       
  1327             break;
       
  1328             }
       
  1329         case CALL_MODEM_STATUS_CREATE:
       
  1330             {
       
  1331             symbianStatus = RMobileCall::EStatusDialling;
       
  1332             break;
       
  1333             }
       
  1334         case CALL_MODEM_STATUS_MO_ALERTING:
       
  1335             {
       
  1336             symbianStatus = RMobileCall::EStatusConnecting;
       
  1337             break;
       
  1338             }
       
  1339         case CALL_MODEM_STATUS_WAITING:
       
  1340         case CALL_MODEM_STATUS_MT_ALERTING:
       
  1341             {
       
  1342             symbianStatus = RMobileCall::EStatusRinging;
       
  1343             break;
       
  1344             }
       
  1345         case CALL_MODEM_STATUS_ANSWERED:
       
  1346             {
       
  1347             symbianStatus = RMobileCall::EStatusAnswering;
       
  1348             break;
       
  1349             }
       
  1350         case CALL_MODEM_STATUS_ACTIVE:
       
  1351             {
       
  1352             symbianStatus = RMobileCall::EStatusConnected;
       
  1353             break;
       
  1354             }
       
  1355         case CALL_MODEM_STATUS_MO_RELEASE:
       
  1356             {
       
  1357             symbianStatus = RMobileCall::EStatusDisconnecting;
       
  1358             break;
       
  1359             }
       
  1360         case CALL_MODEM_STATUS_MT_RELEASE:
       
  1361             {
       
  1362             if ( iDisconnectingWithInband )
       
  1363                 {
       
  1364                 symbianStatus = RMobileCall::EStatusDisconnectingWithInband;
       
  1365                 iDisconnectingWithInband = EFalse;
       
  1366                 }
       
  1367             else
       
  1368                 {
       
  1369                 symbianStatus = RMobileCall::EStatusDisconnecting;
       
  1370                 }
       
  1371             break;
       
  1372             }
       
  1373         case CALL_MODEM_STATUS_HOLD:
       
  1374             {
       
  1375             symbianStatus = RMobileCall::EStatusHold;
       
  1376             break;
       
  1377             }
       
  1378         case CALL_MODEM_STATUS_COMING:
       
  1379             {
       
  1380             symbianStatus = RMobileCall::EStatusUnknown;
       
  1381             break;
       
  1382             }
       
  1383         case CALL_MODEM_STATUS_RETRIEVE_INITIATED:
       
  1384         case CALL_MODEM_STATUS_RECONNECT_PENDING:
       
  1385         case CALL_MODEM_STATUS_PROCEEDING:
       
  1386         case CALL_MODEM_STATUS_HOLD_INITIATED:
       
  1387         case CALL_MODEM_STATUS_SWAP_INITIATED:
       
  1388         default:
       
  1389             {
       
  1390             symbianStatus = RMobileCall::EStatusUnknown;
       
  1391             break;
       
  1392             }
       
  1393         }
       
  1394     return symbianStatus;
       
  1395     }
       
  1396 
       
  1397 // -----------------------------------------------------------------------------
       
  1398 // CMmCallMessHandler::CallAnswerResp
       
  1399 // Breaks the response to the Answer request. In case of failure, answer
       
  1400 // request is completed. Otherwise status indications handle the success case.
       
  1401 // (other items were commented in a header).
       
  1402 // -----------------------------------------------------------------------------
       
  1403 //
       
  1404 void CMmCallMessHandler::CallAnswerResp(
       
  1405     const TIsiReceiveC &aIsiMessage )
       
  1406     {
       
  1407 TFLOGSTRING("TSY: CMmCallMessHandler::CallAnswerResp");
       
  1408 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLANSWERRESP, "CMmCallMessHandler::CallAnswerResp" );
       
  1409 
       
  1410     TUint sbStartOffSet( 0 );
       
  1411 
       
  1412     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  1413         ISI_HEADER_SIZE + SIZE_CALL_MODEM_ANSWER_RESP,
       
  1414         CALL_MODEM_SB_CAUSE,
       
  1415         EIsiSubBlockTypeId8Len8,
       
  1416         sbStartOffSet ) )
       
  1417         {
       
  1418         // Get cause type
       
  1419         TUint8 causeType( aIsiMessage.Get8bit(
       
  1420             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE ) );
       
  1421 
       
  1422         // Get cause value
       
  1423         TUint8 causeValue( aIsiMessage.Get8bit(
       
  1424             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE ) );
       
  1425 
       
  1426         // Map error value
       
  1427         TInt result( CMmStaticUtility::CSCauseToEpocError(
       
  1428             PN_MODEM_CALL,
       
  1429             causeType,
       
  1430             causeValue ) );
       
  1431 
       
  1432         // Unique call id (without possible generic id)
       
  1433         // (three bits (1-3) contain unique call ID)
       
  1434         TInt callId( static_cast<TInt>( aIsiMessage.Get8bit(
       
  1435             ISI_HEADER_SIZE + CALL_MODEM_ANSWER_RESP_OFFSET_CALLID )
       
  1436                 & KMaskBits1to3 ) );
       
  1437 
       
  1438         // Create call package
       
  1439         CCallDataPackage callData;
       
  1440         // Pack the data for sending to the manager
       
  1441         callData.SetCallIdAndMode( callId, RMobilePhone::EVoiceService );
       
  1442 
       
  1443         if ( iIs3rdPartyAnswerIncomingCall )
       
  1444             {
       
  1445             // Process is finished, set it to EFalse
       
  1446             iIs3rdPartyAnswerIncomingCall = EFalse;
       
  1447             // If req was made by a 3rd party client, complete failed request
       
  1448             iMessageRouter->Complete(
       
  1449                 EMobileCallAnswerISV,
       
  1450                 &callData,
       
  1451                 result );
       
  1452             }
       
  1453         else
       
  1454             {
       
  1455             // If not 3rd, complete failed request
       
  1456             iMessageRouter->Complete( EEtelCallAnswer, &callData, result );
       
  1457             }
       
  1458         }
       
  1459     // No else
       
  1460     }
       
  1461 
       
  1462 // -----------------------------------------------------------------------------
       
  1463 // CMmCallMessHandler::CallReleaseReq
       
  1464 // Constructs HangUp request message.
       
  1465 // (other items were commented in a header).
       
  1466 // -----------------------------------------------------------------------------
       
  1467 //
       
  1468 void CMmCallMessHandler::CallReleaseReq(
       
  1469     TIsiSend* aCallReq,
       
  1470     const CCallDataPackage* aDataPackage )
       
  1471     {
       
  1472 TFLOGSTRING("TSY: CMmCallMessHandler::CallReleaseReq");
       
  1473 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLRELEASEREQ, "CMmCallMessHandler::CallReleaseReq" );
       
  1474 
       
  1475     TUint8 cause( KCallCauseNoCause );
       
  1476     TInt symbianCauseValue( KErrNone );
       
  1477     TBool autoStChangeDisable( EFalse );
       
  1478 
       
  1479     // Unpack dial parameters
       
  1480     aDataPackage->UnPackData( symbianCauseValue, autoStChangeDisable );
       
  1481 
       
  1482     if ( KErrGsmBusyUserRequest == symbianCauseValue )
       
  1483         {
       
  1484         cause = CALL_MODEM_CAUSE_BUSY_USER_REQUEST;
       
  1485         }
       
  1486     else
       
  1487         {
       
  1488         cause = CALL_MODEM_CAUSE_RELEASE_BY_USER;
       
  1489         }
       
  1490 
       
  1491     iReleaseCauseValueSent = cause;
       
  1492 
       
  1493     // CALL_MODEM_SB_CAUSE subblock
       
  1494     TBuf8< SIZE_CALL_MODEM_SB_CAUSE > callCauseBuf( 0 );
       
  1495     TIsiSubBlock callCauseSb(
       
  1496         callCauseBuf,
       
  1497         CALL_MODEM_SB_CAUSE,
       
  1498         EIsiSubBlockTypeId8Len8 );
       
  1499 
       
  1500     // Number of subblocks
       
  1501     TUint8 numOfSbInMessage( 0 );
       
  1502 
       
  1503     // Initialize message offset
       
  1504     TInt currentMsgOffset( ISI_HEADER_SIZE + CALL_MODEM_RELEASE_REQ_OFFSET_CAUSE );
       
  1505 
       
  1506     callCauseBuf.Append( CALL_MODEM_CAUSE_TYPE_CLIENT );
       
  1507     callCauseBuf.Append( cause );
       
  1508     aCallReq->CopyData( currentMsgOffset, callCauseSb.CompleteSubBlock() );
       
  1509 
       
  1510     // Increase subblock count
       
  1511     numOfSbInMessage++;
       
  1512 
       
  1513     // Disable automatic retrieve for held call
       
  1514     if ( autoStChangeDisable )
       
  1515         {
       
  1516         // Set new offset
       
  1517         currentMsgOffset = currentMsgOffset + SIZE_CALL_MODEM_SB_CAUSE;
       
  1518 
       
  1519         // CALL_MODEM_SB_STATE_AUTO_CHANGE subblock
       
  1520         TBuf8< SIZE_CALL_MODEM_SB_STATE_AUTO_CHANGE > callStateAutoChangeBuf( 0 );
       
  1521         TIsiSubBlock callStateAutoChangeSb(
       
  1522             callStateAutoChangeBuf,
       
  1523             CALL_MODEM_SB_STATE_AUTO_CHANGE,
       
  1524             EIsiSubBlockTypeId8Len8 );
       
  1525 
       
  1526         // Disables auto retrieve when a waiting call exists.
       
  1527         callStateAutoChangeBuf.Append( CALL_MODEM_AUTO_ST_CHANGE_DISABLE );
       
  1528         callStateAutoChangeBuf.Append( KCallPadding );
       
  1529 
       
  1530         aCallReq->CopyData(
       
  1531             currentMsgOffset,
       
  1532             callStateAutoChangeSb.CompleteSubBlock() );
       
  1533 
       
  1534         // Increase subblock count
       
  1535         numOfSbInMessage++;
       
  1536         }
       
  1537     // No else
       
  1538 
       
  1539     // Set number of subblocs in CALL_MODEM_RELEASE_REQ message
       
  1540     aCallReq->Set8bit(
       
  1541         ISI_HEADER_SIZE + CALL_MODEM_RELEASE_REQ_OFFSET_SUBBLOCKS,
       
  1542         numOfSbInMessage );
       
  1543 
       
  1544     // Hangup causes iIncomingCallInfo to be reset
       
  1545     // (no effect if this was an MO call)
       
  1546     TInt callId( KSymbianCallIdNone );
       
  1547     RMobilePhone::TMobileService mode( RMobilePhone::EServiceUnspecified );
       
  1548     aDataPackage->GetCallIdAndMode( callId, mode );
       
  1549 
       
  1550     if ( callId == iIncomingCallInfo.iCallId )
       
  1551         {
       
  1552         ResetIncomingCallInfo( iIncomingCallInfo );
       
  1553         }
       
  1554     }
       
  1555 
       
  1556 // -----------------------------------------------------------------------------
       
  1557 // CMmCallMessHandler::CallReleaseResp
       
  1558 // Breaks response to the HangUp request. In case of failure, HangUp is
       
  1559 // completed to the Symbian OS layer. Otherwise status indications handle
       
  1560 // the success case.
       
  1561 // (other items were commented in a header).
       
  1562 // -----------------------------------------------------------------------------
       
  1563 //
       
  1564 void CMmCallMessHandler::CallReleaseResp(
       
  1565     const TIsiReceiveC &aIsiMessage )
       
  1566     {
       
  1567 TFLOGSTRING("TSY: CMmCallMessHandler::CallReleaseResp");
       
  1568 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLRELEASERESP, "CMmCallMessHandler::CallReleaseResp" );
       
  1569 
       
  1570     TUint8 causeType( 0 );
       
  1571     TUint8 causeValue( KCallCauseNoCause );
       
  1572 
       
  1573     TUint sbStartOffSet( 0 );
       
  1574 
       
  1575     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  1576         ISI_HEADER_SIZE + SIZE_CALL_MODEM_RELEASE_RESP,
       
  1577         CALL_MODEM_SB_CAUSE,
       
  1578         EIsiSubBlockTypeId8Len8,
       
  1579         sbStartOffSet ) )
       
  1580         {
       
  1581         // Get cause type
       
  1582         causeType = aIsiMessage.Get8bit(
       
  1583             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE );
       
  1584 
       
  1585         // Get cause value
       
  1586         causeValue = aIsiMessage.Get8bit(
       
  1587             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE );
       
  1588 
       
  1589         // Complete hangup if release has failed
       
  1590         if ( iReleaseCauseValueSent != causeValue )
       
  1591             {
       
  1592             // Map error value
       
  1593             TInt result( CMmStaticUtility::CSCauseToEpocError(
       
  1594                 PN_MODEM_CALL,
       
  1595                 causeType,
       
  1596                 causeValue ) );
       
  1597 
       
  1598             // Unique call id (without possible generic id)
       
  1599             // (three bits (1-3) contain unique call ID)
       
  1600             TInt callId( static_cast<TInt>( aIsiMessage.Get8bit(
       
  1601                 ISI_HEADER_SIZE + CALL_MODEM_RELEASE_RESP_OFFSET_CALLID )
       
  1602                     & KMaskBits1to3 ) );
       
  1603 
       
  1604             // Create call package
       
  1605             CCallDataPackage callData;
       
  1606             // pack the data for sending to the manager
       
  1607             callData.SetCallIdAndMode( callId, RMobilePhone::EVoiceService );
       
  1608 
       
  1609             // Complete failed HangUp request
       
  1610             iMessageRouter->Complete( EEtelCallHangUp, &callData, result );
       
  1611             }
       
  1612         // No else
       
  1613         }
       
  1614     // No else
       
  1615     }
       
  1616 
       
  1617 // -----------------------------------------------------------------------------
       
  1618 // CMmCallMessHandler::CallReleaseInd
       
  1619 // Breaks call release indication message containing information whether the
       
  1620 // inband tone is generated by network or should it be generated locally.
       
  1621 // (other items were commented in a header).
       
  1622 // -----------------------------------------------------------------------------
       
  1623 //
       
  1624 void CMmCallMessHandler::CallReleaseInd(
       
  1625     const TIsiReceiveC &aIsiMessage )
       
  1626     {
       
  1627 TFLOGSTRING("TSY: CMmCallMessHandler::CallReleaseInd");
       
  1628 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLRELEASEIND, "CMmCallMessHandler::CallReleaseInd" );
       
  1629 
       
  1630     TUint sbStartOffSet( 0 );
       
  1631 
       
  1632     // Get the releaseinfo from the ISI message
       
  1633     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  1634         ISI_HEADER_SIZE + SIZE_CALL_MODEM_RELEASE_IND,
       
  1635         CALL_MODEM_SB_RELEASE_INFO,
       
  1636         EIsiSubBlockTypeId8Len8,
       
  1637         sbStartOffSet ) )
       
  1638         {
       
  1639         // Get inband tone information
       
  1640         TUint8 inbandToneInfo( aIsiMessage.Get8bit (
       
  1641             sbStartOffSet + CALL_MODEM_SB_RELEASE_INFO_OFFSET_RELEASEINFO ) );
       
  1642 
       
  1643         // If inband tone is not played by network, inform it to
       
  1644         // Phone Engine.
       
  1645         if ( CALL_MODEM_RI_IN_BAND_INFO & inbandToneInfo )
       
  1646             {
       
  1647             iDisconnectingWithInband = ETrue;
       
  1648             }
       
  1649         // No else
       
  1650         }
       
  1651     // No else
       
  1652 
       
  1653     // Get the diagnostic octet
       
  1654     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  1655         ISI_HEADER_SIZE + SIZE_CALL_MODEM_RELEASE_IND,
       
  1656         CALL_MODEM_SB_SS_DIAGNOSTICS,
       
  1657         EIsiSubBlockTypeId8Len8,
       
  1658         sbStartOffSet ) )
       
  1659         {
       
  1660           iDiagnosticOctet = aIsiMessage.Get8bit(
       
  1661             sbStartOffSet + CALL_MODEM_SB_SS_DIAGNOSTICS_OFFSET_DIAGNOSTICS );
       
  1662         }
       
  1663     // No else
       
  1664     }
       
  1665 
       
  1666 // -----------------------------------------------------------------------------
       
  1667 // CMmCallMessHandler::CallTerminatedInd
       
  1668 // Breaks call terminated indication message containing
       
  1669 // GSM MM cause information.
       
  1670 // (other items were commented in a header).
       
  1671 // -----------------------------------------------------------------------------
       
  1672 //
       
  1673 void CMmCallMessHandler::CallTerminatedInd(
       
  1674     const TIsiReceiveC &aIsiMessage )
       
  1675     {
       
  1676 TFLOGSTRING("TSY: CMmCallMessHandler::CallTerminatedInd");
       
  1677 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLTERMINATEDIND, "CMmCallMessHandler::CallTerminatedInd" );
       
  1678 
       
  1679     TUint sbStartOffSet( 0 );
       
  1680 
       
  1681     // Get the GSM MM cause from the ISI message
       
  1682     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  1683         ISI_HEADER_SIZE + SIZE_CALL_MODEM_TERMINATED_IND,
       
  1684         CALL_MODEM_SB_MM_CAUSE,
       
  1685         EIsiSubBlockTypeId8Len8,
       
  1686         sbStartOffSet ) )
       
  1687         {
       
  1688         // Get Cause Value
       
  1689         TUint8 mmCauseValue( aIsiMessage.Get8bit(
       
  1690             sbStartOffSet + CALL_MODEM_SB_MM_CAUSE_OFFSET_CAUSE ) );
       
  1691 
       
  1692         // Map error value to Symbian OS error value
       
  1693         if ( CALL_MODEM_MM_CAUSE_CONGESTION == mmCauseValue )
       
  1694             {
       
  1695             // Save error code (used when call status idle is received)
       
  1696             iGsmMmCauseError = CMmStaticUtility::EpocErrorCode(
       
  1697                 KErrEtelNoCarrier,
       
  1698                 KErrGsmMMCongestion );
       
  1699             }
       
  1700         }
       
  1701 #if ( NCP_COMMON_CELLMO_BRANCH_SUPPORT == NCP_COMMON_CELLMO_BRANCH_0711 )
       
  1702     // If call was rejected because of barred CS (DSAC),
       
  1703     // CALL_DSAC_INFO subblock exists in CALL_TERMINATED_IND.
       
  1704     if( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  1705         ISI_HEADER_SIZE + SIZE_CALL_TERMINATED_IND,
       
  1706         CALL_DSAC_INFO,
       
  1707         EIsiSubBlockTypeId8Len8,
       
  1708         sbStartOffSet ) )
       
  1709         {
       
  1710 TFLOGSTRING("TSY: CMmCallMessHandler::CallTerminatedInd, DSAC: call was rejected because of barred CS");
       
  1711 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CALLTERMINATEDIND, "CMmCallMessHandler::CallTerminatedInd, DSAC: call was rejected because of barred CS" );
       
  1712         // Save error code. It is completed when CALL_STATUS_IND is received.
       
  1713         iGsmMmCauseError = CMmStaticUtility::EpocErrorCode(
       
  1714             KErrGeneral, KErrGsmCSConnectionBarred );
       
  1715         }
       
  1716 #endif // NCP_COMMON_CELLMO_BRANCH_SUPPORT == NCP_COMMON_CELLMO_BRANCH_0711
       
  1717     // No else
       
  1718     }
       
  1719 
       
  1720 // -----------------------------------------------------------------------------
       
  1721 // CMmCallMessHandler::CallControlReq
       
  1722 // This method constructs call control (e.g. Hold, Swap, Split etc.) message.
       
  1723 // (other items were commented in a header).
       
  1724 // -----------------------------------------------------------------------------
       
  1725 //
       
  1726 void CMmCallMessHandler::CallControlReq(
       
  1727      TIsiSend* aCallReq,
       
  1728      TInt aIpc ) const
       
  1729     {
       
  1730 
       
  1731 TFLOGSTRING2("TSY: CMmCallMessHandler::CallControlReq. Ipc:%d",aIpc);
       
  1732 OstTrace1( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLCONTROLREQ, "CMmCallMessHandler::CallControlReq;aIpc=%d", aIpc );
       
  1733 
       
  1734     TUint8 operation( 0 );
       
  1735 
       
  1736     switch ( aIpc )
       
  1737         {
       
  1738         case EMobileCallHold:
       
  1739             {
       
  1740             operation = CALL_MODEM_OP_HOLD;
       
  1741             break;
       
  1742             }
       
  1743         case EMobileCallResume:
       
  1744             {
       
  1745             operation = CALL_MODEM_OP_RETRIEVE;
       
  1746             break;
       
  1747             }
       
  1748         case EMobileCallSwap:
       
  1749             {
       
  1750             operation = CALL_MODEM_OP_SWAP;
       
  1751             break;
       
  1752             }
       
  1753         case EMobileCallTransfer:
       
  1754             {
       
  1755             operation = CALL_MODEM_OP_TRANSFER;
       
  1756             break;
       
  1757             }
       
  1758         case EMobileCallGoOneToOne:
       
  1759             {
       
  1760             operation = CALL_MODEM_OP_CONFERENCE_SPLIT;
       
  1761             break;
       
  1762             }
       
  1763         default:
       
  1764             {
       
  1765 TFLOGSTRING2("TSY: CMmCallMessHandler::CallControlReq - Unknown IPC: %d", aIpc);
       
  1766 OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CALLCONTROLREQ, "CMmCallMessHandler::CallControlReq - Unknown aIpc=%d", aIpc );
       
  1767             break;
       
  1768             }
       
  1769         }
       
  1770 
       
  1771     // Call operation sub block, no operation info used
       
  1772     TBuf8< SIZE_CALL_MODEM_SB_OPERATION > callOperationBuf( 0 );
       
  1773     TIsiSubBlock callOperationSb(
       
  1774         callOperationBuf,
       
  1775         CALL_MODEM_SB_OPERATION,
       
  1776         EIsiSubBlockTypeId8Len8 );
       
  1777 
       
  1778     // Initialize message offset
       
  1779     TInt currentMsgOffset(
       
  1780         ISI_HEADER_SIZE + CALL_MODEM_CONTROL_REQ_OFFSET_OPERATION );
       
  1781 
       
  1782     callOperationBuf.Append( operation );
       
  1783     callOperationBuf.Append( KCallPadding ); // Operation info
       
  1784 
       
  1785     aCallReq->CopyData( currentMsgOffset,
       
  1786         callOperationSb.CompleteSubBlock() );
       
  1787 
       
  1788     // Set number of subblocs in CALL_MODEM_RELEASE_REQ message
       
  1789     aCallReq->Set8bit(
       
  1790         ISI_HEADER_SIZE + CALL_MODEM_CONTROL_REQ_OFFSET_SUBBLOCKS,
       
  1791         1 );
       
  1792     }
       
  1793 
       
  1794 // -----------------------------------------------------------------------------
       
  1795 // CMmCallMessHandler::GetCallCreateReqSubBlock
       
  1796 // This method constructs a subblock for the Dial request.
       
  1797 // (other items were commented in a header).
       
  1798 // -----------------------------------------------------------------------------
       
  1799 //
       
  1800 void CMmCallMessHandler::GetCallCreateReqSubBlock(
       
  1801     TUint8 aMode,
       
  1802     const TDesC16& aTelNumber,
       
  1803     RMobileCall::TMobileCallIdRestriction aIdRestrict,
       
  1804     TIsiSend& aCallIsiMsg,
       
  1805     TUint8& aNumOfSbInMsg,
       
  1806     TInt& aCurrentMsgOffset )
       
  1807     {
       
  1808 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock");
       
  1809 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock" );
       
  1810 
       
  1811     iDestPostAddressIncluded = EFalse;
       
  1812 
       
  1813     // CALL_MODEM_SB_MODE subblock
       
  1814     TBuf8<SIZE_CALL_MODEM_SB_MODE> callModeBuf;
       
  1815 
       
  1816     TIsiSubBlock callModeSb( callModeBuf, CALL_MODEM_SB_MODE, EIsiSubBlockTypeId8Len8 );
       
  1817 
       
  1818     // Call mode
       
  1819     callModeBuf.Append( aMode );
       
  1820 
       
  1821     // CALL_MODEM_MODE_INFO must be zero
       
  1822     callModeBuf.Append( KCallPadding ); // Padding
       
  1823 
       
  1824     // Add call mode subblock
       
  1825     aCallIsiMsg.CopyData( aCurrentMsgOffset, callModeSb.CompleteSubBlock() );
       
  1826 
       
  1827     // Set new offset and increase subblock count
       
  1828     aCurrentMsgOffset = aCurrentMsgOffset + SIZE_CALL_MODEM_SB_MODE;
       
  1829     aNumOfSbInMsg++;
       
  1830 
       
  1831 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_MODE CREATED");
       
  1832     OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_MODE CREATED" );
       
  1833 
       
  1834     if ( CALL_MODEM_MODE_EMERGENCY == aMode && 0 < aTelNumber.Length() )
       
  1835         {
       
  1836         // Create destination address subblock. Size of data buffer
       
  1837         // "max length of destination address" + "message data"
       
  1838         TBuf8<SIZE_CALL_MODEM_SB_DESTINATION_ADDRESS + KAddressSubBlockMaxLength>
       
  1839             destinationAddressBuf;
       
  1840         TIsiSubBlock destinationAddressSb(
       
  1841             destinationAddressBuf,
       
  1842             CALL_MODEM_SB_DESTINATION_ADDRESS,
       
  1843             EIsiSubBlockTypeId8Len8 );
       
  1844 
       
  1845         // Address type
       
  1846         destinationAddressBuf.Append( CALL_MODEM_NBR_PLAN_ISDN_TELEPHONY );
       
  1847         // Byte not used
       
  1848         destinationAddressBuf.Append( KCallPadding ); // Padding
       
  1849         // Padding byte
       
  1850         destinationAddressBuf.Append( KCallPadding ); // Padding
       
  1851         // Amounth of characters
       
  1852         destinationAddressBuf.Append( aTelNumber.Length() );
       
  1853 
       
  1854         // Add the number string
       
  1855         TIsiUtility::CopyToBigEndian( aTelNumber, destinationAddressBuf );
       
  1856 
       
  1857         aCallIsiMsg.CopyData(
       
  1858             aCurrentMsgOffset, destinationAddressSb.CompleteSubBlock() );
       
  1859 
       
  1860         // Set new offset and increase subblock count
       
  1861         aCurrentMsgOffset =
       
  1862             aCurrentMsgOffset + destinationAddressBuf.Length();
       
  1863         aNumOfSbInMsg++;
       
  1864 
       
  1865 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_DESTINATION_ADDRESS - Subblock Count:  %d", aNumOfSbInMsg );
       
  1866 OstTraceExt1( TRACE_NORMAL, DUP17_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock- CALL_MODEM_SB_DESTINATION_ADDRESS - Subblock Count=%hhu", aNumOfSbInMsg );
       
  1867 
       
  1868 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - emergDestAddress: %S", &aTelNumber);
       
  1869 OstTraceExt1( TRACE_NORMAL, DUP18_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock;emergDestAddress=%S", aTelNumber );
       
  1870 
       
  1871         }
       
  1872 
       
  1873     else if ( CALL_MODEM_MODE_EMERGENCY != aMode && 0 < aTelNumber.Length() )
       
  1874         {
       
  1875         // Get length of the given number
       
  1876         TInt telNumLength( aTelNumber.Length() );
       
  1877         TUint8 presentationInd( CALL_MODEM_PRESENT_DEFAULT );
       
  1878 
       
  1879 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - aIdRestrict: %d", aIdRestrict);
       
  1880 OstTrace1( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock;aIdRestrict=%d", aIdRestrict );
       
  1881 
       
  1882         if ( KTelephonyNumberMaxLength < telNumLength )
       
  1883             {
       
  1884             telNumLength = KTelephonyNumberMaxLength;
       
  1885             }
       
  1886 
       
  1887         TBool internationalAddr( EFalse );
       
  1888         TBool postAddressSupported( EFalse );
       
  1889         TBool preAddressSupported( EFalse );
       
  1890         TInt preAddressLength( 0 );
       
  1891         TInt destAddressStarts( 0 );
       
  1892         TInt postAddressStarts( 0 );
       
  1893 
       
  1894         // Destination address max length can be KTelephonyNumberMaxLength
       
  1895         TBuf16<KTelephonyNumberMaxLength> destAddress;
       
  1896 
       
  1897         // Check prefix address
       
  1898         if ( 0 < telNumLength &&
       
  1899             ( '*' == ( aTelNumber )[0] || '#' == ( aTelNumber )[0] ) )
       
  1900             {
       
  1901             for ( TInt i ( 1 ); i < telNumLength; i++ )
       
  1902                 {
       
  1903                 if ( 'p' == ( aTelNumber )[i] )
       
  1904                     {
       
  1905                     // Post address starts
       
  1906                     break; // Exit for loop
       
  1907                     }
       
  1908                 else if ( '#' == ( aTelNumber )[i] )
       
  1909                     {
       
  1910                     preAddressLength = i + 1;
       
  1911                     }
       
  1912                 // No else
       
  1913                 }
       
  1914             }
       
  1915         // No else
       
  1916 
       
  1917         // Check if there is calling line identification restriction prefix in
       
  1918         // the telephony number. Destination pre address subblock will be
       
  1919         // created only for *31# and #31# commands.
       
  1920         if ( KPreAddressLength == preAddressLength &&
       
  1921              '3' == ( aTelNumber )[1] &&
       
  1922              '1' == ( aTelNumber )[2] &&
       
  1923              '#' == ( aTelNumber )[3] )
       
  1924             {
       
  1925             preAddressSupported = ETrue;
       
  1926             destAddressStarts = KPreAddressLength;
       
  1927 
       
  1928             // Set presentationInd based on prefix
       
  1929             if ( '*' == ( aTelNumber )[0] )
       
  1930                 {
       
  1931                 presentationInd = CALL_MODEM_PRESENT_ALLOWED;
       
  1932 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by PREFIX = CALL_MODEM_PRESENT_ALLOWED");
       
  1933 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by PREFIX = CALL_MODEM_PRESENT_ALLOWED" );
       
  1934                 }
       
  1935             else if ( '#' == ( aTelNumber )[0] )
       
  1936                 {
       
  1937                 presentationInd = CALL_MODEM_PRESENT_RESTRICTED;
       
  1938 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by PREFIX = CALL_MODEM_PRESENT_RESTRICTED");
       
  1939 OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by PREFIX = CALL_MODEM_PRESENT_RESTRICTED" );
       
  1940                 }
       
  1941             }
       
  1942         else
       
  1943             {
       
  1944             // Set presentationInd based on aIdRestrict
       
  1945             switch ( aIdRestrict )
       
  1946                 {
       
  1947                 case RMobileCall::ESendMyId:
       
  1948                     {
       
  1949                     presentationInd = CALL_MODEM_PRESENT_ALLOWED; //0x01
       
  1950 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by aIdRestrict = CALL_MODEM_PRESENT_ALLOWED");
       
  1951 OstTrace0( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by aIdRestrict = CALL_MODEM_PRESENT_ALLOWED" );
       
  1952                     break;
       
  1953                     }
       
  1954                 case RMobileCall::EDontSendMyId:
       
  1955                     {
       
  1956                     presentationInd = CALL_MODEM_PRESENT_RESTRICTED; //0x02
       
  1957 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by aIdRestrict = CALL_MODEM_PRESENT_RESTRICTED");
       
  1958 OstTrace0( TRACE_NORMAL, DUP6_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by aIdRestrict = CALL_MODEM_PRESENT_RESTRICTED" );
       
  1959                     break;
       
  1960                     }
       
  1961                 case RMobileCall::EIdRestrictDefault:
       
  1962                 default:
       
  1963                     {
       
  1964                     presentationInd = CALL_MODEM_PRESENT_DEFAULT; //0x00
       
  1965 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by aIdRestrict = CALL_MODEM_PRESENT_DEFAULT");
       
  1966 OstTrace0( TRACE_NORMAL, DUP7_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock -- presentationInd by aIdRestrict = CALL_MODEM_PRESENT_DEFAULT" );
       
  1967                     break;
       
  1968                     }
       
  1969                 }
       
  1970             }
       
  1971 
       
  1972         if ( CALL_MODEM_PRESENT_DEFAULT != presentationInd )
       
  1973             {
       
  1974 
       
  1975 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock -- Create line id sub block");
       
  1976 OstTrace0( TRACE_NORMAL, DUP8_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock -- Create line id sub block" );
       
  1977 // Create CALL_MODEM_SB_LINE_ID subblock.
       
  1978 
       
  1979             TBuf8<SIZE_CALL_MODEM_SB_LINE_ID> lineIdBuf( 0 );
       
  1980             TIsiSubBlock lineIdSb(
       
  1981                 lineIdBuf,
       
  1982                 CALL_MODEM_SB_LINE_ID,
       
  1983                 EIsiSubBlockTypeId8Len8 );
       
  1984 
       
  1985             lineIdBuf.Append( presentationInd );
       
  1986             lineIdBuf.Append( KCallPadding ); //Filler
       
  1987 
       
  1988             aCallIsiMsg.CopyData(
       
  1989                 aCurrentMsgOffset, lineIdSb.CompleteSubBlock() );
       
  1990 
       
  1991             // Set new offset and increase subblock count
       
  1992             aCurrentMsgOffset =
       
  1993                 aCurrentMsgOffset + lineIdBuf.Length();
       
  1994             aNumOfSbInMsg++;
       
  1995 
       
  1996 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_LINE_ID - Subblock Count:  %d", aNumOfSbInMsg );
       
  1997 OstTrace1( TRACE_NORMAL, DUP19_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_LINE_ID - Subblock Count:%d", aNumOfSbInMsg );
       
  1998 
       
  1999             }
       
  2000         // No else
       
  2001 
       
  2002         // Check if there is post address
       
  2003         for ( TInt i( destAddressStarts ); i < telNumLength; i++ )
       
  2004             {
       
  2005             if ( 'p' == ( aTelNumber )[i] && preAddressLength <= i )
       
  2006                 {
       
  2007                 // Destination address ends and post address starts.
       
  2008                 postAddressSupported = ETrue;
       
  2009                 postAddressStarts = i;
       
  2010                 break; // Exit for loop
       
  2011                 }
       
  2012             else if ( '+' == ( aTelNumber )[i] && preAddressLength == i )
       
  2013                 {
       
  2014                 // Destination address part contains "+" character. For example
       
  2015                 // +35850123456 or *140#+35850123456. Don't add "+" char to the
       
  2016                 // destination address.
       
  2017                 internationalAddr = ETrue;
       
  2018                 }
       
  2019             else
       
  2020                 {
       
  2021                 destAddress.Append( ( TUint16 )( aTelNumber )[i] );
       
  2022                 }
       
  2023             }
       
  2024 
       
  2025         // Create destination address subblock. Size of data buffer
       
  2026         // "max length of destination address" + "message data"
       
  2027         TBuf8<SIZE_CALL_MODEM_SB_DESTINATION_ADDRESS + KAddressSubBlockMaxLength>
       
  2028             destinationAddressBuf;
       
  2029         TIsiSubBlock destinationAddressSb(
       
  2030             destinationAddressBuf,
       
  2031             CALL_MODEM_SB_DESTINATION_ADDRESS,
       
  2032             EIsiSubBlockTypeId8Len8 );
       
  2033 
       
  2034         if ( internationalAddr )
       
  2035             {
       
  2036             destinationAddressBuf.Append(
       
  2037                 CALL_MODEM_NBR_TYPE_INTERNATIONAL | CALL_MODEM_NBR_PLAN_ISDN_TELEPHONY );
       
  2038             }
       
  2039         else
       
  2040             {
       
  2041             destinationAddressBuf.Append( CALL_MODEM_NBR_PLAN_ISDN_TELEPHONY );
       
  2042             }
       
  2043 
       
  2044         // Byte not used
       
  2045         destinationAddressBuf.Append( KCallPadding ); // Padding
       
  2046         // Padding byte
       
  2047         destinationAddressBuf.Append( KCallPadding ); // Padding
       
  2048         // Amounth of characters
       
  2049         destinationAddressBuf.Append( destAddress.Length() );
       
  2050 
       
  2051         // Add the number string
       
  2052         TIsiUtility::CopyToBigEndian( destAddress, destinationAddressBuf );
       
  2053 
       
  2054         aCallIsiMsg.CopyData(
       
  2055             aCurrentMsgOffset, destinationAddressSb.CompleteSubBlock() );
       
  2056 
       
  2057         // Set new offset and increase subblock count
       
  2058         aCurrentMsgOffset =
       
  2059             aCurrentMsgOffset + destinationAddressBuf.Length();
       
  2060         aNumOfSbInMsg++;
       
  2061 
       
  2062 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_DESTINATION_ADDRESS - Subblock Count:  %d", aNumOfSbInMsg );
       
  2063 OstTraceExt1( TRACE_NORMAL, DUP10_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock- CALL_MODEM_SB_DESTINATION_ADDRESS - Subblock Count=%hhu", aNumOfSbInMsg );
       
  2064 
       
  2065 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - destAddress: %S", &destAddress);
       
  2066 OstTraceExt1( TRACE_NORMAL, DUP16_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock;destAddress=%S", destAddress );
       
  2067 
       
  2068         if ( preAddressSupported )
       
  2069             {
       
  2070             // Pre address length can be KTelephonyNumberMaxLength
       
  2071             TBuf16<KTelephonyNumberMaxLength> preAddress;
       
  2072 
       
  2073             // Create pre address subblock
       
  2074             TBuf8<SIZE_CALL_MODEM_SB_DESTINATION_PRE_ADDRESS +
       
  2075                 KTelephonyNumberMaxLength * 2> preAddressBuf;
       
  2076 
       
  2077             TIsiSubBlock preAddressSb(
       
  2078                 preAddressBuf,
       
  2079                 CALL_MODEM_SB_DESTINATION_PRE_ADDRESS,
       
  2080                 EIsiSubBlockTypeId8Len8 );
       
  2081 
       
  2082             preAddressBuf.Append( KCallPadding );
       
  2083             preAddressBuf.Append( preAddressLength );
       
  2084             for ( TInt i ( 0 ); i < preAddressLength; i++ )
       
  2085                 {
       
  2086                 preAddress.Append( ( TUint16 )( aTelNumber )[i] );
       
  2087                 }
       
  2088 
       
  2089             TIsiUtility::CopyToBigEndian( preAddress, preAddressBuf );
       
  2090 
       
  2091             aCallIsiMsg.CopyData(
       
  2092                 aCurrentMsgOffset,
       
  2093                 preAddressSb.CompleteSubBlock() );
       
  2094 
       
  2095             // Set new offset and increase subblock count
       
  2096             aCurrentMsgOffset =
       
  2097                 aCurrentMsgOffset + preAddressBuf.Length();
       
  2098             aNumOfSbInMsg++;
       
  2099 
       
  2100 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_DESTINATION_PRE_ADDRESS - Subblock Count:  %d", aNumOfSbInMsg );
       
  2101 OstTraceExt1( TRACE_NORMAL, DUP11_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock- CALL_MODEM_DESTINATION_PRE_ADDRESS - Subblock Count=%hhu", aNumOfSbInMsg );
       
  2102             }
       
  2103         // No else
       
  2104 
       
  2105         if ( postAddressSupported )
       
  2106             {
       
  2107             // Creates Post Address subblock
       
  2108             TInt postAddLength( telNumLength - postAddressStarts );
       
  2109 
       
  2110             // Post address length can be KTelephonyNumberMaxLength
       
  2111             TBuf16<KTelephonyNumberMaxLength> postAddress;
       
  2112 
       
  2113             // Size of data buffer is "max post address length" + "message data"
       
  2114             TBuf8<SIZE_CALL_MODEM_SB_DESTINATION_POST_ADDRESS +
       
  2115                 KTelephonyNumberMaxLength * 2> postAddressBuf;
       
  2116             TIsiSubBlock postAddressSb(
       
  2117                 postAddressBuf,
       
  2118                 CALL_MODEM_SB_DESTINATION_POST_ADDRESS,
       
  2119                 EIsiSubBlockTypeId8Len8 );
       
  2120 
       
  2121             postAddressBuf.Append( KCallPadding );
       
  2122             postAddressBuf.Append( ( TUint8 )postAddLength );
       
  2123 
       
  2124             for ( TInt i( postAddressStarts ); i < telNumLength; i++ )
       
  2125                 {
       
  2126                 postAddress.Append( ( TUint16 )( aTelNumber )[i] );
       
  2127                 }
       
  2128 
       
  2129             TIsiUtility::CopyToBigEndian( postAddress, postAddressBuf );
       
  2130 
       
  2131             aCallIsiMsg.CopyData(
       
  2132                 aCurrentMsgOffset,
       
  2133                 postAddressSb.CompleteSubBlock() );
       
  2134 
       
  2135             // Set new offset and increase subblock count
       
  2136             aCurrentMsgOffset =
       
  2137                 aCurrentMsgOffset + postAddressBuf.Length();
       
  2138             aNumOfSbInMsg++;
       
  2139 
       
  2140             // Destination post address included
       
  2141             iDestPostAddressIncluded = ETrue;
       
  2142 
       
  2143 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock  - CALL_MODEM_DESTINATION_POST_ADDRESS - Subblock Count:  %d", aNumOfSbInMsg );
       
  2144 OstTraceExt1( TRACE_NORMAL, DUP14_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock- CALL_MODEM_DESTINATION_POST_ADDRESS - Subblock Count=%hhu", aNumOfSbInMsg );
       
  2145             }
       
  2146         // No else
       
  2147 
       
  2148         // Subblock for user to user signaling (for skype service).
       
  2149         if ( 0 < iUusData.iUUI.Length() && 0 != iUusData.iServiceReq )
       
  2150             {
       
  2151 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock. Creating sb for UUS signaling");
       
  2152 OstTrace0( TRACE_NORMAL, DUP12_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock. Creating sb for UUS signaling" );
       
  2153 
       
  2154             TBuf8<KUserToUserSbMaxLength> userToUserBuf;
       
  2155             TBool validServiceType( ETrue );
       
  2156 
       
  2157             TIsiSubBlock userToUserSb(
       
  2158                 userToUserBuf,
       
  2159                 CALL_MODEM_SB_USER_TO_USER,
       
  2160                 EIsiSubBlockTypeId8Len8 );
       
  2161 
       
  2162             // Only UUS1 is supported
       
  2163             userToUserBuf.Append( CALL_MODEM_UUS_TYPE_UUS1 );
       
  2164 
       
  2165             switch( iUusData.iServiceReq )
       
  2166                 {
       
  2167                 case RMobileCall::KUUS1Implicit:
       
  2168                     {
       
  2169                     userToUserBuf.Append( CALL_MODEM_UUS_ACTIVATION_IMPLICIT );
       
  2170                     break;
       
  2171                     }
       
  2172                 default:
       
  2173                     {
       
  2174                     validServiceType = EFalse;
       
  2175 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock. switch UUS type case default. Illegal service req!");
       
  2176 OstTrace0( TRACE_NORMAL, DUP13_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock. Switch UUS type case default. Illegal service req!" );
       
  2177                     break;
       
  2178                     }
       
  2179                 }
       
  2180 
       
  2181             // Creating subblock if service type was ok
       
  2182             if ( validServiceType )
       
  2183                 {
       
  2184                 userToUserBuf.Append( iUusData.iUUI.Length() );
       
  2185 
       
  2186                 // Copying lower bytes of 16-bit data as 8-bit data field of isi msg.
       
  2187                 // So, higher bytes will be discarded.
       
  2188                 // (due to iUUI is TMobileCallUUI, which is 16-bit TBuf)
       
  2189                 for ( TInt i( 0 ); i < iUusData.iUUI.Length(); i++ )
       
  2190                     {
       
  2191                     userToUserBuf.Append( iUusData.iUUI[i] );
       
  2192                     }
       
  2193 
       
  2194                 aCallIsiMsg.CopyData(
       
  2195                         aCurrentMsgOffset,
       
  2196                         userToUserSb.CompleteSubBlock() );
       
  2197 
       
  2198                 // Set new offset and increase subblock count
       
  2199                 aCurrentMsgOffset = aCurrentMsgOffset + userToUserBuf.Length();
       
  2200 
       
  2201                 aNumOfSbInMsg++;
       
  2202 
       
  2203 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_USER_TO_USER - Subblock Count: %d", aNumOfSbInMsg );
       
  2204                 OstTraceExt1( TRACE_NORMAL, DUP15_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock- CALL_MODEM_SB_USER_TO_USER - Subblock Count=%hhu", aNumOfSbInMsg );
       
  2205                 }
       
  2206 
       
  2207             // Reset data
       
  2208             iUusData.iUUI.Zero();
       
  2209             iUusData.iServiceReq = 0;
       
  2210             }
       
  2211         if ( iNoFdnDial )
       
  2212             {
       
  2213 TFLOGSTRING("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock -- Create check info sub block");
       
  2214 OstTrace0( TRACE_NORMAL, DUP9_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock -- Create check info sub block" );
       
  2215 
       
  2216             // Create CALL_MODEM_SB_LINE_ID subblock.
       
  2217 
       
  2218             TBuf8<SIZE_CALL_MODEM_SB_CHECK_INFO> checkInfoBuf( 0 );
       
  2219 
       
  2220             TIsiSubBlock checkInfoSb(
       
  2221                 checkInfoBuf,
       
  2222                 CALL_MODEM_SB_CHECK_INFO,
       
  2223                 EIsiSubBlockTypeId8Len8 );
       
  2224 
       
  2225             checkInfoBuf.Append( CALL_MODEM_CHK_DISABLE_FDN );
       
  2226             checkInfoBuf.Append( KCallPadding ); //Filler
       
  2227 
       
  2228             aCallIsiMsg.CopyData(
       
  2229                             aCurrentMsgOffset, checkInfoSb.CompleteSubBlock() );
       
  2230 
       
  2231             // Set new offset and increase subblock count
       
  2232             aCurrentMsgOffset =
       
  2233                             aCurrentMsgOffset + checkInfoBuf.Length();
       
  2234             aNumOfSbInMsg++;
       
  2235 
       
  2236 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_CHECK_INFO - Subblock Count:  %d", aNumOfSbInMsg );
       
  2237 OstTraceExt1( TRACE_NORMAL, DUP21_CMMCALLMESSHANDLER_GETCALLCREATEREQSUBBLOCK, "CMmCallMessHandler::GetCallCreateReqSubBlock - CALL_MODEM_SB_CHECK_INFO - Subblock Count=%hhu", aNumOfSbInMsg );
       
  2238 
       
  2239             }
       
  2240         }
       
  2241     // No else
       
  2242     }
       
  2243 
       
  2244 // -----------------------------------------------------------------------------
       
  2245 // CMmCallMessHandler::CallControlResp
       
  2246 // This method breaks the result of the Call Control request. In case of
       
  2247 // failure the appropriate control operation (e.g. hold, swap, split) will be
       
  2248 // completed
       
  2249 // (other items were commented in a header).
       
  2250 // -----------------------------------------------------------------------------
       
  2251 //
       
  2252 void CMmCallMessHandler::CallControlResp(
       
  2253     const TIsiReceiveC &aIsiMessage ) const
       
  2254     {
       
  2255 TFLOGSTRING("TSY: CMmCallMessHandler::CallControlResp");
       
  2256 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLCONTROLRESP, "CMmCallMessHandler::CallControlResp" );
       
  2257 
       
  2258     TUint sbStartOffSet( 0 );
       
  2259 
       
  2260     // Get call operation sub block
       
  2261     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2262         ISI_HEADER_SIZE + CALL_MODEM_CONTROL_RESP_OFFSET_OPERATION,
       
  2263         CALL_MODEM_SB_OPERATION,
       
  2264         EIsiSubBlockTypeId8Len8,
       
  2265         sbStartOffSet ) )
       
  2266         {
       
  2267         TUint8 operation( aIsiMessage.Get8bit(
       
  2268             sbStartOffSet + CALL_MODEM_SB_OPERATION_OFFSET_OPERATION ) );
       
  2269 
       
  2270         if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2271             ISI_HEADER_SIZE + SIZE_CALL_MODEM_CONTROL_RESP,
       
  2272             CALL_MODEM_SB_CAUSE,
       
  2273             EIsiSubBlockTypeId8Len8,
       
  2274             sbStartOffSet ) )
       
  2275             {
       
  2276             // Get call cause type
       
  2277             TUint8 causeType( aIsiMessage.Get8bit(
       
  2278                 sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE ) );
       
  2279 
       
  2280             // Get call cause value
       
  2281             TUint8 causeValue( aIsiMessage.Get8bit(
       
  2282                 sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE ) );
       
  2283 
       
  2284             TInt errorCode( CMmStaticUtility::CSCauseToEpocError(
       
  2285                 PN_MODEM_CALL,
       
  2286                 causeType,
       
  2287                 causeValue ) );
       
  2288 
       
  2289             TInt ipc( 0 );
       
  2290 
       
  2291             switch( operation )
       
  2292                 {
       
  2293                 case CALL_MODEM_OP_HOLD:
       
  2294                     {
       
  2295                     // Complete the failed hold operation
       
  2296                     ipc = EMobileCallHold;
       
  2297                     break;
       
  2298                     }
       
  2299                 case CALL_MODEM_OP_RETRIEVE:
       
  2300                     {
       
  2301                     // Complete the failed retrieve operation
       
  2302                     ipc = EMobileCallResume;
       
  2303                     break;
       
  2304                     }
       
  2305                 case CALL_MODEM_OP_SWAP:
       
  2306                     {
       
  2307                     // Complete the failed swap operation
       
  2308                     ipc = EMobileCallSwap;
       
  2309                     break;
       
  2310                     }
       
  2311                 case CALL_MODEM_OP_CONFERENCE_SPLIT:
       
  2312                     {
       
  2313                     // Complete the failed split operation
       
  2314                     ipc = EMobileCallGoOneToOne;
       
  2315                     break;
       
  2316                     }
       
  2317                 case CALL_MODEM_OP_TRANSFER:
       
  2318                     {
       
  2319                     ipc = EMobileCallTransfer;
       
  2320                     // In case not allowed complete with KErrNone
       
  2321                     if ( CALL_MODEM_CAUSE_NOT_ALLOWED == causeValue )
       
  2322                         {
       
  2323                         errorCode = CMmStaticUtility::EpocErrorCode(
       
  2324                             KErrNotReady,
       
  2325                             KErrNotFound );
       
  2326                         }
       
  2327                     // No else
       
  2328                     break;
       
  2329                     }
       
  2330                 case CALL_MODEM_OP_CONFERENCE_BUILD:
       
  2331                 default:
       
  2332                     {
       
  2333 TFLOGSTRING2("TSY: CMmCallMessHandler::CallControlResp - Not supported operation: %d", operation);
       
  2334 OstTraceExt1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CALLCONTROLRESP, "CMmCallMessHandler::CallControlResp - Not supported operation=%hhu", operation );
       
  2335                     break;
       
  2336                     }
       
  2337                 }
       
  2338 
       
  2339             // Complete the failed operation
       
  2340             if ( 0 != ipc )
       
  2341                 {
       
  2342                 // Unique call id (without possible generic id)
       
  2343                 // (three bits (1-3) contain unique call ID)
       
  2344                 TInt callId( static_cast<TInt>( aIsiMessage.Get8bit(
       
  2345                     ISI_HEADER_SIZE + CALL_MODEM_CONTROL_RESP_OFFSET_CALLID )
       
  2346                         & KMaskBits1to3 ) );
       
  2347 
       
  2348                 // Create call package
       
  2349                 CCallDataPackage callData;
       
  2350                 // Pack the data for sending to the manager
       
  2351                 callData.SetCallIdAndMode(
       
  2352                     callId,
       
  2353                     RMobilePhone::EVoiceService );
       
  2354 
       
  2355                 // Complete failed request
       
  2356                 iMessageRouter->Complete( ipc, &callData, errorCode );
       
  2357                 }
       
  2358             // No else
       
  2359             }
       
  2360          // No else
       
  2361         }
       
  2362     // No else
       
  2363     }
       
  2364 
       
  2365 // -----------------------------------------------------------------------------
       
  2366 // CMmCallMessHandler::GetSatOriginatedSubBlocks
       
  2367 // This method constructs Sim Application Toolkit related subblock for the Dial
       
  2368 // request containing bearer and subaddress information.
       
  2369 // (other items were commented in a header).
       
  2370 // -----------------------------------------------------------------------------
       
  2371 //
       
  2372 #if ( NCP_COMMON_S60_VERSION_SUPPORT >= S60_VERSION_50 )
       
  2373 void CMmCallMessHandler::GetSatOriginatedSubBlocks(
       
  2374     TIsiSend& aCallIsiMsg,
       
  2375     TUint8& aNumOfSbInMsg,
       
  2376     TInt& aCurrentMsgOffset ) const
       
  2377     {
       
  2378 TFLOGSTRING("TSY: CMmCallMessHandler::GetSatOriginatedSubBlocks");
       
  2379 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_GETSATORIGINATEDSUBBLOCKS, "TSY: CMmCallMessHandler::GetSatOriginatedSubBlocks" );
       
  2380 
       
  2381     //Creates sub address sub block
       
  2382     if ( 0 != iSubAddress.Length() )
       
  2383         {
       
  2384         //Length of message data is max address length + message
       
  2385         TBuf8<KAddressSubBlockMaxLength> subAddressBuf( 0 );
       
  2386 
       
  2387         TIsiSubBlock callDestCsAddressSb( subAddressBuf,
       
  2388             CALL_MODEM_SB_DESTINATION_CS_ADDRESS, EIsiSubBlockTypeId8Len8 );
       
  2389 
       
  2390         //Fillers
       
  2391         subAddressBuf.Append( KCallPadding );
       
  2392         subAddressBuf.Append( KCallPadding );
       
  2393         subAddressBuf.Append( KCallPadding );
       
  2394 
       
  2395         // Called Party Number length
       
  2396         subAddressBuf.Append( iSubAddress.Length() );
       
  2397 
       
  2398         // Copy 16 to 8
       
  2399         TIsiUtility::CopyToBigEndian( iSubAddress, subAddressBuf );
       
  2400 
       
  2401         aCallIsiMsg.CopyData( aCurrentMsgOffset,
       
  2402             callDestCsAddressSb.CompleteSubBlock() );
       
  2403 
       
  2404         // Set new offset and increase subblock count
       
  2405         aCurrentMsgOffset =
       
  2406             aCurrentMsgOffset + subAddressBuf.Length();
       
  2407         aNumOfSbInMsg++;
       
  2408         }
       
  2409      //no else
       
  2410 
       
  2411     //Creates bearer capabilities sub block
       
  2412     if ( 0 != iBearer.Length() )
       
  2413         {
       
  2414 
       
  2415         TBuf8<KAddressSubBlockMaxLength> callGsmCcpBuf( 0 );
       
  2416         TIsiSubBlock callGsmCcpSb( callGsmCcpBuf,
       
  2417             CALL_MODEM_SB_BC, EIsiSubBlockTypeId8Len8 );
       
  2418 
       
  2419         //aBearer includes length and data bytes, so no need to add length separately
       
  2420         callGsmCcpBuf.Append( iBearer );
       
  2421 
       
  2422         aCallIsiMsg.CopyData( aCurrentMsgOffset,
       
  2423             callGsmCcpSb.CompleteSubBlock() );
       
  2424 
       
  2425         // Set new offset and increase subblock count
       
  2426         aCurrentMsgOffset =
       
  2427             aCurrentMsgOffset + callGsmCcpBuf.Length();
       
  2428         aNumOfSbInMsg++;
       
  2429         }
       
  2430     //no else
       
  2431     }
       
  2432 
       
  2433 #else
       
  2434 
       
  2435 void CMmCallMessHandler::GetSatOriginatedSubBlocks(
       
  2436     const TBuf<KSubAddressSize>& aSubAddress,
       
  2437     TBuf8<KBearerCapabilitySize>& aBearer,
       
  2438     TIsiSend& aCallIsiMsg,
       
  2439     TUint8& aNumOfSbInMsg,
       
  2440     TInt& aCurrentMsgOffset ) const
       
  2441     {
       
  2442 TFLOGSTRING("TSY: CMmCallMessHandler::GetSatOriginatedSubBlocks");
       
  2443 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_GETSATORIGINATEDSUBBLOCKS, "CMmCallMessHandler::GetSatOriginatedSubBlocks" );
       
  2444 
       
  2445     // Creates sub address sub block
       
  2446     if ( 0 != aSubAddress.Length() )
       
  2447         {
       
  2448         // Length of message data is max address length + message
       
  2449         TBuf8<KAddressSubBlockMaxLength> subAddressBuf( 0 );
       
  2450 
       
  2451         TIsiSubBlock callDestCsAddressSb(
       
  2452             subAddressBuf,
       
  2453             CALL_MODEM_DESTINATION_CS_ADDRESS,
       
  2454             EIsiSubBlockTypeId8Len8 );
       
  2455 
       
  2456         // Replace Destination Address
       
  2457         subAddressBuf.Append( KCallPadding );
       
  2458         subAddressBuf.Append( KCallPadding );
       
  2459         subAddressBuf.Append( KCallPadding );
       
  2460 
       
  2461         // Called Party Number length
       
  2462         subAddressBuf.Append( aSubAddress.Length() );
       
  2463 
       
  2464         // Copy 16 to 8
       
  2465         TIsiUtility::CopyToBigEndian( aSubAddress, subAddressBuf );
       
  2466 
       
  2467         aCallIsiMsg.CopyData(
       
  2468             aCurrentMsgOffset,
       
  2469             callDestCsAddressSb.CompleteSubBlock() );
       
  2470 
       
  2471         // Set new offset and increase subblock count
       
  2472         aCurrentMsgOffset = aCurrentMsgOffset + subAddressBuf.Length();
       
  2473         aNumOfSbInMsg++;
       
  2474         }
       
  2475      // no else
       
  2476 
       
  2477     // Creates bearer capabilities sub block
       
  2478     if ( 0 != aBearer.Length() )
       
  2479         {
       
  2480         TBuf8<KAddressSubBlockMaxLength> callGsmCcpBuf( 0 );
       
  2481         TIsiSubBlock callGsmCcpSb(
       
  2482             callGsmCcpBuf,
       
  2483             CALL_MODEM_SB_BC,
       
  2484             EIsiSubBlockTypeId8Len8 );
       
  2485 
       
  2486         // aBearer includes length and data bytes,
       
  2487         // so no need to add length separately
       
  2488         callGsmCcpBuf.Append( aBearer );
       
  2489 
       
  2490         aCallIsiMsg.CopyData(
       
  2491             aCurrentMsgOffset,
       
  2492             callGsmCcpSb.CompleteSubBlock() );
       
  2493 
       
  2494         // Set new offset and increase subblock count
       
  2495         aCurrentMsgOffset = aCurrentMsgOffset + callGsmCcpBuf.Length();
       
  2496         aNumOfSbInMsg++;
       
  2497         }
       
  2498     // No else
       
  2499     }
       
  2500 #endif
       
  2501 
       
  2502 // -----------------------------------------------------------------------------
       
  2503 // CMmCallMessHandler::CallControlInd
       
  2504 // This method breaks the Call control indication message. In case of failure,
       
  2505 // the approproate control operation will be completed.
       
  2506 // (other items were commented in a header).
       
  2507 // -----------------------------------------------------------------------------
       
  2508 //
       
  2509 void CMmCallMessHandler::CallControlInd(
       
  2510     const TIsiReceiveC &aIsiMessage ) const
       
  2511     {
       
  2512     TInt errorCode( KErrNone );
       
  2513 
       
  2514     // Unique call id (without possible generic id)
       
  2515     // (three bits (1-3) contain unique call ID)
       
  2516     TInt callId( static_cast<TInt>( aIsiMessage.Get8bit(
       
  2517         ISI_HEADER_SIZE + CALL_MODEM_CONTROL_IND_OFFSET_CALLID )
       
  2518             & KMaskBits1to3 ) );
       
  2519 
       
  2520 TFLOGSTRING2("TSY: CMmCallMessHandler::CallControlInd, CallID: %d", callId);
       
  2521 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLCONTROLIND, "CMmCallMessHandler::CallControlInd" );
       
  2522 
       
  2523     TUint8 callOperation( 0 );
       
  2524     TUint sbStartOffSet( 0 );
       
  2525 
       
  2526     // Get call operation sub block
       
  2527     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2528         ISI_HEADER_SIZE + CALL_MODEM_CONTROL_IND_OFFSET_OPERATION,
       
  2529         CALL_MODEM_SB_OPERATION,
       
  2530         EIsiSubBlockTypeId8Len8,
       
  2531         sbStartOffSet ) )
       
  2532         {
       
  2533         // Get call operation
       
  2534         callOperation = aIsiMessage.Get8bit(
       
  2535             sbStartOffSet + CALL_MODEM_SB_OPERATION_OFFSET_OPERATION );
       
  2536         }
       
  2537     // No else
       
  2538 
       
  2539     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2540         ISI_HEADER_SIZE + SIZE_CALL_MODEM_CONTROL_IND,
       
  2541         CALL_MODEM_SB_CAUSE,
       
  2542         EIsiSubBlockTypeId8Len8,
       
  2543         sbStartOffSet ) )
       
  2544         {
       
  2545         TInt operation( 0 );
       
  2546 
       
  2547         // Get call cause type
       
  2548         TUint8 causeType( aIsiMessage.Get8bit(
       
  2549             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE ) );
       
  2550 
       
  2551         // Get call cause value
       
  2552         TUint8 causeValue( aIsiMessage.Get8bit(
       
  2553             sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE ) );
       
  2554 
       
  2555         // Map error value
       
  2556         errorCode = CMmStaticUtility::CSCauseToEpocError(
       
  2557             PN_MODEM_CALL,
       
  2558             causeType,
       
  2559             causeValue );
       
  2560 
       
  2561         switch( callOperation )
       
  2562             {
       
  2563             // Complete the hold operation
       
  2564             case CALL_MODEM_OP_HOLD:
       
  2565                 {
       
  2566                 operation = EMobileCallHold;
       
  2567                 break;
       
  2568                 }
       
  2569             // Complete the resume operation
       
  2570             case CALL_MODEM_OP_RETRIEVE:
       
  2571                 {
       
  2572                 operation = EMobileCallResume;
       
  2573                 break;
       
  2574                 }
       
  2575             case CALL_MODEM_OP_SWAP:
       
  2576                 {
       
  2577                 operation = EMobileCallSwap;
       
  2578                 break;
       
  2579                 }
       
  2580             case CALL_MODEM_OP_CONFERENCE_SPLIT:
       
  2581                 {
       
  2582                 operation = EMobileCallGoOneToOne;
       
  2583                 break;
       
  2584                 }
       
  2585             case CALL_MODEM_OP_TRANSFER:
       
  2586                 {
       
  2587                 operation = EMobileCallTransfer;
       
  2588                 break;
       
  2589                 }
       
  2590             default:
       
  2591                 {
       
  2592 TFLOGSTRING2("TSY: CMmCallMessHandler::CallControlInd - Not supported operation: %d", operation);
       
  2593 OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CALLCONTROLIND, "CMmCallMessHandler::CallControlInd - Not supported operation=%d", operation );
       
  2594                 break;
       
  2595                 }
       
  2596             }
       
  2597         CCallDataPackage callPackage;
       
  2598         callPackage.SetCallIdAndMode(
       
  2599             callId,
       
  2600             RMobilePhone::EServiceUnspecified );
       
  2601 
       
  2602         if ( 0 != operation )
       
  2603             {
       
  2604             // Unique call id (without possible generic id)
       
  2605             //( three bits (1-3) contain unique call ID)
       
  2606             callId = static_cast<TInt>( aIsiMessage.Get8bit(
       
  2607                 ISI_HEADER_SIZE + CALL_MODEM_CONTROL_IND_OFFSET_CALLID )
       
  2608                     & KMaskBits1to3 );
       
  2609 
       
  2610             // Create call package
       
  2611             CCallDataPackage callData;
       
  2612             // Pack the data for sending to the manager
       
  2613             callData.SetCallIdAndMode( callId, RMobilePhone::EVoiceService );
       
  2614 
       
  2615             // Complete failed request
       
  2616             iMessageRouter->Complete( operation, &callData, errorCode );
       
  2617             }
       
  2618         // No else
       
  2619         }
       
  2620     // No else
       
  2621     }
       
  2622 
       
  2623 // -----------------------------------------------------------------------------
       
  2624 // CMmCallMessHandler::CallGsmNotificationInd
       
  2625 // This method breaks the GSM notification indication that contains information
       
  2626 // about remote events occurred (remote hold, resume, transfer or conference)
       
  2627 // or about call forwarding (MT only).
       
  2628 // (other items were commented in a header).
       
  2629 // -----------------------------------------------------------------------------
       
  2630 //
       
  2631 void CMmCallMessHandler::CallGsmNotificationInd(
       
  2632     const TIsiReceiveC &aIsiMessage )
       
  2633     {
       
  2634     RMobileCall::TMobileCallEvent callEvent( RMobileCall::ERemoteHold );
       
  2635 
       
  2636     // Create call property get response
       
  2637     // Get call id, (three bits (1-3) contain unique call ID)
       
  2638     TInt callId( static_cast<TInt>( aIsiMessage.Get8bit(
       
  2639         ISI_HEADER_SIZE + CALL_MODEM_NOTIFICATION_IND_OFFSET_CALLID )
       
  2640             & KMaskBits1to3 ) );
       
  2641 
       
  2642 TFLOGSTRING2("TSY: CMmCallMessHandler::CallGsmNotificationInd. CallId:%d",callId);
       
  2643 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLGSMNOTIFICATIONIND, "CMmCallMessHandler::CallGsmNotificationInd" );
       
  2644 
       
  2645     CCallDataPackage callDataPackage;
       
  2646 
       
  2647     TUint sbStartOffSet( 0 );
       
  2648 
       
  2649     // Check for CallGsmSsHoldIndicator sub block
       
  2650     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2651         ISI_HEADER_SIZE + SIZE_CALL_MODEM_NOTIFICATION_IND,
       
  2652         CALL_MODEM_SB_SS_HOLD_INDICATOR,
       
  2653         EIsiSubBlockTypeId8Len8,
       
  2654         sbStartOffSet ) )
       
  2655         {
       
  2656         // Get the hold indicator information from sub block
       
  2657         TUint8 holdIndicator( aIsiMessage.Get8bit(
       
  2658             sbStartOffSet +
       
  2659                 CALL_MODEM_SB_SS_HOLD_INDICATOR_OFFSET_SSHOLDINDICATOR ) );
       
  2660 
       
  2661         // If remote hold, complete event to client
       
  2662         if ( CALL_MODEM_HOLD_IND_ON_HOLD == holdIndicator )
       
  2663             {
       
  2664             callEvent = RMobileCall::ERemoteHold;
       
  2665             }
       
  2666         // Else if remote resume, complete event to client
       
  2667         else if ( CALL_MODEM_HOLD_IND_RETRIEVED == holdIndicator )
       
  2668             {
       
  2669             callEvent = RMobileCall::ERemoteResume;
       
  2670             }
       
  2671         // No else
       
  2672 
       
  2673         // Pack the data for sending to the manager
       
  2674         callDataPackage.SetCallIdAndMode(
       
  2675             callId,
       
  2676             RMobilePhone::EServiceUnspecified );
       
  2677         callDataPackage.PackData( &callEvent );
       
  2678         iMessageRouter->Complete(
       
  2679             EMobileCallNotifyCallEvent,
       
  2680             &callDataPackage,
       
  2681             KErrNone );
       
  2682         }
       
  2683     // No else
       
  2684 
       
  2685     // Check for CallGsmSsEctIndicator sub block
       
  2686     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2687         ISI_HEADER_SIZE + SIZE_CALL_MODEM_NOTIFICATION_IND,
       
  2688         CALL_MODEM_SB_SS_ECT_INDICATOR,
       
  2689         EIsiSubBlockTypeId8Len8,
       
  2690         sbStartOffSet ) )
       
  2691         {
       
  2692         // Get the ectIndictor
       
  2693         TUint8 ectIndicator( aIsiMessage.Get8bit(
       
  2694             sbStartOffSet +
       
  2695                 CALL_MODEM_SB_SS_ECT_INDICATOR_OFFSET_SSECTINDICATOR ) );
       
  2696 
       
  2697         if ( CALL_MODEM_ECT_CALL_STATE_ACTIVE == ectIndicator )
       
  2698             {
       
  2699             callEvent = RMobileCall::ERemoteTransferring;
       
  2700             }
       
  2701         else // CALL_MODEM_ECT_CALL_STATE_ALERT or other, unknown value
       
  2702             {
       
  2703             callEvent = RMobileCall::ERemoteTransferAlerting;
       
  2704             }
       
  2705         // Pack the data for sending to the manager
       
  2706         callDataPackage.SetCallIdAndMode(
       
  2707             callId,
       
  2708             RMobilePhone::EServiceUnspecified);
       
  2709         callDataPackage.PackData( &callEvent );
       
  2710         iMessageRouter->Complete(
       
  2711             EMobileCallNotifyCallEvent,
       
  2712             &callDataPackage,
       
  2713             KErrNone );
       
  2714         }
       
  2715     // No else
       
  2716 
       
  2717     // Check for CallGsmSsNotifyIndicator sub block
       
  2718     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2719         ISI_HEADER_SIZE + SIZE_CALL_MODEM_NOTIFICATION_IND,
       
  2720         CALL_MODEM_SB_SS_NOTIFY_INDICATOR,
       
  2721         EIsiSubBlockTypeId8Len8,
       
  2722         sbStartOffSet ) )
       
  2723         {
       
  2724         // Get the multiparty indicator information from sub block
       
  2725         TUint8 SsIndicator( aIsiMessage.Get8bit(
       
  2726             sbStartOffSet +
       
  2727                 CALL_MODEM_SB_SS_NOTIFY_INDICATOR_OFFSET_SSINDICATOR ) );
       
  2728 
       
  2729         // We are only interested in the CALL_MODEM_SSI_MPTY bit of
       
  2730         // the CALL_MODEM_SS_INDICATOR bit field
       
  2731         if ( CALL_MODEM_SSI_MPTY & SsIndicator )
       
  2732             {
       
  2733             callEvent = RMobileCall::ERemoteConferenceCreate;
       
  2734             // Pack the data for sending to the manager
       
  2735             callDataPackage.SetCallIdAndMode(
       
  2736                 callId,
       
  2737                 RMobilePhone::EServiceUnspecified );
       
  2738             callDataPackage.PackData( &callEvent );
       
  2739             iMessageRouter->Complete(
       
  2740                 EMobileCallNotifyCallEvent,
       
  2741                 &callDataPackage,
       
  2742                 KErrNone );
       
  2743             }
       
  2744         // No else
       
  2745         }
       
  2746     // No else
       
  2747 
       
  2748     // Check call forwarding indicator (applies to MT calls only)
       
  2749     if ( callId == iIncomingCallInfo.iCallId )
       
  2750         {
       
  2751         // We are only interested in the CALL_MODEM_SSN_INCOMING_IS_FWD bit of
       
  2752         // the CALL_MODEM_SS_NOTIFICATION bit field
       
  2753 
       
  2754         // Check for CallModemSbSsNotify sub block
       
  2755         if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2756             ISI_HEADER_SIZE + SIZE_CALL_MODEM_NOTIFICATION_IND,
       
  2757             CALL_MODEM_SB_SS_NOTIFY,
       
  2758             EIsiSubBlockTypeId8Len8,
       
  2759             sbStartOffSet ) )
       
  2760             {
       
  2761             if ( CALL_MODEM_SSN_INCOMING_IS_FWD & aIsiMessage.Get8bit(
       
  2762                     sbStartOffSet +
       
  2763                         CALL_MODEM_SB_SS_NOTIFY_OFFSET_SSNOTIFICATION ) )
       
  2764                 {
       
  2765                 // This is a MT call that has been diverted to this phone
       
  2766                 iIncomingCallInfo.iForwarded = ETrue;
       
  2767                 iIncomingCallInfo.iValid |= RMobileCall::KCallForwarded;
       
  2768                 }
       
  2769             }
       
  2770         // No else
       
  2771         }
       
  2772     // No else
       
  2773 
       
  2774     // Get CALL_MODEM_SB_SS_CODE sub block
       
  2775     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2776         ISI_HEADER_SIZE + SIZE_CALL_MODEM_NOTIFICATION_IND,
       
  2777         CALL_MODEM_SB_SS_CODE,
       
  2778         EIsiSubBlockTypeId8Len8,
       
  2779         sbStartOffSet ) )
       
  2780         {
       
  2781         // Get mmi ss code
       
  2782         TUint16 mmiSsCode( aIsiMessage.Get16bit(
       
  2783             sbStartOffSet + CALL_MODEM_SB_SS_CODE_OFFSET_MMISSCODE ) );
       
  2784 
       
  2785         // Get call gsm ss status sub block
       
  2786         if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2787             ISI_HEADER_SIZE + SIZE_CALL_MODEM_NOTIFICATION_IND,
       
  2788             CALL_MODEM_SB_SS_STATUS,
       
  2789             EIsiSubBlockTypeId8Len8,
       
  2790             sbStartOffSet ) )
       
  2791             {
       
  2792             TUint8 ssStatus( aIsiMessage.Get8bit(
       
  2793                 sbStartOffSet + CALL_MODEM_SB_SS_STATUS_OFFSET_SSSTATUS ) );
       
  2794 
       
  2795             if ( ( ssStatus & CALL_MODEM_SS_STATUS_ACTIVE ) &&
       
  2796                 ( CALL_MODEM_SSC_ALL_FWDS == mmiSsCode ||
       
  2797                 CALL_MODEM_SSC_ALL_COND_FWD == mmiSsCode ||
       
  2798                 CALL_MODEM_SSC_CFU == mmiSsCode ||
       
  2799                 CALL_MODEM_SSC_CFB == mmiSsCode ||
       
  2800                 CALL_MODEM_SSC_CFNRY == mmiSsCode ||
       
  2801                 CALL_MODEM_SSC_CFGNC == mmiSsCode ) )
       
  2802                 {
       
  2803                 // If mmi ss code exists, it is a call forwarding code,
       
  2804                 // and the service is active, we have to trigger received
       
  2805                 // a call forwarding active notification
       
  2806 
       
  2807                 // Complete CallForwardingActive notification to SOS
       
  2808                 RMobilePhone::TMobilePhoneCFActive activeType;
       
  2809                 if ( CALL_MODEM_SSC_ALL_FWDS == mmiSsCode ||
       
  2810                     CALL_MODEM_SSC_CFU == mmiSsCode )
       
  2811                     {
       
  2812                     // Forwarding is unconditional
       
  2813                     activeType = RMobilePhone::ECFUnconditionalActive;
       
  2814                     }
       
  2815                 else
       
  2816                     {
       
  2817                     // Forwarding is conditional
       
  2818                     activeType = RMobilePhone::ECFConditionalActive;
       
  2819                     }
       
  2820 
       
  2821                 // Service group info not available => hard-coded
       
  2822                 RMobilePhone::TMobileService serviceGroup(
       
  2823                     RMobilePhone::EVoiceService );
       
  2824 
       
  2825                 CMmDataPackage dataPackage;
       
  2826                 dataPackage.PackData( &serviceGroup, &activeType );
       
  2827                 iMessageRouter->Complete(
       
  2828                     EMobilePhoneNotifyCallForwardingActive,
       
  2829                     &dataPackage,
       
  2830                     KErrNone );
       
  2831                 }
       
  2832             // No else
       
  2833             }
       
  2834         // No else
       
  2835         }
       
  2836     // No else
       
  2837 
       
  2838     // Read call origin info
       
  2839     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  2840         ISI_HEADER_SIZE + SIZE_CALL_MODEM_NOTIFICATION_IND,
       
  2841         CALL_MODEM_SB_ORIGIN_INFO,
       
  2842         EIsiSubBlockTypeId8Len8,
       
  2843         sbStartOffSet ) )
       
  2844         {
       
  2845 TFLOGSTRING("TSY: CMmCallMessHandler::CallGsmNotificationInd: CALL_MODEM_SB_ORIGIN_INFO subblock");
       
  2846 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CALLGSMNOTIFICATIONIND, "CMmCallMessHandler::CallGsmNotificationInd - CALL_MODEM_SB_ORIGIN_INFO subblock" );
       
  2847 
       
  2848         TBuf16<RMobileCall::KCallingNameSize> targetOrigName;
       
  2849         CCallDataPackage callData;
       
  2850 
       
  2851         // Update previously received incoming call info
       
  2852         if ( callId == iIncomingCallInfo.iCallId )
       
  2853             {
       
  2854             ReadCallInfo(
       
  2855                 iIncomingCallInfo,
       
  2856                 targetOrigName,
       
  2857                 aIsiMessage,
       
  2858                 sbStartOffSet );
       
  2859             // Call data package
       
  2860             callData.SetCallIdAndMode( callId, iIncomingCallInfo.iService );
       
  2861             callData.PackData( &iIncomingCallInfo );
       
  2862             }
       
  2863         // If incoming call info reseted already
       
  2864         else
       
  2865             {
       
  2866             RMobileCall::TMobileCallInfoV1 callInfo;
       
  2867             ReadCallInfo(
       
  2868                 callInfo,
       
  2869                 targetOrigName,
       
  2870                 aIsiMessage,
       
  2871                 sbStartOffSet );
       
  2872             // Call data package
       
  2873             callData.SetCallIdAndMode( callId, callInfo.iService );
       
  2874             callData.PackData( &callInfo );
       
  2875             }
       
  2876 
       
  2877         // COMPLETE MOBILE CALL INFO CHANGE
       
  2878         // (Get mobile call information is always completed
       
  2879         // before call status change)
       
  2880         iMessageRouter->Complete(
       
  2881             EMobileCallGetMobileCallInfo,
       
  2882             &callData,
       
  2883             KErrNone );
       
  2884         }
       
  2885     // No else
       
  2886     }
       
  2887 
       
  2888 // -----------------------------------------------------------------------------
       
  2889 // CMmCallMessHandler::FillModeData
       
  2890 // This method maps the Domestic OS call mode to the Symbian OS call mode and
       
  2891 // fills the information to the mobile call information package received as
       
  2892 // input parameter.
       
  2893 // (other items were commented in a header).
       
  2894 // -----------------------------------------------------------------------------
       
  2895 //
       
  2896 void CMmCallMessHandler::FillModeData(
       
  2897     RMobileCall::TMobileCallInfoV1& mobileCallInfo,
       
  2898     TUint8 aIsiCallMode ) const
       
  2899     {
       
  2900 TFLOGSTRING2("TSY: CMmCallMessHandler::FillModeData. callmode:%d",aIsiCallMode);
       
  2901 OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_FILLMODEDATA, "CMmCallMessHandler::FillModeData;aIsiCallMode=%hhu", aIsiCallMode );
       
  2902 
       
  2903     // Set service and alternating call mode in iMobileCallInfo
       
  2904     mobileCallInfo.iAlternatingCall =
       
  2905         RMobilePhone::EAlternatingModeUnspecified;
       
  2906     mobileCallInfo.iService = RMobilePhone::EServiceUnspecified;
       
  2907     mobileCallInfo.iEmergency = EFalse;
       
  2908 
       
  2909     switch ( aIsiCallMode )
       
  2910         {
       
  2911         case CALL_MODEM_MODE_SPEECH:
       
  2912             {
       
  2913             // Voice service
       
  2914             mobileCallInfo.iService = RMobilePhone::EVoiceService;
       
  2915             break;
       
  2916             }
       
  2917         case CALL_MODEM_MODE_EMERGENCY:
       
  2918             {
       
  2919             // Voice service
       
  2920             mobileCallInfo.iService = RMobilePhone::EVoiceService;
       
  2921             mobileCallInfo.iEmergency = ETrue;
       
  2922             break;
       
  2923             }
       
  2924         case CALL_MODEM_MODE_MULTIMEDIA:
       
  2925             {
       
  2926             // The line supports video connections.
       
  2927             mobileCallInfo.iService = RMobilePhone::ECircuitDataService;
       
  2928             break;
       
  2929             }
       
  2930         case CALL_MODEM_MODE_ALS_LINE_2:
       
  2931             {
       
  2932             // The line supports auxiliary voice call connections.
       
  2933             mobileCallInfo.iService = RMobilePhone::EAuxVoiceService;
       
  2934             break;
       
  2935             }
       
  2936         default:
       
  2937             {
       
  2938             TFLOGSTRING2("TSY: CMmCallMessHandler::FillModeData - Not supported ISA call mode: %d", aIsiCallMode);
       
  2939 OstTraceExt1( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_FILLMODEDATA, "CMmCallMessHandler::FillModeData - Not supported ISA call mode=%hhu", aIsiCallMode );
       
  2940             break;
       
  2941             }
       
  2942         }
       
  2943     }
       
  2944 
       
  2945 // -----------------------------------------------------------------------------
       
  2946 // CMmCallMessHandler::FillNumberPlanAndType
       
  2947 // This method maps the Domestic OS address type to the Symbian OS number plan
       
  2948 // and type and fills the information to the mobile call information package
       
  2949 // received as input parameter.
       
  2950 // (other items were commented in a header).
       
  2951 // -----------------------------------------------------------------------------
       
  2952 //
       
  2953 void CMmCallMessHandler::FillNumberPlanAndType(
       
  2954     RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  2955     TUint aOrigAddressType ) const
       
  2956     {
       
  2957     // Mask the nbrtype with 00001111 to get the number plan
       
  2958     //(four least significant bits (1-4) contain numbering plan)
       
  2959     TUint nbrplan( aOrigAddressType & KMaskBits1to4 );
       
  2960 
       
  2961 TFLOGSTRING2("TSY: CMmCallMessHandler::FillNumberPlanAndType. nbrplan (mask KMaskBits1to4) : %d",nbrplan);
       
  2962 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_FILLNUMBERPLANANDTYPE, "CMmCallMessHandler::FillNumberPlanAndType" );
       
  2963 
       
  2964     if ( RMobilePhone::EUnknownNumberingPlan ==
       
  2965         aMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan )
       
  2966         {
       
  2967 TFLOGSTRING("TSY: CMmCallMessHandler::FillNumberPlanAndType. EUnknownNumberingPlan");
       
  2968 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_FILLNUMBERPLANANDTYPE, "CMmCallMessHandler::FillNumberPlanAndType - EUnknownNumberingPlan" );
       
  2969 
       
  2970         if ( CALL_MODEM_NBR_PLAN_UNKNOWN == nbrplan )
       
  2971             {
       
  2972             aMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan =
       
  2973                 RMobilePhone::EUnknownNumberingPlan;
       
  2974             aMobileCallInfo.iDialledParty.iNumberPlan =
       
  2975                 RMobilePhone::EUnknownNumberingPlan;
       
  2976             }
       
  2977         else if ( CALL_MODEM_NBR_PLAN_ISDN_TELEPHONY == nbrplan )
       
  2978             {
       
  2979             aMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan =
       
  2980                 RMobilePhone::EIsdnNumberPlan;
       
  2981             aMobileCallInfo.iDialledParty.iNumberPlan =
       
  2982                 RMobilePhone::EIsdnNumberPlan;
       
  2983             }
       
  2984         else if ( CALL_MODEM_NBR_PLAN_DATA == nbrplan )
       
  2985             {
       
  2986             aMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan =
       
  2987                 RMobilePhone::EDataNumberPlan;
       
  2988             aMobileCallInfo.iDialledParty.iNumberPlan =
       
  2989                 RMobilePhone::EDataNumberPlan;
       
  2990             }
       
  2991         else if ( CALL_MODEM_NBR_PLAN_TELEX == nbrplan )
       
  2992             {
       
  2993             aMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan =
       
  2994                 RMobilePhone::ETelexNumberPlan;
       
  2995             aMobileCallInfo.iDialledParty.iNumberPlan =
       
  2996                 RMobilePhone::ETelexNumberPlan;
       
  2997             }
       
  2998         else if ( CALL_MODEM_NBR_PLAN_PRIVATE == nbrplan )
       
  2999             {
       
  3000             aMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan =
       
  3001                 RMobilePhone::EPrivateNumberPlan;
       
  3002             aMobileCallInfo.iDialledParty.iNumberPlan =
       
  3003                 RMobilePhone::EPrivateNumberPlan;
       
  3004             }
       
  3005         else if ( CALL_MODEM_NBR_PLAN_NATIONAL == nbrplan )
       
  3006             {
       
  3007             aMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan =
       
  3008                 RMobilePhone::ENationalNumberPlan;
       
  3009             aMobileCallInfo.iDialledParty.iNumberPlan =
       
  3010                 RMobilePhone::ENationalNumberPlan;
       
  3011             }
       
  3012         else
       
  3013             {
       
  3014             aMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan =
       
  3015                 RMobilePhone::EUnknownNumberingPlan;
       
  3016             aMobileCallInfo.iDialledParty.iNumberPlan =
       
  3017                 RMobilePhone::EUnknownNumberingPlan;
       
  3018             }
       
  3019         }
       
  3020     // No else
       
  3021 
       
  3022     // Mask the nbrtype with 01110000 to get the number type
       
  3023     // (three bits (5-7) contain type of number, the most significant bit (8)
       
  3024     // is a spare bit and shall be ignored)
       
  3025     TUint nbrtype( aOrigAddressType & KMaskBits5to7 );
       
  3026 
       
  3027 TFLOGSTRING2("TSY: CMmCallMessHandler::FillNumberPlanAndType. nbrplan (mask KMaskBits5to7) : %d",nbrtype);
       
  3028 OstTrace1( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_FILLNUMBERPLANANDTYPE, "CMmCallMessHandler::FillNumberPlanAndType - nbrplan (mask KMaskBits5to7) nbrtype=%d", nbrtype );
       
  3029 
       
  3030     if ( RMobilePhone::EUnknownNumber ==
       
  3031         aMobileCallInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber )
       
  3032         {
       
  3033 TFLOGSTRING("TSY: CMmCallMessHandler::FillNumberPlanAndType. EUnknownNumber");
       
  3034 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_FILLNUMBERPLANANDTYPE, "CMmCallMessHandler::FillNumberPlanAndType - EUnknownNumber" );
       
  3035 
       
  3036         if ( CALL_MODEM_NBR_TYPE_UNKNOWN == nbrtype )
       
  3037             {
       
  3038             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber =
       
  3039                 RMobilePhone::EUnknownNumber;
       
  3040             aMobileCallInfo.iDialledParty.iTypeOfNumber =
       
  3041                 RMobilePhone::EUnknownNumber;
       
  3042             }
       
  3043         else if ( CALL_MODEM_NBR_TYPE_INTERNATIONAL == nbrtype )
       
  3044             {
       
  3045             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber =
       
  3046                 RMobilePhone::EInternationalNumber;
       
  3047             aMobileCallInfo.iDialledParty.iTypeOfNumber =
       
  3048                 RMobilePhone::EInternationalNumber;
       
  3049             }
       
  3050         else if ( CALL_MODEM_NBR_TYPE_NATIONAL == nbrtype )
       
  3051             {
       
  3052             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber =
       
  3053                 RMobilePhone::ENationalNumber;
       
  3054             aMobileCallInfo.iDialledParty.iTypeOfNumber =
       
  3055                 RMobilePhone::ENationalNumber;
       
  3056             }
       
  3057         else if ( CALL_MODEM_NBR_TYPE_NETWORK_SPECIFIC == nbrtype )
       
  3058             {
       
  3059             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber =
       
  3060                 RMobilePhone::ENetworkSpecificNumber;
       
  3061             aMobileCallInfo.iDialledParty.iTypeOfNumber =
       
  3062                 RMobilePhone::ENetworkSpecificNumber;
       
  3063             }
       
  3064         else
       
  3065             {
       
  3066             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber =
       
  3067                 RMobilePhone::EUnknownNumber;
       
  3068             aMobileCallInfo.iDialledParty.iTypeOfNumber =
       
  3069                 RMobilePhone::EUnknownNumber;
       
  3070             }
       
  3071         }
       
  3072     // no else
       
  3073     }
       
  3074 
       
  3075 // -----------------------------------------------------------------------------
       
  3076 // CMmCallMessHandler::FillRemoteStatusAndNumber
       
  3077 // This method maps the Domestic OS address type and orig address to the
       
  3078 // Symbian OS remote information and fills the information to the mobile call
       
  3079 // information package received as input parameter.
       
  3080 // (other items were commented in a header).
       
  3081 // -----------------------------------------------------------------------------
       
  3082 //
       
  3083 void CMmCallMessHandler::FillRemoteStatusAndNumber(
       
  3084     RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  3085     TUint8 aOrigPresentInd,
       
  3086     const TDes16& aOrigAddress,
       
  3087     RMobileCall::TMobileCallDirection aDirection ) const
       
  3088     {
       
  3089 TFLOGSTRING3("TSY: CMmCallMessHandler::FillRemoteStatusAndNumber. OrigAdr: %s. CallDirection:%d", &aOrigAddress, aDirection);
       
  3090 OstTraceExt2( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_FILLREMOTESTATUSANDNUMBER, "CMmCallMessHandler::FillRemoteStatusAndNumber;OrigAddr=%S;CallDirection=%d", aOrigAddress, aDirection );
       
  3091 
       
  3092     // Find out if telephone number is allowed to be presented.
       
  3093     if ( RMobileCall::ERemoteIdentityUnknown ==
       
  3094         aMobileCallInfo.iRemoteParty.iRemoteIdStatus )
       
  3095         {
       
  3096         // CPN_ALLOWED
       
  3097         if ( CALL_MODEM_PRESENT_ALLOWED == aOrigPresentInd && RMobileCall::EMobileOriginated == aDirection
       
  3098                 || CALL_MODEM_PRESENTATION_ALLOWED == aOrigPresentInd && RMobileCall::EMobileTerminated == aDirection)
       
  3099             {
       
  3100 TFLOGSTRING("TSY: CMmCallMessHandler::FillRemoteStatusAndNumber. CPN_ALLOWED");
       
  3101 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_FILLREMOTESTATUSANDNUMBER, "CMmCallMessHandler::FillRemoteStatusAndNumber - CPN_ALLOWED" );
       
  3102 
       
  3103             // Available. iRemoteIdStatus is updated using the tel number
       
  3104             // presentation status. Remote name does not affect to it, Symbian's
       
  3105             // response:
       
  3106             // > In the meantime, I would say that iRemoteIdStatus relates to
       
  3107             // > the number only and the iCallingName field may be available
       
  3108             // > even if iRemoteIdStatus says "suppressed" or "not available
       
  3109             aMobileCallInfo.iRemoteParty.iRemoteIdStatus =
       
  3110                 RMobileCall::ERemoteIdentityAvailable;
       
  3111 
       
  3112             // Copy the actual number
       
  3113             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Copy(
       
  3114                 aOrigAddress.Left( aOrigAddress.Length() ) );
       
  3115             }
       
  3116         // CPN_RESTRICTED & MT call
       
  3117         else if ( CALL_MODEM_PRESENTATION_RESTRICTED == aOrigPresentInd &&
       
  3118                   aDirection == RMobileCall::EMobileTerminated )
       
  3119             {
       
  3120 TFLOGSTRING("TSY: CMmCallMessHandler::FillRemoteStatusAndNumber. CPN_RESTRICTED & MT call");
       
  3121 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_FILLREMOTESTATUSANDNUMBER, "CMmCallMessHandler::FillRemoteStatusAndNumber - CPN_RESTRICTED and MT call" );
       
  3122 
       
  3123             // There are cases when remote party info should still be presented.
       
  3124             // See TSW ActionDB, Notes ID: MB03081534698
       
  3125             aMobileCallInfo.iRemoteParty.iRemoteIdStatus =
       
  3126                 RMobileCall::ERemoteIdentitySuppressed;
       
  3127 
       
  3128             // Copy the actual number
       
  3129             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Copy(
       
  3130                 aOrigAddress.Left( aOrigAddress.Length() ) );
       
  3131             }
       
  3132         else // CPN_NOT_AVAILABLE or CPN_RESTRICTED & MO
       
  3133             {
       
  3134 TFLOGSTRING("TSY: CMmCallMessHandler::FillRemoteStatusAndNumber. CPN_NOT_AVAILABLE or CPN_RESTRICTED & MO ");
       
  3135 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_FILLREMOTESTATUSANDNUMBER, "CMmCallMessHandler::FillRemoteStatusAndNumber - CPN_NOT_AVAILABLE or CPN_RESTRICTED and MO" );
       
  3136 
       
  3137             if ( CALL_MODEM_PRESENT_RESTRICTED == aOrigPresentInd &&
       
  3138                  RMobileCall::EMobileOriginated == aDirection )
       
  3139                 {
       
  3140                 aMobileCallInfo.iRemoteParty.iRemoteIdStatus =
       
  3141                     RMobileCall::ERemoteIdentitySuppressed;
       
  3142                 }
       
  3143             else
       
  3144                 {
       
  3145 TFLOGSTRING("TSY: CMmCallMessHandler::FillRemoteStatusAndNumber. OrigPresentInd is unknown");
       
  3146 OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_FILLREMOTESTATUSANDNUMBER, "CMmCallMessHandler::FillRemoteStatusAndNumber - OrigPresentInd is unknown" );
       
  3147                 // Unknown
       
  3148                 aMobileCallInfo.iRemoteParty.iRemoteIdStatus =
       
  3149                     RMobileCall::ERemoteIdentityUnknown;
       
  3150                 }
       
  3151 
       
  3152             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Zero();
       
  3153             }
       
  3154         }
       
  3155     // No else
       
  3156 
       
  3157     // Add dialled party information
       
  3158     if ( 0 < aOrigAddress.Length() )
       
  3159         {
       
  3160         // Copy dialled party number
       
  3161         aMobileCallInfo.iDialledParty.iTelNumber.Copy(
       
  3162             aOrigAddress.Left( aOrigAddress.Length() ) );
       
  3163         }
       
  3164     // No else
       
  3165     }
       
  3166 
       
  3167 // -----------------------------------------------------------------------------
       
  3168 // CMmCallMessHandler::FillCallingName
       
  3169 // This method maps the Domestic OS information to the Symbian OS calling name
       
  3170 // and fills the information to the mobile call information package received as
       
  3171 // input parameter.
       
  3172 // (other items were commented in a header).
       
  3173 // -----------------------------------------------------------------------------
       
  3174 //
       
  3175 void CMmCallMessHandler::FillCallingName(
       
  3176     RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  3177     TUint8 aOrigInfoPresentInd,
       
  3178     const TDes16& aOrigInfoName ) const
       
  3179     {
       
  3180 TFLOGSTRING3("TSY: CMmCallMessHandler::FillCallingName. aOrigInfoPresentInd:%d, origInfoName:%s", aOrigInfoPresentInd,&aOrigInfoName);
       
  3181 OstTraceExt2( TRACE_NORMAL, CMMCALLMESSHANDLER_FILLCALLINGNAME, "CMmCallMessHandler::FillCallingName;aOrigInfoPresentInd=%hhu;aOrigInfoName=%S", aOrigInfoPresentInd, aOrigInfoName );
       
  3182 
       
  3183     // Find out if name is availble and can be presented.
       
  3184     if ( CALL_MODEM_PRESENTATION_ALLOWED == aOrigInfoPresentInd &&
       
  3185         0 < aOrigInfoName.Length() )
       
  3186         {
       
  3187         // iRemoteIdStatus has to be set, as ETEL MM API design document
       
  3188         // states: "Indicates whether the remote party information in the
       
  3189         // rest of this structure is valid or not.
       
  3190         aMobileCallInfo.iRemoteParty.iRemoteIdStatus =
       
  3191             RMobileCall::ERemoteIdentityAvailable;
       
  3192         aMobileCallInfo.iRemoteParty.iCallingName.Copy(
       
  3193             aOrigInfoName.Left( aOrigInfoName.Length() ) );
       
  3194         }
       
  3195     // No else
       
  3196     }
       
  3197 
       
  3198 // -----------------------------------------------------------------------------
       
  3199 // CMmCallMessHandler::CallStatusIndL
       
  3200 // This method breaks the Call status information message. It notifies the
       
  3201 // Symbian OS layer about status changes and remote party information changes
       
  3202 // (other items were commented in a header).
       
  3203 // -----------------------------------------------------------------------------
       
  3204 //
       
  3205 void CMmCallMessHandler::CallStatusIndL(
       
  3206     const TIsiReceiveC &aIsiMessage )
       
  3207     {
       
  3208 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL");
       
  3209 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL" );
       
  3210 
       
  3211     TUint8 callStatusISA( 0xFF );
       
  3212     TUint8 callModeISA( 0xFF );
       
  3213     RMobileCall::TMobileCallStatus statusETel( RMobileCall::EStatusUnknown );
       
  3214 
       
  3215     RMobileCall::TMobileCallInfoV1 mobileCallInfo;
       
  3216     // Update data accorging the data received
       
  3217     mobileCallInfo.iValid = 0;
       
  3218 
       
  3219     // Read call id
       
  3220     // Remember to mask high bits away from the call ID. They may contain
       
  3221     // useless information for single call that causes problem with the call
       
  3222     // retrieval. (three bits (1-3) contain unique call ID).
       
  3223     mobileCallInfo.iCallId = static_cast<TInt>( aIsiMessage.Get8bit(
       
  3224         ISI_HEADER_SIZE + CALL_MODEM_STATUS_IND_OFFSET_CALLID )
       
  3225             & KMaskBits1to3 );
       
  3226 
       
  3227     TUint sbStartOffSet( 0 );
       
  3228     TUint8 origPresentInd( CALL_MODEM_PRESENT_DEFAULT );
       
  3229 
       
  3230     // Read call status
       
  3231     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3232         ISI_HEADER_SIZE + CALL_MODEM_STATUS_IND_OFFSET_STATUS,
       
  3233         CALL_MODEM_SB_STATUS,
       
  3234         EIsiSubBlockTypeId8Len8,
       
  3235         sbStartOffSet ) )
       
  3236         {
       
  3237         // Get ISA call status
       
  3238         callStatusISA = aIsiMessage.Get8bit(
       
  3239             sbStartOffSet + CALL_MODEM_SB_STATUS_OFFSET_STATUS );
       
  3240 
       
  3241 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_STATUS subblock");
       
  3242         OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_STATUS subblock" );
       
  3243         }
       
  3244         // No else
       
  3245 
       
  3246     statusETel = MapCallStatus( callStatusISA );
       
  3247     mobileCallInfo.iStatus = statusETel;
       
  3248     if ( CALL_MODEM_STATUS_MO_ALERTING == callStatusISA )
       
  3249         {
       
  3250         iCallDirection = RMobileCall::EMobileOriginated;
       
  3251         }
       
  3252     else if ( CALL_MODEM_STATUS_MT_ALERTING == callStatusISA )
       
  3253         {
       
  3254         iCallDirection = RMobileCall::EMobileTerminated;
       
  3255         }
       
  3256 
       
  3257     // Check if Video Call is MT Released.
       
  3258     // Pipe have to remove to make next call possible.
       
  3259     // Have to wait that Csd videoCall is disconnected.
       
  3260     if ( CALL_MODEM_STATUS_MT_RELEASE == callStatusISA )
       
  3261         {
       
  3262         iVideoCallMtReleased = ETrue;
       
  3263         }
       
  3264 
       
  3265     // Read call mode
       
  3266     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3267         ISI_HEADER_SIZE + CALL_MODEM_STATUS_IND_OFFSET_MODE,
       
  3268         CALL_MODEM_SB_MODE,
       
  3269         EIsiSubBlockTypeId8Len8,
       
  3270         sbStartOffSet ) )
       
  3271         {
       
  3272         // Get call mode and add it to mobile call info struct
       
  3273         callModeISA = aIsiMessage.Get8bit(
       
  3274             sbStartOffSet + CALL_MODEM_SB_MODE_OFFSET_MODE );
       
  3275 
       
  3276 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_MODE subblock");
       
  3277 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_MODE subblock" );
       
  3278 
       
  3279         FillModeData( mobileCallInfo, callModeISA );
       
  3280         mobileCallInfo.iValid |= RMobileCall::KCallEmergency;
       
  3281         }
       
  3282         // No else
       
  3283 
       
  3284     if( CALL_MODEM_STATUS_IDLE == callStatusISA &&
       
  3285         mobileCallInfo.iCallId == iIncomingCallInfo.iCallId )
       
  3286         {
       
  3287 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:NOTE! Can't complete to CTSY!, because call is terminated before it is indicated to CTSY");
       
  3288 OstTrace0( TRACE_NORMAL, DUP19_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL:NOTE! Can't complete to CTSY!, because call is terminated before it is indicated to CTSY" );
       
  3289         // reset temporary call info
       
  3290         ResetIncomingCallInfo( iIncomingCallInfo );
       
  3291         }
       
  3292     else
       
  3293         {
       
  3294 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:Normal completion of call status ind (no termination of calls which haven't been indicated to CTSY yet)");
       
  3295 OstTrace0( TRACE_NORMAL, DUP20_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL:Normal completion of call status ind (no termination of calls which haven't been indicated to CTSY yet)" );
       
  3296 
       
  3297         // Create call package (used for all completions)
       
  3298         CCallDataPackage callData;
       
  3299         // Pack the data for sending to the manager
       
  3300         callData.SetCallIdAndMode(
       
  3301             mobileCallInfo.iCallId,
       
  3302             mobileCallInfo.iService );
       
  3303 
       
  3304         CheckCallIsaStatus( mobileCallInfo, callStatusISA );
       
  3305 
       
  3306         // Store UUI data when the call is coming
       
  3307         if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3308             ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
       
  3309             CALL_MODEM_SB_USER_TO_USER,
       
  3310             EIsiSubBlockTypeId8Len8,
       
  3311             sbStartOffSet ) &&
       
  3312             ( CALL_MODEM_STATUS_COMING == callStatusISA ) )
       
  3313             {
       
  3314 
       
  3315 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: Receive UUI.");
       
  3316 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: Receive UUI" );
       
  3317 
       
  3318             // Get data length
       
  3319             TUint8 userToUserDataLen( aIsiMessage.Get8bit(
       
  3320             sbStartOffSet + CALL_MODEM_SB_USER_TO_USER_OFFSET_UTOULEN ) );
       
  3321 
       
  3322             // Get UUIE data
       
  3323             TPtrC8 data( aIsiMessage.GetData(
       
  3324                 sbStartOffSet + CALL_MODEM_SB_USER_TO_USER_OFFSET_UTOU,
       
  3325                 userToUserDataLen ) );
       
  3326 
       
  3327             // Copy UUS data to member variable. Receive UUI will be completed
       
  3328             // after EEtelLineNotifyIncomingCall is completed.
       
  3329             iReceivedUusData.Zero();
       
  3330             iReceivedUusData.Copy( data.Left( RMobileCall::KMaxUUISize ) );
       
  3331             }
       
  3332         // No else
       
  3333 
       
  3334         // If status is valid in Symbian OS
       
  3335         if ( RMobileCall::EStatusUnknown != statusETel )
       
  3336             {
       
  3337             TUint8 causeType( 0 );
       
  3338             TUint8 causeValue( 0 );
       
  3339             // Introduce target
       
  3340             TBuf16<RMobilePhone::KMaxMobileTelNumberSize> targetOrig;
       
  3341             TBuf16<RMobileCall::KCallingNameSize> targetOrigName;
       
  3342 
       
  3343             // Copy some data previously received to current MobileCallInfo
       
  3344             if ( mobileCallInfo.iCallId == iIncomingCallInfo.iCallId )
       
  3345                 {
       
  3346                 mobileCallInfo.iForwarded = iIncomingCallInfo.iForwarded;
       
  3347                 mobileCallInfo.iValid |= RMobileCall::KCallForwarded;
       
  3348                 mobileCallInfo.iRemoteParty = iIncomingCallInfo.iRemoteParty;
       
  3349                 mobileCallInfo.iValid |= RMobileCall::KCallRemoteParty;
       
  3350                 }
       
  3351             // No else
       
  3352 
       
  3353             // Read gsm redirecting address
       
  3354             if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3355                 ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
       
  3356                 CALL_MODEM_SB_REDIRECTING_ADDRESS,
       
  3357                 EIsiSubBlockTypeId8Len8,
       
  3358                 sbStartOffSet ) )
       
  3359                 {
       
  3360 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_REDIRECTING_ADDRESS subblock");
       
  3361 OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_REDIRECTING_ADDRESS subblock" );
       
  3362 
       
  3363                 // Get address length
       
  3364                 TUint8 redirectingAddressLength( aIsiMessage.Get8bit(
       
  3365                     sbStartOffSet +
       
  3366                     CALL_MODEM_SB_REDIRECTING_ADDRESS_OFFSET_ADDRLEN ) );
       
  3367 
       
  3368                 // If there is a redirection address, the call has been forwarded
       
  3369                 // (but not vice versa; this information can come with another
       
  3370                 // indication)
       
  3371                 if ( 0 != redirectingAddressLength )
       
  3372                     {
       
  3373                     mobileCallInfo.iForwarded = ETrue;
       
  3374                     mobileCallInfo.iValid |= RMobileCall::KCallForwarded;
       
  3375                     }
       
  3376                     // No else
       
  3377                 }
       
  3378                 // No else
       
  3379 
       
  3380             // Read CALL_MODEM_SB_LINE_ID
       
  3381             if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3382                 ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
       
  3383                 CALL_MODEM_SB_LINE_ID,
       
  3384                 EIsiSubBlockTypeId8Len8,
       
  3385                 sbStartOffSet ))
       
  3386                 {
       
  3387 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_LINE_ID subblock");
       
  3388 OstTrace0( TRACE_NORMAL, DUP21_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_LINE_ID subblock" );
       
  3389 
       
  3390                 origPresentInd = aIsiMessage.Get8bit(
       
  3391                     sbStartOffSet + CALL_MODEM_SB_LINE_ID_OFFSET_LINEID );
       
  3392                 }
       
  3393             // Read all destination address
       
  3394             if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3395                 ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
       
  3396                 CALL_MODEM_SB_DESTINATION_ADDRESS,
       
  3397                 EIsiSubBlockTypeId8Len8,
       
  3398                 sbStartOffSet ) )
       
  3399                 {
       
  3400 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_ADDRESS subblock");
       
  3401 OstTrace0( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_ADDRESS subblock" );
       
  3402 
       
  3403                 ReadAllAddressDestination( mobileCallInfo, targetOrig, aIsiMessage, sbStartOffSet, origPresentInd );
       
  3404                 }
       
  3405                 // No else
       
  3406 
       
  3407             if ( CALL_MODEM_STATUS_CREATE == callStatusISA )
       
  3408                 {
       
  3409                 // Reset orginator address information. Destination address
       
  3410                 // contents in CALL_MODEM_STATUS_IND are same as in CALL_MODEM_CREATE_REQ
       
  3411                 // when call is in create state.
       
  3412                 mobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Zero();
       
  3413                 mobileCallInfo.iValid &= ~RMobileCall::KCallRemoteParty;
       
  3414                 }
       
  3415                 // No else
       
  3416 
       
  3417                 // Read call origin info
       
  3418                 if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3419                     ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
       
  3420                     CALL_MODEM_SB_ORIGIN_INFO,
       
  3421                     EIsiSubBlockTypeId8Len8,
       
  3422                     sbStartOffSet ) )
       
  3423                     {
       
  3424 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_ORIGIN_INFO subblock");
       
  3425 OstTrace0( TRACE_NORMAL, DUP6_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_ORIGIN_INFO subblock" );
       
  3426 
       
  3427                     ReadCallInfo(
       
  3428                         mobileCallInfo,
       
  3429                         targetOrigName,
       
  3430                         aIsiMessage,
       
  3431                         sbStartOffSet );
       
  3432                     }
       
  3433                     // No else
       
  3434 
       
  3435                 // Get error value
       
  3436                 if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3437                     ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
       
  3438                     CALL_MODEM_SB_CAUSE,
       
  3439                     EIsiSubBlockTypeId8Len8,
       
  3440                     sbStartOffSet ) )
       
  3441                     {
       
  3442 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_CAUSE subblock");
       
  3443 OstTrace0( TRACE_NORMAL, DUP7_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_CAUSE subblock" );
       
  3444 
       
  3445                     // Get cause type and value
       
  3446                     causeType = aIsiMessage.Get8bit(
       
  3447                         sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE );
       
  3448 
       
  3449                     // Get call cause value
       
  3450                     causeValue = aIsiMessage.Get8bit(
       
  3451                         sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE );
       
  3452                     }
       
  3453                     // No else
       
  3454 
       
  3455                 // If iDestPostAddressIncluded flag is (ETrue) we don't handle
       
  3456                 // CALL_MODEM_SB_DESTINATION_POST_ADDRESS subblock here
       
  3457                 if ( !iDestPostAddressIncluded )
       
  3458                     {
       
  3459                     // CALL_MODEM_SB_DESTINATION_POST_ADDRESS
       
  3460                     // If Destination post address is found, save it.
       
  3461                     // It will be sent later when this call is active
       
  3462                     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3463                         ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
       
  3464                         CALL_MODEM_SB_DESTINATION_POST_ADDRESS,
       
  3465                         EIsiSubBlockTypeId8Len8,
       
  3466                         sbStartOffSet ) )
       
  3467                         {
       
  3468 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:CALL_MODEM_SB_DESTINATION_POST_ADDRESS");
       
  3469 OstTrace0( TRACE_NORMAL, DUP8_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: CALL_MODEM_SB_DESTINATION_POST_ADDRESS" );
       
  3470 
       
  3471                         // Get address length
       
  3472                         TUint8 destinationPostAddressLength( aIsiMessage.Get8bit(
       
  3473                             sbStartOffSet + CALL_MODEM_SB_DESTINATION_POST_ADDRESS_OFFSET_ADDRLEN ) );
       
  3474 
       
  3475                         // Get address
       
  3476                         TPtrC8 postAddr( aIsiMessage.GetData(
       
  3477                             sbStartOffSet + CALL_MODEM_SB_DESTINATION_POST_ADDRESS_OFFSET_ADDR,
       
  3478                             destinationPostAddressLength * 2 ) );
       
  3479 
       
  3480                         // Do not handle post address which lenght is over 15 chars
       
  3481                         if ( ( KDestPostAddressMaxLength * 2 ) >= postAddr.Length() )
       
  3482                             {
       
  3483 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:lenght less than 15 char");
       
  3484 OstTrace0( TRACE_NORMAL, DUP9_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: Lenght less than 15 char" );
       
  3485                             // Copy 8-bit name to the 16-bit target using correct endianess
       
  3486                             TIsiUtility::CopyFromBigEndian(
       
  3487                                 postAddr,
       
  3488                                 iDestPostAddress );
       
  3489 
       
  3490                             TInt postAddrLength( iDestPostAddress.Length() );
       
  3491 
       
  3492                             // Store call ID to identify SIM ATK call
       
  3493                             iDtmfPostAddressCallId = mobileCallInfo.iCallId;
       
  3494 
       
  3495                             // Check that there is not "w" char. "w" will mess up internal
       
  3496                             // DTMF sending process
       
  3497                             for ( TInt i( 0 ); i < postAddrLength; i++ )
       
  3498                                 {
       
  3499                                 if ( 'w' == iDestPostAddress[ i ] )
       
  3500                                     {
       
  3501 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:w found");
       
  3502 OstTrace0( TRACE_NORMAL, DUP10_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: w found" );
       
  3503                                     iDestPostAddress.SetLength( 0 );
       
  3504                                     iDtmfPostAddressCallId = 0;
       
  3505                                     break;
       
  3506                                     }
       
  3507                                 }
       
  3508                             }
       
  3509                         }
       
  3510 
       
  3511 TFLOGSTRING2("TSY: CMmCallMessHandler::CallStatusIndL:callStatusISA: %d", callStatusISA);
       
  3512 TFLOGSTRING2("TSY: CMmCallMessHandler::CallStatusIndL:mobileCallInfo.iCallId: %d", mobileCallInfo.iCallId);
       
  3513 TFLOGSTRING2("TSY: CMmCallMessHandler::CallStatusIndL:iDtmfPostAddressCallId: %d", iDtmfPostAddressCallId);
       
  3514 OstTraceExt1( TRACE_NORMAL, DUP11_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL;callStatusISA=%hhu", callStatusISA );
       
  3515 OstTraceExt1( TRACE_NORMAL, DUP13_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL;mobileCallInfo.iCallId=%hhu", mobileCallInfo.iCallId );
       
  3516 OstTraceExt1( TRACE_NORMAL, DUP12_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL;iDtmfPostAddressCallId=%hhu", iDtmfPostAddressCallId );
       
  3517 
       
  3518                     // When call is active, send post address
       
  3519                     // DTMF sending in case this is SIMATK call
       
  3520                     if ( CALL_MODEM_STATUS_ACTIVE == callStatusISA &&
       
  3521                         iDtmfPostAddressCallId == mobileCallInfo.iCallId &&
       
  3522                         0 < iDtmfPostAddressCallId )
       
  3523                         {
       
  3524 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:Dtmf post address sending (ACTIVE)");
       
  3525 OstTrace0( TRACE_NORMAL, DUP17_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL, Dtmf post address sending (ACTIVE)" );
       
  3526                         iDtmfMessHandler->SendPostAddressL ( &iDestPostAddress );
       
  3527 
       
  3528                         // Reset iDestPostAddress and iDtmfPostAddressCallId to prevent multiple
       
  3529                         // requests
       
  3530                         iDestPostAddress.SetLength( 0 );
       
  3531                         iDtmfPostAddressCallId = 0;
       
  3532                         }
       
  3533 
       
  3534                     // If call fails for some reason, and goes to idle, reset
       
  3535                     // iDestPostAddress and iDtmfPostAddressCallId
       
  3536                     if ( CALL_MODEM_STATUS_IDLE == callStatusISA &&
       
  3537                         iDtmfPostAddressCallId == mobileCallInfo.iCallId &&
       
  3538                         0 < iDtmfPostAddressCallId )
       
  3539                         {
       
  3540 TFLOGSTRING("TSY: CMmCallMessHandler::CallStatusIndL:If call fails for some reason (IDLE)");
       
  3541 OstTrace0( TRACE_NORMAL, DUP14_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL: If call fails for some reason (IDLE)" );
       
  3542                         iDestPostAddress.SetLength( 0 );
       
  3543                         iDtmfPostAddressCallId = 0;
       
  3544                         }
       
  3545 
       
  3546 TFLOGSTRING2("TSY: CMmCallMessHandler::CallStatusIndL:iDtmfPostAddressCallId: %d After value",iDtmfPostAddressCallId);
       
  3547 OstTraceExt1( TRACE_NORMAL, DUP18_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL;iDtmfPostAddressCallId=%hhu After value", iDtmfPostAddressCallId );
       
  3548                     }
       
  3549                     // No else
       
  3550 
       
  3551             if ( CALL_MODEM_SSD_NO_CUG == ( iDiagnosticOctet & KMaskBits1to7 ) &&
       
  3552                 CALL_MODEM_NW_CAUSE_FACILITY_REJECTED == causeValue )
       
  3553                 {
       
  3554                 // This is special situation. Dial is made to number that is not
       
  3555                 // in CUG list -> error must be mapped to KErrGsmCCUserNotInCug
       
  3556                 causeType = CALL_MODEM_CAUSE_TYPE_NETWORK;
       
  3557                 causeValue = CALL_MODEM_NW_CAUSE_NOT_IN_CUG;
       
  3558                 }
       
  3559                 // No else
       
  3560 
       
  3561                 iDiagnosticOctet = 0;
       
  3562 
       
  3563                 TInt resultETel( KErrNone );
       
  3564                 // Check if GSM MM Cause is received in CallTerminatedInd
       
  3565             if ( KErrNone != iGsmMmCauseError )
       
  3566                 {
       
  3567                 resultETel = iGsmMmCauseError;
       
  3568                 iGsmMmCauseError = KErrNone;
       
  3569                 }
       
  3570             else
       
  3571                 {
       
  3572                 resultETel = CMmStaticUtility::CSCauseToEpocError(
       
  3573                     PN_MODEM_CALL,
       
  3574                     causeType,
       
  3575                     causeValue );
       
  3576                 }
       
  3577 
       
  3578             // COMPLETE INCOMING CALL NOTIFICATION
       
  3579             CompleteIncomingCallNotif( mobileCallInfo, statusETel );
       
  3580             // MT calls which went waiting can alert twice
       
  3581             // reset stored incoming call information only after they actually rang
       
  3582             if ( CALL_MODEM_STATUS_MT_ALERTING == callStatusISA )
       
  3583                 {
       
  3584                 ResetIncomingCallInfo( iIncomingCallInfo );
       
  3585                 }
       
  3586 
       
  3587         // Update mobile call info to data port handler also
       
  3588             if ( ( CALL_MODEM_MODE_MULTIMEDIA == callModeISA ) &&
       
  3589                 CALL_MODEM_STATUS_WAITING != callStatusISA )
       
  3590                 {
       
  3591                 TBool isMultimedia( CALL_MODEM_MODE_MULTIMEDIA == callModeISA );
       
  3592                 TBool isWaitingCall( iWaitingCall == mobileCallInfo.iCallId );
       
  3593 
       
  3594                 SetMobileCallInfo(
       
  3595                     mobileCallInfo,
       
  3596                     isMultimedia,
       
  3597                     isWaitingCall );
       
  3598                 }
       
  3599                 // No else
       
  3600 
       
  3601                 // PKCN-6NTAHB  FT: No audio alert in "No Answer"
       
  3602                 // condition of MO VT
       
  3603             if ( CALL_MODEM_STATUS_ACTIVE == callStatusISA ||
       
  3604                 CALL_MODEM_STATUS_MT_RELEASE == callStatusISA ||
       
  3605                 CALL_MODEM_STATUS_MO_RELEASE == callStatusISA )
       
  3606                 {
       
  3607 TFLOGSTRING2("TSY: CMmCallMessHandler::CallStatusIndL:callStatusISA: %d", callStatusISA);
       
  3608 OstTraceExt1( TRACE_NORMAL, DUP15_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL;callStatusISA=%hhu", callStatusISA );
       
  3609 
       
  3610                 TBool playRemoteAlertToneLocally( EFalse );
       
  3611 
       
  3612 TFLOGSTRING2("TSY: CMmCallMessHandler::CallStatusIndL:playRemoteAlert: %d", playRemoteAlertToneLocally);
       
  3613 OstTraceExt1( TRACE_NORMAL, DUP16_CMMCALLMESSHANDLER_CALLSTATUSINDL, "CMmCallMessHandler::CallStatusIndL;playRemoteAlertToneLocally=%hhu", playRemoteAlertToneLocally );
       
  3614 
       
  3615                 CMmDataPackage dataPackage;
       
  3616                 dataPackage.PackData( &playRemoteAlertToneLocally );
       
  3617                 iMessageRouter->Complete(
       
  3618                     ECustomGetRemoteAlertingToneStatusIPC,
       
  3619                     &dataPackage,
       
  3620                     KErrNone );
       
  3621                 }
       
  3622                 // No else
       
  3623 
       
  3624             CompleteMobileCallInfoAndStatusChange(
       
  3625                 mobileCallInfo,
       
  3626                 statusETel,
       
  3627                 resultETel );
       
  3628 
       
  3629             if ( CALL_MODEM_MODE_MULTIMEDIA == callModeISA &&
       
  3630                ( RMobileCall::EStatusRinging == statusETel ||
       
  3631                 RMobileCall::EStatusDialling == statusETel ) )
       
  3632                 {
       
  3633                 // Client needs to know if call is video
       
  3634                 RMobileCall::TMobileDataCallParamsV1 CSDParams;
       
  3635                 CSDParams.iService = RMobileCall::EServiceDataCircuitSync;
       
  3636                 CSDParams.iQoS = RMobileCall::EQoSTransparent;
       
  3637                 CSDParams.iSpeed = RMobileCall::ESpeed64000;
       
  3638                 CSDParams.iProtocol = RMobileCall::EProtocolIsdnMultimedia;
       
  3639                 // Pack CSD params
       
  3640                 RMobileCall::TMobileDataCallParamsV1Pckg csdParamsPckg(
       
  3641                     CSDParams );
       
  3642                 callData.PackData( &csdParamsPckg );
       
  3643                 // Complete CSD params update
       
  3644                 iMessageRouter->Complete(
       
  3645                     EEtelCallGetCallParams,
       
  3646                     &callData,
       
  3647                     KErrNone );
       
  3648                 }
       
  3649             // No else
       
  3650 
       
  3651             // Store call ID for waiting call for checking that it is not
       
  3652             // notified again when it gets ringing (see error item MEKK-5ZMKHG).
       
  3653             if ( CALL_MODEM_STATUS_WAITING == callStatusISA )
       
  3654                 {
       
  3655                 iWaitingCall = mobileCallInfo.iCallId;
       
  3656                 }
       
  3657             else if ( iWaitingCall == mobileCallInfo.iCallId )
       
  3658                 {
       
  3659                 iWaitingCall = KSymbianCallIdNone;
       
  3660                 }
       
  3661             // No else
       
  3662             }
       
  3663         // No else
       
  3664 
       
  3665         }//end of if(incoming call && status == idle)
       
  3666     }
       
  3667 
       
  3668 // -----------------------------------------------------------------------------
       
  3669 // CMmCallMessHandler::CallComingInd
       
  3670 // This method breaks incoming call indication message and saves information
       
  3671 // in iIncomingCallInfo.
       
  3672 // (other items were commented in a header).
       
  3673 // -----------------------------------------------------------------------------
       
  3674 //
       
  3675 void CMmCallMessHandler::CallComingInd(
       
  3676     const TIsiReceiveC &aIsiMessage )
       
  3677     {
       
  3678 TFLOGSTRING("TSY: CMmCallMessHandler::CallComingInd");
       
  3679 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLCOMINGIND, "CMmCallMessHandler::CallComingInd" );
       
  3680 
       
  3681     // Call coming ind message
       
  3682     TUint8 callMode( 0xFF );
       
  3683     TBuf16<RMobileCall::KCallingNameSize> targetOrigName;
       
  3684     TUint sbStartOffSet( 0 );
       
  3685 
       
  3686     // Call mode is mandatory sub block
       
  3687     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3688         ISI_HEADER_SIZE + CALL_MODEM_COMING_IND_OFFSET_MODE,
       
  3689         CALL_MODEM_SB_MODE,
       
  3690         EIsiSubBlockTypeId8Len8,
       
  3691         sbStartOffSet ) )
       
  3692         {
       
  3693         // Get call mode value
       
  3694         callMode = aIsiMessage.Get8bit(
       
  3695             sbStartOffSet + CALL_MODEM_SB_MODE_OFFSET_MODE );
       
  3696 
       
  3697 TFLOGSTRING("TSY: CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_MODE");
       
  3698 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CALLCOMINGIND, "CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_MODE" );
       
  3699 
       
  3700         FillModeData( iIncomingCallInfo, callMode );
       
  3701         iIncomingCallInfo.iValid |= RMobileCall::KCallEmergency;
       
  3702         }
       
  3703     // No else
       
  3704 
       
  3705     // Check if GSM sub blocks present
       
  3706     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3707         ISI_HEADER_SIZE + SIZE_CALL_MODEM_COMING_IND,
       
  3708         CALL_MODEM_SB_REDIRECTING_ADDRESS,
       
  3709         EIsiSubBlockTypeId8Len8,
       
  3710         sbStartOffSet ) )
       
  3711         {
       
  3712         // Get Address Length
       
  3713         TUint8 redirectingAddressLength( aIsiMessage.Get8bit(
       
  3714             sbStartOffSet + CALL_MODEM_SB_REDIRECTING_ADDRESS_OFFSET_ADDRLEN ) );
       
  3715 
       
  3716         // Get address
       
  3717         TPtrC8 address( aIsiMessage.GetData(
       
  3718             sbStartOffSet + CALL_MODEM_SB_REDIRECTING_ADDRESS_OFFSET_ADDR,
       
  3719             redirectingAddressLength * 2 ) );
       
  3720 
       
  3721 TFLOGSTRING("TSY: CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_REDIRECTING_ADDRESS");
       
  3722 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_CALLCOMINGIND, "CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_REDIRECTING_ADDRESS" );
       
  3723 
       
  3724         // If there is a redirection address, the call has been forwarded
       
  3725         // (but not vice versa; this information can come with another
       
  3726         // indication)
       
  3727         if ( NULL != address.Length() )
       
  3728             {
       
  3729             iIncomingCallInfo.iForwarded = ETrue;
       
  3730             iIncomingCallInfo.iValid |= RMobileCall::KCallForwarded;
       
  3731             }
       
  3732         // No else
       
  3733         }
       
  3734     // No else
       
  3735 
       
  3736     // Get unique call id (without possible generic id)
       
  3737     // (three bits (1-3) contain unique call ID)
       
  3738     iIncomingCallInfo.iCallId = static_cast<TInt>( aIsiMessage.Get8bit(
       
  3739         ISI_HEADER_SIZE + CALL_MODEM_COMING_IND_OFFSET_CALLID )
       
  3740             & KMaskBits1to3 );
       
  3741 
       
  3742     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3743         ISI_HEADER_SIZE + SIZE_CALL_MODEM_COMING_IND,
       
  3744         CALL_MODEM_SB_ORIGIN_ADDRESS,
       
  3745         EIsiSubBlockTypeId8Len8,
       
  3746         sbStartOffSet ) )
       
  3747         {
       
  3748         TUint8 origAddressType( aIsiMessage.Get8bit( sbStartOffSet +
       
  3749             CALL_MODEM_SB_ORIGIN_ADDRESS_OFFSET_ADDRTYPE ) );
       
  3750 
       
  3751         TUint8 origPresentInd( aIsiMessage.Get8bit(
       
  3752                     sbStartOffSet + CALL_MODEM_SB_ORIGIN_ADDRESS_OFFSET_PRESENTATION )
       
  3753                         & KMaskBits6to7 );
       
  3754 
       
  3755 
       
  3756         // Get Address Length
       
  3757         TUint8 callOriginAddressLength( aIsiMessage.Get8bit(
       
  3758             sbStartOffSet + CALL_MODEM_SB_ORIGIN_ADDRESS_OFFSET_ADDRLEN ) );
       
  3759 
       
  3760         // Get address (telephone number)
       
  3761         TPtrC8 address( aIsiMessage.GetData(
       
  3762             sbStartOffSet + CALL_MODEM_SB_ORIGIN_ADDRESS_OFFSET_ADDR,
       
  3763             callOriginAddressLength * 2 ) );
       
  3764 
       
  3765 TFLOGSTRING("TSY: CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_ORIGIN_ADDRESS");
       
  3766 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_CALLCOMINGIND, "CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_ORIGIN_ADDRESS" );
       
  3767 
       
  3768         // Check if number is international and addrDataLength is bigger
       
  3769         // than zero. The length of the string does not have to be checked
       
  3770         // since the original max length was 100. When the string was sent to
       
  3771         // ISA side the '+' character was cut off and now we just put it back.
       
  3772         // (three bits (5-7) contain type of number)
       
  3773         TBuf8<RMobilePhone::KMaxMobileTelNumberSize * 2> address2;
       
  3774         if ( ( CALL_MODEM_NBR_TYPE_INTERNATIONAL == ( origAddressType & KMaskBits5to7 ) )
       
  3775                && ( 0 != address.Length() ) )
       
  3776             {
       
  3777             // Add '+' character back to the string
       
  3778             address2.Append( KCallPadding ); // Padding
       
  3779             address2.Append( '+' );
       
  3780             }
       
  3781         // No else
       
  3782 
       
  3783         // Append tel number to address2
       
  3784         address2.Append( address );
       
  3785 
       
  3786         if ( 0 != address.Length() )
       
  3787             {
       
  3788             // Get address type
       
  3789             FillNumberPlanAndType( iIncomingCallInfo, origAddressType );
       
  3790             }
       
  3791         // No else
       
  3792 
       
  3793         TBuf16<RMobilePhone::KMaxMobileTelNumberSize> target;
       
  3794         // Copy 8-bit address to the 16-bit target using correct endianess
       
  3795         TIsiUtility::CopyFromBigEndian( address2, target );
       
  3796 
       
  3797         // Set target to the iAddress
       
  3798         FillRemoteStatusAndNumber(
       
  3799             iIncomingCallInfo,
       
  3800             origPresentInd,
       
  3801             target,
       
  3802             RMobileCall::EMobileTerminated );
       
  3803 
       
  3804         iIncomingCallInfo.iValid |= RMobileCall::KCallRemoteParty;
       
  3805         }
       
  3806     // No else
       
  3807 
       
  3808     // Call origin info
       
  3809     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3810         ISI_HEADER_SIZE + SIZE_CALL_MODEM_COMING_IND,
       
  3811         CALL_MODEM_SB_ORIGIN_INFO,
       
  3812         EIsiSubBlockTypeId8Len8,
       
  3813         sbStartOffSet ) )
       
  3814         {
       
  3815         // Get presentation indicator
       
  3816         // Mask with 0110 0000 to get bits 6-7
       
  3817         TUint8 origInfoPresentInd( aIsiMessage.Get8bit(
       
  3818             sbStartOffSet + CALL_MODEM_SB_ORIGIN_INFO_OFFSET_PRESENTATION )
       
  3819                 & KMaskBits6to7 );
       
  3820 
       
  3821         // Get name length
       
  3822         TUint8 callOriginInfoNameLength( aIsiMessage.Get8bit(
       
  3823             sbStartOffSet + CALL_MODEM_SB_ORIGIN_INFO_OFFSET_NAMELEN ) );
       
  3824 
       
  3825         // Get name
       
  3826         TPtrC8 name( aIsiMessage.GetData(
       
  3827             sbStartOffSet + CALL_MODEM_SB_ORIGIN_INFO_OFFSET_NAME,
       
  3828             callOriginInfoNameLength * 2 ) );
       
  3829 
       
  3830 TFLOGSTRING("TSY: CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_ORIGIN_INFO");
       
  3831 OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_CALLCOMINGIND, "CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_ORIGIN_INFO" );
       
  3832 
       
  3833         // Copy 8-bit name to the 16-bit target using correct endianess
       
  3834         TIsiUtility::CopyFromBigEndian( name, targetOrigName );
       
  3835 
       
  3836         // Set target to the iAddress
       
  3837         FillCallingName(
       
  3838             iIncomingCallInfo,
       
  3839             origInfoPresentInd,
       
  3840             targetOrigName );
       
  3841         }
       
  3842 
       
  3843     // Cause of no cli
       
  3844     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3845         ISI_HEADER_SIZE + SIZE_CALL_MODEM_COMING_IND,
       
  3846         CALL_MODEM_SB_CAUSE_OF_NO_CLI,
       
  3847         EIsiSubBlockTypeId8Len8,
       
  3848         sbStartOffSet ) )
       
  3849         {
       
  3850         // Get cause of no CLI
       
  3851         TUint8 mmCauseOfNoCli( aIsiMessage.Get8bit(
       
  3852             sbStartOffSet + CALL_MODEM_SB_CAUSE_OF_NO_CLI_OFFSET_CAUSE ) );
       
  3853 
       
  3854 TFLOGSTRING("TSY: CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_CAUSE_OF_NO_CLI");
       
  3855 OstTrace0( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_CALLCOMINGIND, "CMmCallMessHandler::CallComingInd -- CALL_MODEM_SB_CAUSE_OF_NO_CLI" );
       
  3856 
       
  3857         // Fill cause of no CLI
       
  3858         FillCauseOfNoCli(iIncomingCallInfo, mmCauseOfNoCli);
       
  3859         }
       
  3860 
       
  3861     }
       
  3862 
       
  3863 // -----------------------------------------------------------------------------
       
  3864 // CMmCallMessHandler::ResetIncomingCallInfo
       
  3865 // Resets all relevant fields of aIncomingCallInfo.
       
  3866 // -----------------------------------------------------------------------------
       
  3867 //
       
  3868 void CMmCallMessHandler::ResetIncomingCallInfo(
       
  3869     RMobileCall::TMobileCallInfoV1& aIncomingCallInfo ) const
       
  3870     {
       
  3871 TFLOGSTRING("TSY: CMmCallMessHandler::ResetIncomingCallInfo");
       
  3872 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_RESETINCOMINGCALLINFO, "CMmCallMessHandler::ResetIncomingCallInfo" );
       
  3873 
       
  3874     // Reset all fields that are used in aIncomingCallInfo
       
  3875     aIncomingCallInfo.iValid = 0;
       
  3876     aIncomingCallInfo.iService = RMobilePhone::EServiceUnspecified;
       
  3877     aIncomingCallInfo.iStatus = RMobileCall::EStatusUnknown;
       
  3878     aIncomingCallInfo.iCallId = KSymbianCallIdNone;
       
  3879     aIncomingCallInfo.iEmergency = EFalse;
       
  3880     aIncomingCallInfo.iForwarded = EFalse;
       
  3881     aIncomingCallInfo.iRemoteParty.iRemoteIdStatus =
       
  3882         RMobileCall::ERemoteIdentityUnknown;
       
  3883     aIncomingCallInfo.iRemoteParty.iDirection = RMobileCall::EDirectionUnknown;
       
  3884     aIncomingCallInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber =
       
  3885         RMobilePhone::EUnknownNumber;
       
  3886     aIncomingCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan =
       
  3887         RMobilePhone::EUnknownNumberingPlan;
       
  3888     aIncomingCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Zero();
       
  3889     aIncomingCallInfo.iRemoteParty.iCallingName.Zero();
       
  3890     }
       
  3891 
       
  3892 // -----------------------------------------------------------------------------
       
  3893 // CMmCallMessHandler::CallServiceDeniedInd
       
  3894 // This method breaks call service denied indication message and
       
  3895 // informs the Symbian OS layer about the received info.
       
  3896 // (other items were commented in a header).
       
  3897 // -----------------------------------------------------------------------------
       
  3898 //
       
  3899 void CMmCallMessHandler::CallServiceDeniedInd(
       
  3900     const TIsiReceiveC &aIsiMessage )
       
  3901     {
       
  3902 TFLOGSTRING("TSY: CMmCallMessHandler::CallServiceDeniedInd");
       
  3903 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CALLSERVICEDENIEDIND, "CMmCallMessHandler::CallServiceDeniedInd" );
       
  3904 
       
  3905     // Call service denied ind message
       
  3906 
       
  3907     TUint sbStartOffSet( 0 );
       
  3908 
       
  3909     // Introduce requested service
       
  3910     TInt serviceId( aIsiMessage.Get8bit( ISI_HEADER_SIZE +
       
  3911         CALL_MODEM_SERVICE_DENIED_IND_OFFSET_REQMESSAGEID ) );
       
  3912 
       
  3913     switch ( serviceId )
       
  3914         {
       
  3915         case CALL_MODEM_CREATE_REQ:
       
  3916             {
       
  3917             // If call create request fails, complete dial
       
  3918             // (used for data/video calls when dialled number has not
       
  3919             // been in the FDN list -> KCallCauseFdnNotOk).
       
  3920             if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  3921                 ISI_HEADER_SIZE + SIZE_CALL_MODEM_SERVICE_DENIED_IND,
       
  3922                 CALL_MODEM_SB_CAUSE,
       
  3923                 EIsiSubBlockTypeId8Len8,
       
  3924                 sbStartOffSet ) )
       
  3925                 {
       
  3926                 // Get cause type
       
  3927                 TUint8 causeType( aIsiMessage.Get8bit(
       
  3928                     sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSETYPE ) );
       
  3929 
       
  3930                 // Get cause value
       
  3931                 TUint8 causeValue( aIsiMessage.Get8bit(
       
  3932                     sbStartOffSet + CALL_MODEM_SB_CAUSE_OFFSET_CAUSE ) );
       
  3933 
       
  3934                 if ( CALL_MODEM_CAUSE_FDN_NOT_OK == causeValue &&
       
  3935                      EFalse == iFDNErrorAlredyNotified )
       
  3936                     {
       
  3937                     // If not notified from CallCreateResp
       
  3938                     // map cause to epoc error
       
  3939                     TInt result( CMmStaticUtility::CSCauseToEpocError(
       
  3940                         PN_MODEM_CALL,
       
  3941                         causeType,
       
  3942                         causeValue ) );
       
  3943 
       
  3944                     // Create call package
       
  3945                     CCallDataPackage callData;
       
  3946                     // Pack the data for sending to the manager
       
  3947                     // (no call id or service type available)
       
  3948                     callData.SetCallIdAndMode(
       
  3949                         CALL_MODEM_ID_NONE,
       
  3950                         RMobilePhone::ECircuitDataService );
       
  3951 
       
  3952                     if ( iIs3rdPartyDial )
       
  3953                         {
       
  3954                         // If 3rd party application, process is over
       
  3955                         iIs3rdPartyDial = EFalse;
       
  3956 
       
  3957                         // Complete failed dial request with error value
       
  3958                         iMessageRouter->Complete(
       
  3959                             EMobileCallDialISV,
       
  3960                             &callData,
       
  3961                             result );
       
  3962                         }
       
  3963                     else
       
  3964                         {
       
  3965                         // Complete failed dial request with error value
       
  3966                         iMessageRouter->Complete(
       
  3967                             EEtelCallDial,
       
  3968                             &callData,
       
  3969                             result );
       
  3970                         }
       
  3971                     }
       
  3972                 // No else
       
  3973 
       
  3974                 if ( CALL_MODEM_CAUSE_FDN_NOT_OK == causeValue )
       
  3975                     {
       
  3976                     iFDNErrorAlredyNotified = EFalse;
       
  3977                     }
       
  3978                 // No else
       
  3979                 }
       
  3980             // No else
       
  3981             break;
       
  3982             }
       
  3983         default:
       
  3984             {
       
  3985 TFLOGSTRING("TSY: CMmCallMessHandler::CallServiceDeniedInd. Switch serviceId case default.");
       
  3986 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CALLSERVICEDENIEDIND, "CMmCallMessHandler::CallServiceDeniedInd. Switch serviceId case default." );
       
  3987             break;
       
  3988             }
       
  3989         }
       
  3990     }
       
  3991 
       
  3992 // -----------------------------------------------------------------------------
       
  3993 // CMmCallMessHandler::CheckCallIsaStatus
       
  3994 // Checks call Isa status
       
  3995 // (other items were commented in a header).
       
  3996 // -----------------------------------------------------------------------------
       
  3997 //
       
  3998 void CMmCallMessHandler::CheckCallIsaStatus(
       
  3999     RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  4000     TUint8 aCallStatusISA
       
  4001     )
       
  4002     {
       
  4003 TFLOGSTRING2("TSY: CMmCallMessHandler::CheckCallIsaStatus. callstatusisa:%d", aCallStatusISA);
       
  4004 OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_CHECKCALLISASTATUS, "CMmCallMessHandler::CheckCallIsaStatus;aCallStatusISA=%hhu", aCallStatusISA );
       
  4005 
       
  4006     // Check which status we got
       
  4007     if ( CALL_MODEM_STATUS_MT_RELEASE == aCallStatusISA )
       
  4008         {
       
  4009         // Complete remote release event notification
       
  4010         RMobileCall::TMobileCallEvent callEvent(
       
  4011             RMobileCall::ERemoteTerminated );
       
  4012 
       
  4013         // Call Data Package
       
  4014         CCallDataPackage callData;
       
  4015         callData.SetCallIdAndMode(
       
  4016             aMobileCallInfo.iCallId,
       
  4017             aMobileCallInfo.iService );
       
  4018 
       
  4019         // Pack the data for sending to the manager
       
  4020         callData.PackData( &callEvent );
       
  4021         // Compete notification
       
  4022         iMessageRouter->Complete(
       
  4023             EMobileCallNotifyCallEvent,
       
  4024             &callData,
       
  4025             KErrNone );
       
  4026 
       
  4027         // Reset temporary call info
       
  4028         if ( aMobileCallInfo.iCallId == iIncomingCallInfo.iCallId )
       
  4029             {
       
  4030             ResetIncomingCallInfo( iIncomingCallInfo );
       
  4031             }
       
  4032         // No else
       
  4033         }
       
  4034     else if ( CALL_MODEM_STATUS_IDLE == aCallStatusISA &&
       
  4035             aMobileCallInfo.iCallId == iIncomingCallInfo.iCallId )
       
  4036         {
       
  4037         // Reset temporary call info
       
  4038         ResetIncomingCallInfo( iIncomingCallInfo );
       
  4039         }
       
  4040     // No else
       
  4041     }
       
  4042 
       
  4043 // -----------------------------------------------------------------------------
       
  4044 // CMmCallMessHandler::ReadAllDestinationAddress
       
  4045 // Read all address destination
       
  4046 // (other items were commented in a header).
       
  4047 // -----------------------------------------------------------------------------
       
  4048 //
       
  4049 void CMmCallMessHandler::ReadAllAddressDestination(
       
  4050     RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  4051     TBuf16<RMobilePhone::KMaxMobileTelNumberSize>& aTargetOrig,
       
  4052     const TIsiReceiveC &aIsiMessage,
       
  4053     TUint& aSbStartOffSet,
       
  4054     TUint8 origPresentInd
       
  4055     )
       
  4056     {
       
  4057 TFLOGSTRING("TSY: CMmCallMessHandler::ReadAllAddressDestination");
       
  4058 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_READALLADDRESSDESTINATION, "CMmCallMessHandler::ReadAllAddressDestination" );
       
  4059 
       
  4060     TUint8 origAddressType( aIsiMessage.Get8bit(
       
  4061         aSbStartOffSet + CALL_MODEM_SB_DESTINATION_ADDRESS_OFFSET_ADDRTYPE ) );
       
  4062 
       
  4063 
       
  4064     // Get destinationAddress Length
       
  4065     TUint8 destinationAddressLength( aIsiMessage.Get8bit(
       
  4066         aSbStartOffSet + CALL_MODEM_SB_DESTINATION_ADDRESS_OFFSET_ADDRLEN ) );
       
  4067 
       
  4068     // Get address (telephone number)
       
  4069     TPtrC8 address( aIsiMessage.GetData(
       
  4070         aSbStartOffSet + CALL_MODEM_SB_DESTINATION_ADDRESS_OFFSET_ADDR,
       
  4071         destinationAddressLength * 2 ) );
       
  4072 
       
  4073     TBuf8<RMobilePhone::KMaxMobileTelNumberSize * 2> address2;
       
  4074 
       
  4075     // Check if the prefix should be added to the dialled number.
       
  4076     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  4077         ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
       
  4078         CALL_MODEM_SB_DESTINATION_PRE_ADDRESS,
       
  4079         EIsiSubBlockTypeId8Len8,
       
  4080         aSbStartOffSet ) )
       
  4081         {
       
  4082 TFLOGSTRING("TSY: CMmCallMessHandler::ReadAllAddressDestination: CALL_MODEM_SB_DESTINATION_PRE_ADDRESS");
       
  4083 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_READALLADDRESSDESTINATION, "CMmCallMessHandler::ReadAllAddressDestination: CALL_MODEM_SB_DESTINATION_PRE_ADDRESS" );
       
  4084 
       
  4085         // Get destination address length
       
  4086         TUint8 destinationPreAddressLength( aIsiMessage.Get8bit(
       
  4087             aSbStartOffSet + CALL_MODEM_SB_DESTINATION_PRE_ADDRESS_OFFSET_ADDRLEN ) );
       
  4088 
       
  4089         // Get address (telephone number)
       
  4090         TPtrC8 preAddress( aIsiMessage.GetData(
       
  4091             aSbStartOffSet + CALL_MODEM_SB_DESTINATION_PRE_ADDRESS_OFFSET_ADDR,
       
  4092             destinationPreAddressLength * 2 ) );
       
  4093 
       
  4094         if ( 0 < destinationPreAddressLength )
       
  4095             {
       
  4096             address2.Append( preAddress );
       
  4097             }
       
  4098         }
       
  4099 
       
  4100     // Check if number is international and addrDataLength is bigger
       
  4101     // than zero. The length of the string does not have to be checked
       
  4102     // since the original max length was 100. When the string was sent
       
  4103     // to ISA side the '+' character was cut off and now we just put
       
  4104     // it back. (three bits (5-7) contain type of number)
       
  4105     if ( ( CALL_MODEM_NBR_TYPE_INTERNATIONAL ==
       
  4106          ( origAddressType & KMaskBits5to7 ) )
       
  4107          && ( 0 != address.Length() ) )
       
  4108         {
       
  4109         // Add '+' character back to the string
       
  4110         address2.Append( KCallPadding ); // Padding
       
  4111         address2.Append( '+' );
       
  4112         }
       
  4113     // No else
       
  4114 
       
  4115     address2.Append( address ); //append tel number to address2
       
  4116 
       
  4117     // Check if the postfix should be added to the dialled number.
       
  4118     if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  4119         ISI_HEADER_SIZE + SIZE_CALL_MODEM_STATUS_IND,
       
  4120         CALL_MODEM_SB_DESTINATION_POST_ADDRESS,
       
  4121         EIsiSubBlockTypeId8Len8,
       
  4122         aSbStartOffSet ) )
       
  4123         {
       
  4124 TFLOGSTRING("TSY: CMmCallMessHandler::ReadAllAddressDestination: CALL_MODEM_SB_DESTINATION_POST_ADDRESS");
       
  4125 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_READALLADDRESSDESTINATION, "CMmCallMessHandler::ReadAllAddressDestination: CALL_MODEM_SB_DESTINATION_POST_ADDRESS" );
       
  4126 
       
  4127         // Get destinationAddress Length
       
  4128         TUint8 destinationPostAddressLength( aIsiMessage.Get8bit(
       
  4129             aSbStartOffSet + CALL_MODEM_SB_DESTINATION_POST_ADDRESS_OFFSET_ADDRLEN ) );
       
  4130 
       
  4131         // Get address (telephone number)
       
  4132         TPtrC8 postAddress( aIsiMessage.GetData(
       
  4133             aSbStartOffSet + CALL_MODEM_SB_DESTINATION_POST_ADDRESS_OFFSET_ADDR,
       
  4134             destinationPostAddressLength * 2 ) );
       
  4135 
       
  4136         if ( 0 < destinationPostAddressLength )
       
  4137             {
       
  4138             address2.Append( postAddress );
       
  4139             }
       
  4140         }
       
  4141 
       
  4142     if ( NULL != address.Length() )
       
  4143         {
       
  4144         // Get address type
       
  4145         FillNumberPlanAndType( aMobileCallInfo, origAddressType );
       
  4146         }
       
  4147     // No else
       
  4148 
       
  4149     // Copy 8-bit address to the 16-bit target using correct endianess
       
  4150     TIsiUtility::CopyFromBigEndian( address2, aTargetOrig );
       
  4151 
       
  4152 TFLOGSTRING2("TSY: CMmCallMessHandler::ReadAllAddressDestination: aTargetOrig = %S", &aTargetOrig);
       
  4153 OstTraceExt1( TRACE_NORMAL, DUP19_CMMCALLMESSHANDLER_CallStatusIndL, "CMmCallMessHandler::ReadAllDestinationAddress;aTargetOrig=%S", aTargetOrig );
       
  4154     FillRemoteStatusAndNumber(
       
  4155         aMobileCallInfo,
       
  4156         origPresentInd,
       
  4157         aTargetOrig,
       
  4158         RMobileCall::EMobileOriginated );
       
  4159 
       
  4160     aMobileCallInfo.iValid |=
       
  4161         RMobileCall::KCallRemoteParty | RMobileCall::KCallDialledParty;
       
  4162     }
       
  4163 
       
  4164 // -----------------------------------------------------------------------------
       
  4165 // CMmCallMessHandler::ReadCallInfo
       
  4166 // Read All Address Destination
       
  4167 // (other items were commented in a header).
       
  4168 // -----------------------------------------------------------------------------
       
  4169 //
       
  4170 void CMmCallMessHandler::ReadCallInfo(
       
  4171     RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  4172     TBuf16<RMobileCall::KCallingNameSize>& aTargetOrigName,
       
  4173     const TIsiReceiveC &aIsiMessage,
       
  4174     TUint& aSbStartOffSet
       
  4175     )
       
  4176     {
       
  4177 TFLOGSTRING("TSY: CMmCallMessHandler::ReadCallInfo");
       
  4178 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_READCALLINFO, "CMmCallMessHandler::ReadCallInfo" );
       
  4179 
       
  4180      // Get presentation indicator (four bits (1-4))
       
  4181     TUint8 origInfoPresentInd( aIsiMessage.Get8bit(
       
  4182         aSbStartOffSet + CALL_MODEM_SB_ORIGIN_INFO_OFFSET_PRESENTATION ) &
       
  4183         KMaskBits5to7 );
       
  4184 
       
  4185     // Get call origin info name length
       
  4186     TUint8 callOriginInfoNameLength( aIsiMessage.Get8bit(
       
  4187         aSbStartOffSet + CALL_MODEM_SB_ORIGIN_INFO_OFFSET_NAMELEN ) );
       
  4188 
       
  4189     // Get name
       
  4190     TPtrC8 name( aIsiMessage.GetData(
       
  4191         aSbStartOffSet + CALL_MODEM_SB_ORIGIN_INFO_OFFSET_NAME,
       
  4192         callOriginInfoNameLength * 2 ) );
       
  4193 
       
  4194     // Copy 8-bit name to the 16-bit target using correct endianess
       
  4195     TIsiUtility::CopyFromBigEndian( name, aTargetOrigName );
       
  4196 
       
  4197     // Fill calling name
       
  4198     FillCallingName(
       
  4199         aMobileCallInfo,
       
  4200         origInfoPresentInd,
       
  4201         aTargetOrigName );
       
  4202     }
       
  4203 
       
  4204 // -----------------------------------------------------------------------------
       
  4205 // CMmCallMessHandler::CompleteIncomingCallNotif
       
  4206 // Complete incoming Call Notification
       
  4207 // (other items were commented in a header).
       
  4208 // -----------------------------------------------------------------------------
       
  4209 //
       
  4210 void CMmCallMessHandler::CompleteIncomingCallNotif(
       
  4211     RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  4212     RMobileCall::TMobileCallStatus& aStatusETel
       
  4213     )
       
  4214     {
       
  4215 TFLOGSTRING("TSY: CMmCallMessHandler::CompleteIncomingCallNotif");
       
  4216 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_COMPLETEINCOMINGCALLNOTIF, "CMmCallMessHandler::CompleteIncomingCallNotif" );
       
  4217 
       
  4218     if ( RMobileCall::EStatusRinging == aStatusETel )
       
  4219         {
       
  4220         // If call has been waiting, it is already notified
       
  4221         // (see error item MEKK-5ZMKHG).
       
  4222         if ( iWaitingCall != aMobileCallInfo.iCallId )
       
  4223             {
       
  4224             // Call data package
       
  4225             CCallDataPackage callData;
       
  4226             callData.SetCallIdAndMode(
       
  4227                 aMobileCallInfo.iCallId,
       
  4228                 aMobileCallInfo.iService );
       
  4229 
       
  4230             // Pack mobile call info
       
  4231             callData.PackData( &aMobileCallInfo );
       
  4232 
       
  4233             // Complete IncomingCall notification
       
  4234 TFLOGSTRING("TSY: CMmCallMessHandler::CompleteIncomingCallNotif - iWaitingCall != aMobileCallInfo.iCallId");
       
  4235 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_COMPLETEINCOMINGCALLNOTIF, "CMmCallMessHandler::CompleteIncomingCallNotif - iWaitingCall != aMobileCallInfo.iCallId" );
       
  4236 
       
  4237             iMessageRouter->Complete(
       
  4238                 EEtelLineNotifyIncomingCall,
       
  4239                 &callData,
       
  4240                 KErrNone );
       
  4241 
       
  4242             // If UUS data found complete Receive UUI.
       
  4243             // Receive UUI is always completed after notify incoming call.
       
  4244             if ( 0 < iReceivedUusData.Length() )
       
  4245                 {
       
  4246 TFLOGSTRING("TSY: CMmCallMessHandler::CompleteIncomingCallNotif - Completing receive uui");
       
  4247 OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_COMPLETEINCOMINGCALLNOTIF, "CMmCallMessHandler::CompleteIncomingCallNotif - Completing receive uui" );
       
  4248 
       
  4249                 callData.PackData( &iReceivedUusData );
       
  4250                 iMessageRouter->Complete(
       
  4251                     EMobileCallReceiveUUI,
       
  4252                     &callData,
       
  4253                     KErrNone );
       
  4254 
       
  4255                 iReceivedUusData.Zero();
       
  4256                 }
       
  4257             }
       
  4258         // No else
       
  4259 
       
  4260         }
       
  4261     // No else
       
  4262     }
       
  4263 
       
  4264 // -----------------------------------------------------------------------------
       
  4265 // CMmCallMessHandler::CompleteMobileCallInfoAndStatusChange
       
  4266 // Complete Mobile Call Info and Status Change
       
  4267 // (other items were commented in a header).
       
  4268 // -----------------------------------------------------------------------------
       
  4269 //
       
  4270 void CMmCallMessHandler::CompleteMobileCallInfoAndStatusChange(
       
  4271     RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  4272     RMobileCall::TMobileCallStatus& aStatusETel,
       
  4273     TInt aResultETel )
       
  4274     {
       
  4275 TFLOGSTRING("TSY: CMmCallMessHandler::CompleteMobileCallInfoChange");
       
  4276 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_COMPLETEMOBILECALLINFOANDSTATUSCHANGE, "CMmCallMessHandler::CompleteMobileCallInfoAndStatusChange" );
       
  4277 
       
  4278 TFLOGSTRING3("TSY: CMmCallMessHandler::CompleteMobileCallInfoAndStatusChange;aStatusETel=%d;aResultETel=%d", aStatusETel, aResultETel);
       
  4279 TFLOGSTRING2("TSY: CMmCallMessHandler::CompleteMobileCallInfoAndStatusChange;aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber=%S", &aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber);
       
  4280 TFLOGSTRING2("TSY: CMmCallMessHandler::CompleteMobileCallInfoAndStatusChange;aMobileCallInfo.iValid=%x", aMobileCallInfo.iValid);
       
  4281 OstTraceExt2( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_COMPLETEMOBILECALLINFOANDSTATUSCHANGE, "CMmCallMessHandler::CompleteMobileCallInfoAndStatusChange;aStatusETel=%d;aResultETel=%d", aStatusETel, aResultETel );
       
  4282 OstTraceExt1( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_COMPLETEMOBILECALLINFOANDSTATUSCHANGE, "CMmCallMessHandler::CompleteMobileCallInfoAndStatusChange;aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber=%S", aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber );
       
  4283 OstTrace1( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_COMPLETEMOBILECALLINFOANDSTATUSCHANGE, "CMmCallMessHandler::CompleteMobileCallInfoAndStatusChange;aMobileCallInfo.iValid=%x", aMobileCallInfo.iValid );
       
  4284 
       
  4285     // Call data package
       
  4286     CCallDataPackage callData;
       
  4287     callData.SetCallIdAndMode(
       
  4288         aMobileCallInfo.iCallId,
       
  4289         aMobileCallInfo.iService );
       
  4290 
       
  4291     // COMPLETE MOBILE CALL INFO CHANGE
       
  4292     // (Get mobile call information is always completed
       
  4293     // before call status change)
       
  4294     callData.PackData( &aMobileCallInfo );
       
  4295     iMessageRouter->Complete(
       
  4296         EMobileCallGetMobileCallInfo,
       
  4297         &callData,
       
  4298         KErrNone );
       
  4299 
       
  4300     // COMPLETE MOBILE CALL STATUS CHANGE
       
  4301     callData.PackData( &aStatusETel );
       
  4302     iMessageRouter->Complete(
       
  4303         EMobileCallNotifyMobileCallStatusChange,
       
  4304         &callData,
       
  4305         aResultETel );
       
  4306     }
       
  4307 // -----------------------------------------------------------------------------
       
  4308 // CMmCallMessHandler::HandleError
       
  4309 // Handles CMmCallMessHandler's errors that comes
       
  4310 // via PhoNetReceiver RunError method.
       
  4311 // (other items were commented in a header).
       
  4312 // -----------------------------------------------------------------------------
       
  4313 //
       
  4314 void CMmCallMessHandler::HandleError(
       
  4315     const TIsiReceiveC& /*aIsiMessage*/,
       
  4316     TInt /*aError*/ )
       
  4317     {
       
  4318     // None
       
  4319 TFLOGSTRING("TSY: CMmCallMessHandler::HandleError.");
       
  4320 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_HANDLEERROR, "CMmCallMessHandler::HandleError" );
       
  4321     }
       
  4322 
       
  4323 // -----------------------------------------------------------------------------
       
  4324 // CMmCallMessHandler::FillCauseOfNoCli
       
  4325 // This method maps the Domestic OS cause of no CLI (Calling Line ID) to the
       
  4326 // Symbian OS remote information.
       
  4327 // (other items were commented in a header).
       
  4328 // -----------------------------------------------------------------------------
       
  4329 //
       
  4330 void CMmCallMessHandler::FillCauseOfNoCli(
       
  4331     RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  4332     TUint8 aCauseOfNoCli )
       
  4333     {
       
  4334 TFLOGSTRING2("TSY: CMmCallMessHandler::FillCauseOfNoCli. cause:%d", aCauseOfNoCli);
       
  4335 OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_FILLCAUSEOFNOCLI, "CMmCallMessHandler::FillCauseOfNoCli;aCauseOfNoCli=%hhu", aCauseOfNoCli );
       
  4336 
       
  4337     switch( aCauseOfNoCli )
       
  4338         {
       
  4339         // Cause of No CLI is "reject by user"
       
  4340         case CALL_MODEM_CLI_REJECT_BY_USER:
       
  4341             {
       
  4342             aMobileCallInfo.iRemoteParty.iRemoteIdStatus
       
  4343                 = RMobileCall::ERemoteIdentityAvailableNoCliRejectedByUser;
       
  4344             break;
       
  4345             }
       
  4346         // Cause of No CLI is "interaction with other service"
       
  4347         case CALL_MODEM_CLI_INTERACTION:
       
  4348             {
       
  4349             if (RMobileCall::ERemoteIdentityAvailable ==
       
  4350                 aMobileCallInfo.iRemoteParty.iRemoteIdStatus )
       
  4351                 {
       
  4352                 aMobileCallInfo.iRemoteParty.iRemoteIdStatus
       
  4353                   = RMobileCall::
       
  4354                     ERemoteIdentityAvailableNoCliInteractionWithOtherService;
       
  4355                 }
       
  4356             else
       
  4357                 {
       
  4358                 aMobileCallInfo.iRemoteParty.iRemoteIdStatus
       
  4359                  = RMobileCall::
       
  4360                    ERemoteIdentityUnavailableNoCliInteractionWithOtherService;
       
  4361                 }
       
  4362             break;
       
  4363             }
       
  4364         // Cause of No CLI is "Coin Line/ Payphone"
       
  4365         case CALL_MODEM_CLI_COIN_LINE_PAYPHONE:
       
  4366             {
       
  4367             if (RMobileCall::ERemoteIdentityAvailable ==
       
  4368                 aMobileCallInfo.iRemoteParty.iRemoteIdStatus )
       
  4369                 {
       
  4370                 aMobileCallInfo.iRemoteParty.iRemoteIdStatus
       
  4371                   = RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone;
       
  4372                 }
       
  4373             else
       
  4374                 {
       
  4375                 aMobileCallInfo.iRemoteParty.iRemoteIdStatus
       
  4376                  = RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone;
       
  4377                 }
       
  4378             break;
       
  4379             }
       
  4380         // Cause of No CLI is "unavailable"
       
  4381         case CALL_MODEM_CLI_UNAVAILABLE:
       
  4382             {
       
  4383             aMobileCallInfo.iRemoteParty.iRemoteIdStatus
       
  4384                 = RMobileCall::ERemoteIdentityAvailableNoCliUnavailable;
       
  4385             break;
       
  4386             }
       
  4387         default:
       
  4388             {
       
  4389 TFLOGSTRING("TSY: CMmCallMessHandler::FillCauseOfNoCli. Switch cause case default");
       
  4390 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_FILLCAUSEOFNOCLI, "CMmCallMessHandler::FillCauseOfNoCli. Switch cause case default" );
       
  4391             // Keep aMobileCallInfo.iRemoteParty.iRemoteIdStatus unchanged
       
  4392             break;
       
  4393             }
       
  4394         }
       
  4395     }
       
  4396 
       
  4397 // -----------------------------------------------------------------------------
       
  4398 // CMmCallMessHandler::InitializeDataportL
       
  4399 // Initializes dataport if it doesn't exist already
       
  4400 // -----------------------------------------------------------------------------
       
  4401 //
       
  4402 void CMmCallMessHandler::InitializeDataportL()
       
  4403     {
       
  4404 TFLOGSTRING("NTSY: CMmCallMessHandler::InitializeDataportL()");
       
  4405 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_INITIALIZEDATAPORTL, "CMmCallMessHandler::InitializeDataportL" );
       
  4406 
       
  4407     // SIM is ready, start dataport handling
       
  4408     if ( !iDataPortHandler )
       
  4409         {
       
  4410 TFLOGSTRING("NTSY: CMmCallMessHandler::InitializeDataportL - Start dataport handling");
       
  4411 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_INITIALIZEDATAPORTL, "CMmCallMessHandler::InitializeDataportL - Start dataport handling" );
       
  4412         // Deleted in CMmCallMessHandler::~CMmCallMessHandler()
       
  4413         iDataPortHandler = CMmDataPortHandler::NewL( iMessageRouter );
       
  4414         }
       
  4415     }
       
  4416 
       
  4417 // -----------------------------------------------------------------------------
       
  4418 // CMmCallMessHandler::ActivateUUS()
       
  4419 // Copying received data to the member variable which means UUS is activated
       
  4420 // -----------------------------------------------------------------------------
       
  4421 //
       
  4422 TInt CMmCallMessHandler::ActivateUUS(
       
  4423     const CMmDataPackage* aDataPackage )
       
  4424     {
       
  4425 TFLOGSTRING( "TSY: CMmCallMessHandler::ActivateUUS. Unpacking UUS data." );
       
  4426 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_ACTIVATEUUS, "CMmCallMessHandler::ActivateUUS" );
       
  4427 
       
  4428     TInt ret( KErrNone );
       
  4429 
       
  4430     // Reset obsolated data... just in case
       
  4431     iUusData.iUUI.Zero();
       
  4432     iUusData.iServiceReq = 0;
       
  4433 
       
  4434     // Unpack data
       
  4435     aDataPackage->UnPackData( iUusData );
       
  4436 
       
  4437     if ( RMobileCall::KUUS1Implicit != iUusData.iServiceReq )
       
  4438         {
       
  4439 TFLOGSTRING2( "TSY: CMmCallMessHandler::ActivateUUS. Service type is not supported (%d)!", iUusData.iServiceReq );
       
  4440 OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_ACTIVATEUUS, "CMmCallMessHandler::ActivateUUS;Service type is not supported (%d)", iUusData.iServiceReq );
       
  4441         ret = KErrNotSupported;
       
  4442         }
       
  4443 
       
  4444     return ret;
       
  4445     }
       
  4446 
       
  4447 // -----------------------------------------------------------------------------
       
  4448 // CMmCallMessHandler::InfoPpDataReadReq
       
  4449 // Creates Product Profile request, in order to read if HSDPA is disabled in PP.
       
  4450 // status.
       
  4451 // -----------------------------------------------------------------------------
       
  4452 //
       
  4453 void CMmCallMessHandler::InfoPpDataReadReq()
       
  4454     {
       
  4455 TFLOGSTRING( "TSY: CMmCallMessHandler::InfoPpDataReadReq" );
       
  4456 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_INFOPPDATAREADREQ, "CMmCallMessHandler::InfoPpDataReadReq" );
       
  4457 
       
  4458     // Create INFO_SB_PP_DATA subblock with only one PP feature (12 bytes)
       
  4459     TBuf8<12> infoSbPpBuf;
       
  4460     TIsiSubBlock infoSbPp(
       
  4461         infoSbPpBuf,
       
  4462         INFO_SB_PP_DATA,
       
  4463         EIsiSubBlockTypeId8Len16 );
       
  4464     infoSbPpBuf.Append( 0 ); // Customer ID
       
  4465     infoSbPpBuf.Append( KCallPadding ); // Filler
       
  4466 
       
  4467     // Append PP feature amount (1) as 16-bit value (high byte / low byte)
       
  4468     infoSbPpBuf.Append( 0 );
       
  4469     infoSbPpBuf.Append( 1 );
       
  4470 
       
  4471     // Append PP feature number (INFO_PP_WCDMA_HS_CHANNEL_SUPPORT) as 16-bit
       
  4472     // value (high byte / low byte)
       
  4473     infoSbPpBuf.Append( static_cast<TUint8>(
       
  4474         INFO_PP_WCDMA_HS_CHANNEL_SUPPORT >> KShiftByOneByte ) );
       
  4475     infoSbPpBuf.Append( static_cast<TUint8>(
       
  4476         INFO_PP_WCDMA_HS_CHANNEL_SUPPORT ) );
       
  4477 
       
  4478     // Append PP feature value (empty) as 16-bit value (high byte / low byte)
       
  4479     infoSbPpBuf.Append( 0 );
       
  4480     infoSbPpBuf.Append( 0 );
       
  4481 
       
  4482     // Create INFO_PP_READ_REQ message:
       
  4483     // batch mode (1) + number of SB (1) + INFO_SB_PP_DATA sub block with
       
  4484     // only one PP feature (12)
       
  4485     TBuf8<14> infoPpReadReq;
       
  4486 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  4487     infoPpReadReq.Append( INFO_PP_PROD_PROFILE_FEATURE ); // No batch reading
       
  4488 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  4489     infoPpReadReq.Append( INFO_PP_FEATURE ); // No batch reading
       
  4490 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  4491     infoPpReadReq.Append( 1 ); // One sub block
       
  4492     infoPpReadReq.Append( infoSbPp.CompleteSubBlock() );
       
  4493 
       
  4494     // Ignore return value
       
  4495     iPhoNetSender->Send(
       
  4496 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  4497         PN_INFO,
       
  4498 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  4499         PN_MODEM_INFO,
       
  4500 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  4501         KHsdpaPpTransId,
       
  4502         INFO_PP_DATA_READ_REQ,
       
  4503         infoPpReadReq );
       
  4504     }
       
  4505 
       
  4506 // -----------------------------------------------------------------------------
       
  4507 // CMmCallMessHandler::InfoPpDataReadResp
       
  4508 // Breaks received InfoPpDataReadResp ISI message.
       
  4509 // -----------------------------------------------------------------------------
       
  4510 //
       
  4511 void CMmCallMessHandler::InfoPpDataReadResp(
       
  4512     const TIsiReceiveC &aIsiMessage )
       
  4513     {
       
  4514     TUint8 status = aIsiMessage.Get8bit(
       
  4515         ISI_HEADER_SIZE + INFO_PP_DATA_READ_RESP_OFFSET_STATUS );
       
  4516 TFLOGSTRING2( "TSY: CMmCallMessHandler::InfoPpDataReadResp, status=%d.", status );
       
  4517 OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_INFOPPDATAREADRESP, "CMmCallMessHandler::InfoPpDataReadResp;status=%hhu", status );
       
  4518 
       
  4519     // iHSDPADisabledInPp is EFalse by default, change only if PP bit
       
  4520     // is set to "HSDPA_HSUPA_DISABLED".
       
  4521     if ( INFO_OK == status )
       
  4522         {
       
  4523         TUint sbStartOffset( 0 );
       
  4524         if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
       
  4525             ISI_HEADER_SIZE + SIZE_INFO_PP_DATA_READ_RESP,
       
  4526             INFO_SB_PP_DATA,
       
  4527             EIsiSubBlockTypeId8Len16,
       
  4528             sbStartOffset ) )
       
  4529             {
       
  4530             TUint32 ppData( aIsiMessage.Get32bit(
       
  4531                 sbStartOffset + INFO_SB_PP_DATA_OFFSET_PPFEAVAL ) );
       
  4532             TUint16 ppFeatureValue( ppData & 0x0000FFFF );
       
  4533             if ( INFO_PP_WCDMA_HS_CHANNEL_SUPPORT_HSDPA_HSUPA_DISABLED
       
  4534                     == ppFeatureValue )
       
  4535                 {
       
  4536                 iHSDPADisabledInPp = ETrue;
       
  4537 TFLOGSTRING( "TSY: CMmCallMessHandler::InfoPpDataReadResp: HSDPA is disabled in PP." );
       
  4538 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_INFOPPDATAREADRESP, "CMmCallMessHandler::InfoPpDataReadResp: HSDPA is disabled in PP" );
       
  4539                 } // No else, ignore other values
       
  4540             } // No else, ignore missing sub block
       
  4541         } // No else, ignore failed reading
       
  4542     }
       
  4543 
       
  4544 // -----------------------------------------------------------------------------
       
  4545 // CMmCallMessHandler::GpdsContextsClearReq
       
  4546 // Creates GPDS_CONTEXTS_CLEAR request, in order to end all data connections.
       
  4547 // -----------------------------------------------------------------------------
       
  4548 //
       
  4549 void CMmCallMessHandler::GpdsContextsClearReq()
       
  4550     {
       
  4551 TFLOGSTRING( "TSY: CMmCallMessHandler::GpdsContextsClearReq" );
       
  4552 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_GPDSCONTEXTSCLEARREQ, "CMmCallMessHandler::GpdsContextsClearReq" );
       
  4553 
       
  4554     // Start emergency timer
       
  4555     iEmergencyTimer.StartEmergencyTimer();
       
  4556 
       
  4557     // Ignore return value
       
  4558     iPhoNetSender->Send(
       
  4559         PN_GPDS,
       
  4560         KCallTransId,
       
  4561         GPDS_CONTEXTS_CLEAR_REQ,
       
  4562         KNullDesC8 );
       
  4563     }
       
  4564 
       
  4565 // -----------------------------------------------------------------------------
       
  4566 // CMmCallMessHandler::GpdsContextsClearResp
       
  4567 // Breaks received GPDS_CONTEXTS_CLEAR_RESP ISI message, and proceeds with
       
  4568 // emergency call dialling.
       
  4569 // -----------------------------------------------------------------------------
       
  4570 //
       
  4571 void CMmCallMessHandler::GpdsContextsClearResp()
       
  4572     {
       
  4573 TFLOGSTRING( "TSY: CMmCallMessHandler::GpdsContextsClearResp" );
       
  4574 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_GPDSCONTEXTSCLEARRESP, "CMmCallMessHandler::GpdsContextsClearResp" );
       
  4575 
       
  4576     // Stop emergency timer
       
  4577     iEmergencyTimer.StopEmergencyTimer();
       
  4578 
       
  4579     // When GPDS_CONTEXTS_CLEAR_RESP response comes, all data contexts have been
       
  4580     // shut down. Emergency call can now be set up.
       
  4581     if ( iEmergCallDelayed )
       
  4582         {
       
  4583 TFLOGSTRING( "TSY: CMmCallMessHandler::GpdsContextsClearResp - HSDPA workaround. Emergency call is created now." );
       
  4584 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_GPDSCONTEXTSCLEARRESP, "CMmCallMessHandler::GpdsContextsClearResp - HSDPA workaround. Emergency call is created now" );
       
  4585 
       
  4586         TIsiSend callReq( iPhoNetSender->SendBufferDes() );
       
  4587         TUint8 dosCallId( CALL_MODEM_ID_NONE );
       
  4588         // In the case when emergency number checking is needed to be ignored ¨
       
  4589         // the destination address is delivered
       
  4590         EmergencyCallCreateReq( &callReq );
       
  4591         // Emergency calls are created immediately, without
       
  4592         // setting properties
       
  4593         TUint8 messageId( CALL_MODEM_CREATE_REQ );
       
  4594         TUint8 isiCallId( CALL_MODEM_CREATE_REQ_OFFSET_CALLID );
       
  4595 
       
  4596         // Create ISI message
       
  4597         // Recource ID
       
  4598         callReq.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_CALL );
       
  4599         // Transaction ID
       
  4600         callReq.Set8bit( ISI_HEADER_OFFSET_TRANSID, KCallTransId );
       
  4601         // Message ID
       
  4602         callReq.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, messageId );
       
  4603         // Call ID
       
  4604         callReq.Set8bit( ISI_HEADER_SIZE + isiCallId, dosCallId );
       
  4605 
       
  4606         // Ignore return value
       
  4607         iPhoNetSender->Send( callReq.Complete() );
       
  4608 
       
  4609         iEmergCallDelayed = EFalse;
       
  4610         }
       
  4611     }
       
  4612 
       
  4613 // -----------------------------------------------------------------------------
       
  4614 // CMmCallMessHandler::GetCSDCallControlReqSubBlock
       
  4615 // This method constructs a subblock for the CSD call request.
       
  4616 // (other items were commented in a header).
       
  4617 // -----------------------------------------------------------------------------
       
  4618 //
       
  4619 void CMmCallMessHandler::GetCSDCallControlReqSubBlock(
       
  4620     const TDesC16& aTelNumber,
       
  4621     RMobileCall::TMobileCallIdRestriction aIdRestrict,
       
  4622     TIsiSend& aCsdIsiMsg,
       
  4623     TUint8& aNumOfSbInMsg,
       
  4624     TInt& aCurrentMsgOffset )
       
  4625     {
       
  4626 
       
  4627 TFLOGSTRING("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock");
       
  4628 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock" );
       
  4629 
       
  4630     iDestPostAddressIncluded = EFalse;
       
  4631 
       
  4632     // Get length of the given number
       
  4633     TInt telNumLength( aTelNumber.Length() );
       
  4634     TUint8 presentationInd( CSD_GSM_PRESENTATION_DEFAULT );
       
  4635 
       
  4636 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock - aIdRestrict: %d", aIdRestrict);
       
  4637 OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock;aIdRestrict=%d", aIdRestrict );
       
  4638 
       
  4639     if ( KTelephonyNumberMaxLength < telNumLength )
       
  4640         {
       
  4641         telNumLength = KTelephonyNumberMaxLength;
       
  4642         }
       
  4643 
       
  4644     TBool internationalAddr( EFalse );
       
  4645     TBool postAddressSupported( EFalse );
       
  4646     TBool preAddressSupported( EFalse );
       
  4647     TInt preAddressLength( 0 );
       
  4648     TInt destAddressStarts( 0 );
       
  4649     TInt postAddressStarts( 0 );
       
  4650 
       
  4651     // Destination address max length can be KTelephonyNumberMaxLength
       
  4652     TBuf16<KTelephonyNumberMaxLength> destAddress;
       
  4653 
       
  4654     // Check prefix address
       
  4655     if ( 0 < telNumLength &&
       
  4656         ( '*' == ( aTelNumber )[0] || '#' == ( aTelNumber )[0] ) )
       
  4657         {
       
  4658         for ( TInt i ( 1 ); i < telNumLength; i++ )
       
  4659             {
       
  4660             if ( 'p' == ( aTelNumber )[i] )
       
  4661                 {
       
  4662                 // Post address starts
       
  4663                 break; // Exit for loop
       
  4664                 }
       
  4665             else if ( '#' == ( aTelNumber )[i] )
       
  4666                 {
       
  4667                 preAddressLength = i + 1;
       
  4668                 }
       
  4669             // No else
       
  4670             }
       
  4671         }
       
  4672     // No else
       
  4673 
       
  4674     // Check if there is calling line identification restriction prefix in
       
  4675     // the telephony number. Destination pre address subblock will be
       
  4676     // created only for *31# and #31# commands.
       
  4677     if ( KPreAddressLength == preAddressLength &&
       
  4678          '3' == ( aTelNumber )[1] &&
       
  4679          '1' == ( aTelNumber )[2] &&
       
  4680          '#' == ( aTelNumber )[3] )
       
  4681         {
       
  4682         preAddressSupported = ETrue;
       
  4683         destAddressStarts = KPreAddressLength;
       
  4684 
       
  4685         // Set presentationInd based on prefix
       
  4686         if ( '*' == ( aTelNumber )[0] )
       
  4687             {
       
  4688             presentationInd = CSD_PRESENTATION_ALLOWED;
       
  4689 TFLOGSTRING("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by PREFIX = CSD_PRESENTATION_ALLOWED");
       
  4690 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by PREFIX = CSD_PRESENTATION_ALLOWED" );
       
  4691             }
       
  4692         else if ( '#' == ( aTelNumber )[0] )
       
  4693             {
       
  4694             presentationInd = CSD_PRESENTATION_RESTRICTED;
       
  4695 TFLOGSTRING("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by PREFIX = CSD_PRESENTATION_RESTRICTED");
       
  4696 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by PREFIX = CSD_PRESENTATION_RESTRICTED" );
       
  4697             }
       
  4698         }
       
  4699     else
       
  4700         {
       
  4701         // Set presentationInd based on aIdRestrict
       
  4702         switch ( aIdRestrict )
       
  4703             {
       
  4704             case RMobileCall::ESendMyId:
       
  4705                 {
       
  4706                 presentationInd = CSD_PRESENTATION_ALLOWED; //0x00
       
  4707 TFLOGSTRING("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by aIdRestrict = CSD_PRESENTATION_ALLOWED");
       
  4708 OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by aIdRestrict = CSD_PRESENTATION_ALLOWED" );
       
  4709                 break;
       
  4710                 }
       
  4711             case RMobileCall::EDontSendMyId:
       
  4712                 {
       
  4713                 presentationInd = CSD_PRESENTATION_RESTRICTED; //0x01
       
  4714 TFLOGSTRING("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by aIdRestrict = CSD_PRESENTATION_RESTRICTED");
       
  4715 OstTrace0( TRACE_NORMAL, DUP5_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by aIdRestrict = CSD_PRESENTATION_RESTRICTED" );
       
  4716                 break;
       
  4717                 }
       
  4718             case RMobileCall::EIdRestrictDefault:
       
  4719             default:
       
  4720                 {
       
  4721                 presentationInd = CSD_GSM_PRESENTATION_DEFAULT; //0x07
       
  4722 TFLOGSTRING("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by aIdRestrict = CSD_GSM_PRESENTATION_DEFAULT");
       
  4723 OstTrace0( TRACE_NORMAL, DUP6_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock -- presentationInd by aIdRestrict = CSD_GSM_PRESENTATION_DEFAULT" );
       
  4724                 break;
       
  4725                 }
       
  4726             }
       
  4727         }
       
  4728 
       
  4729     // Check if there is post address
       
  4730     for ( TInt i( destAddressStarts ); i < telNumLength; i++ )
       
  4731         {
       
  4732         if ( 'p' == ( aTelNumber )[i] && preAddressLength <= i )
       
  4733             {
       
  4734             // Destination address ends and post address starts.
       
  4735             postAddressSupported = ETrue;
       
  4736             postAddressStarts = i;
       
  4737             break; // Exit for loop
       
  4738             }
       
  4739         else if ( '+' == ( aTelNumber )[i] && preAddressLength == i )
       
  4740             {
       
  4741             // Destination address part contains "+" character. For example
       
  4742             // +35850123456 or *140#+35850123456. Don't add "+" char to the
       
  4743             // destination address.
       
  4744             internationalAddr = ETrue;
       
  4745             }
       
  4746         else
       
  4747             {
       
  4748             destAddress.Append( ( TUint16 )( aTelNumber )[i] );
       
  4749             }
       
  4750         }
       
  4751 
       
  4752     // Create destination address subblock. Size of data buffer
       
  4753     // "max length of destination address" + "message data"
       
  4754     TBuf8<SIZE_CSD_DESTINATION_ADDRESS + KAddressSubBlockMaxLength>
       
  4755         destinationAddressBuf;
       
  4756     TIsiSubBlock destinationAddressSb(
       
  4757         destinationAddressBuf,
       
  4758         CSD_DESTINATION_ADDRESS,
       
  4759         EIsiSubBlockTypeId8Len8 );
       
  4760 
       
  4761     // Address type
       
  4762     if ( internationalAddr )
       
  4763         {
       
  4764         destinationAddressBuf.Append(
       
  4765             CSD_NBR_TYPE_INTERNATIONAL | CSD_NBR_PLAN_ISDN_TELEPHONY );
       
  4766         }
       
  4767     else
       
  4768         {
       
  4769         destinationAddressBuf.Append( CSD_NBR_PLAN_ISDN_TELEPHONY );
       
  4770         }
       
  4771 
       
  4772     // Presentation indicator
       
  4773     destinationAddressBuf.Append( presentationInd | CSD_USER_SCREENED_PASSED );
       
  4774     // Padding byte
       
  4775     destinationAddressBuf.Append( KCallPadding ); // Padding
       
  4776     // Address length
       
  4777     destinationAddressBuf.Append( destAddress.Length() );
       
  4778 
       
  4779     // Add the number string
       
  4780     TIsiUtility::CopyToBigEndian( destAddress, destinationAddressBuf );
       
  4781 
       
  4782     aCsdIsiMsg.CopyData(
       
  4783         aCurrentMsgOffset, destinationAddressSb.CompleteSubBlock() );
       
  4784 
       
  4785     // Set new offset and increase subblock count
       
  4786     aCurrentMsgOffset =
       
  4787         aCurrentMsgOffset + destinationAddressBuf.Length();
       
  4788     aNumOfSbInMsg++;
       
  4789 
       
  4790 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock - CSD_DESTINATION_ADDRESS - Subblock Count:  %d", aNumOfSbInMsg );
       
  4791 OstTrace1( TRACE_NORMAL, DUP10_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock - CSD_DESTINATION_ADDRESS - Subblock Count: %d", aNumOfSbInMsg );
       
  4792 
       
  4793 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock - destAddress: %S", &destAddress);
       
  4794 OstTraceExt2( TRACE_NORMAL, DUP11_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock;destAddress=%d;iDataRateCode=%S", destAddress, iDataRateCode );
       
  4795 
       
  4796     if ( preAddressSupported )
       
  4797         {
       
  4798         // Pre address length can be KTelephonyNumberMaxLength
       
  4799         TBuf16<KTelephonyNumberMaxLength> preAddress;
       
  4800 
       
  4801         // Create pre address subblock
       
  4802         TBuf8<SIZE_CSD_DESTINATION_PRE_ADDRESS +
       
  4803             KTelephonyNumberMaxLength * 2> preAddressBuf;
       
  4804 
       
  4805         TIsiSubBlock preAddressSb(
       
  4806             preAddressBuf,
       
  4807             CSD_DESTINATION_PRE_ADDRESS,
       
  4808             EIsiSubBlockTypeId8Len8 );
       
  4809 
       
  4810         preAddressBuf.Append( CSD_P_ADDR_PRESENTATION_ALLOWED );
       
  4811         preAddressBuf.Append( preAddressLength );
       
  4812         for ( TInt i ( 0 ); i < preAddressLength; i++ )
       
  4813             {
       
  4814             preAddress.Append( ( TUint16 )( aTelNumber )[i] );
       
  4815             }
       
  4816 
       
  4817         TIsiUtility::CopyToBigEndian( preAddress, preAddressBuf );
       
  4818 
       
  4819         aCsdIsiMsg.CopyData(
       
  4820             aCurrentMsgOffset,
       
  4821             preAddressSb.CompleteSubBlock() );
       
  4822 
       
  4823         // Set new offset and increase subblock count
       
  4824         aCurrentMsgOffset =
       
  4825             aCurrentMsgOffset + preAddressBuf.Length();
       
  4826         aNumOfSbInMsg++;
       
  4827 
       
  4828 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock - CSD_DESTINATION_PRE_ADDRESS - Subblock Count:  %d", aNumOfSbInMsg );
       
  4829 OstTrace1( TRACE_NORMAL, DUP12_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock - CSD_DESTINATION_PRE_ADDRESS - Subblock Count: %d", aNumOfSbInMsg );
       
  4830         }
       
  4831     // No else
       
  4832 
       
  4833     if ( postAddressSupported )
       
  4834         {
       
  4835         // Creates Post Address subblock
       
  4836         TInt postAddLength( telNumLength - postAddressStarts );
       
  4837 
       
  4838         // Post address length can be KTelephonyNumberMaxLength
       
  4839         TBuf16<KTelephonyNumberMaxLength> postAddress;
       
  4840 
       
  4841         // Size of data buffer is "max post address length" + "message data"
       
  4842         TBuf8<SIZE_CSD_DESTINATION_POST_ADDRESS +
       
  4843             KTelephonyNumberMaxLength * 2> postAddressBuf;
       
  4844         TIsiSubBlock postAddressSb(
       
  4845             postAddressBuf,
       
  4846             CSD_DESTINATION_POST_ADDRESS,
       
  4847             EIsiSubBlockTypeId8Len8 );
       
  4848 
       
  4849         postAddressBuf.Append( CSD_P_ADDR_PRESENTATION_ALLOWED );
       
  4850         postAddressBuf.Append( ( TUint8 )postAddLength );
       
  4851 
       
  4852         for ( TInt i( postAddressStarts ); i < telNumLength; i++ )
       
  4853             {
       
  4854             postAddress.Append( ( TUint16 )( aTelNumber )[i] );
       
  4855             }
       
  4856 
       
  4857         TIsiUtility::CopyToBigEndian( postAddress, postAddressBuf );
       
  4858 
       
  4859         aCsdIsiMsg.CopyData(
       
  4860             aCurrentMsgOffset,
       
  4861             postAddressSb.CompleteSubBlock() );
       
  4862 
       
  4863         // Set new offset and increase subblock count
       
  4864         aCurrentMsgOffset =
       
  4865             aCurrentMsgOffset + postAddressBuf.Length();
       
  4866         aNumOfSbInMsg++;
       
  4867 
       
  4868         // Destination post address included
       
  4869         iDestPostAddressIncluded = ETrue;
       
  4870 
       
  4871 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock - CSD_DESTINATION_POST_ADDRESS - Subblock Count:  %d", aNumOfSbInMsg );
       
  4872 OstTrace1( TRACE_NORMAL, DUP13_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock - CSD_DESTINATION_POST_ADDRESS - Subblock Count: %d", aNumOfSbInMsg );
       
  4873     }
       
  4874     // No else
       
  4875 
       
  4876     // Create Cbst_Params subblock.
       
  4877     TBuf8<SIZE_CSD_CBST_PARAMS>  CbstParamsBuf;
       
  4878     TIsiSubBlock CbstParamsSb(
       
  4879         CbstParamsBuf,
       
  4880         CSD_CBST_PARAMS,
       
  4881         EIsiSubBlockTypeId8Len8 );
       
  4882 
       
  4883     // Data Rate parameter of CBST
       
  4884     CbstParamsBuf.Append( iDataRateCode );
       
  4885     // Bearer Service Name
       
  4886     CbstParamsBuf.Append( 0x01 );  // 1 data circuit synchronous
       
  4887     // Connection Element
       
  4888     CbstParamsBuf.Append( 0x00 );  // transparent
       
  4889     // Paddings
       
  4890     CbstParamsBuf.Append( KCallPadding );
       
  4891     CbstParamsBuf.Append( KCallPadding );
       
  4892     CbstParamsBuf.Append( KCallPadding );
       
  4893 
       
  4894     aCsdIsiMsg.CopyData(
       
  4895         aCurrentMsgOffset, CbstParamsSb.CompleteSubBlock() );
       
  4896 
       
  4897     // Set new offset and increase subblock count
       
  4898     aCurrentMsgOffset =
       
  4899         aCurrentMsgOffset + CbstParamsBuf.Length();
       
  4900     aNumOfSbInMsg++;
       
  4901 
       
  4902 TFLOGSTRING2("TSY: CMmCallMessHandler::GetCSDCallControlReqSubBlock - CSD_CBST_PARAMS - Subblock Count:  %d", aNumOfSbInMsg );
       
  4903 OstTrace1( TRACE_NORMAL, DUP14_CMMCALLMESSHANDLER_GETCSDCALLCONTROLREQSUBBLOCK, "CMmCallMessHandler::GetCSDCallControlReqSubBlock - CSD_CBST_PARAMS - Subblock Count: %d", aNumOfSbInMsg );
       
  4904 
       
  4905     }
       
  4906 
       
  4907 // ----------------------------------------------------------------------------
       
  4908 // CMmCallMessHandler::csdCallControlReq
       
  4909 // This method constructs CSD call control message.
       
  4910 // (other items were commented in a header).
       
  4911 // -----------------------------------------------------------------------------
       
  4912 //
       
  4913 TInt CMmCallMessHandler::CsdCallControlReq( TUint8 aCallOperId )
       
  4914     {
       
  4915 TFLOGSTRING( "TSY: CMmCallMessHandler::CsdCallControlReq" );
       
  4916 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CSDCALLCONTROLREQ, "CMmCallMessHandler::CsdCallControlReq" );
       
  4917 
       
  4918     TBuf8<SIZE_CSD_CALL_CONTROL_REQ> data( 0 );
       
  4919 
       
  4920     // Transaction ID
       
  4921     data.Append( KCallTransId );
       
  4922 
       
  4923     // Message ID
       
  4924     data.Append( CSD_CALL_CONTROL_REQ );
       
  4925 
       
  4926     // Call Operation ID
       
  4927     data.Append( aCallOperId );
       
  4928 
       
  4929     // Create CSD ISI message
       
  4930     TIsiSend csdIsiMsg( iPhoNetSender->SendBufferDes() );
       
  4931     csdIsiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_CSD );
       
  4932     csdIsiMsg.CopyData( ISI_HEADER_SIZE, data );
       
  4933 
       
  4934     // Number of Subblocks
       
  4935     TUint8 numOfSbInMessage( KZero );
       
  4936 
       
  4937     // The CSD Server to create a call
       
  4938     // Mandatory subblocks CSD_DESTINATION_ADDRESS and CSD_CBST_PARAMS
       
  4939     if ( CSD_CALL_CREATE == aCallOperId )
       
  4940         {
       
  4941         // Initialize message offset
       
  4942         TInt currentMsgOffset( ISI_HEADER_SIZE + SIZE_CSD_CALL_CONTROL_REQ );
       
  4943 
       
  4944         // Create subblocks for CsdCallControlReq
       
  4945         GetCSDCallControlReqSubBlock(
       
  4946             dynamic_cast<TDesC16&>( iTelNumber ),
       
  4947             RMobileCall::ESendMyId,
       
  4948             csdIsiMsg,
       
  4949             numOfSbInMessage,
       
  4950             currentMsgOffset );
       
  4951         }
       
  4952 
       
  4953     // Set number of subblocks in CSD_CALL_CONTROL_REQ message
       
  4954     csdIsiMsg.Set8bit(
       
  4955         ISI_HEADER_SIZE + CSD_CALL_CONTROL_REQ_OFFSET_SUBBLOCKS,
       
  4956         numOfSbInMessage );
       
  4957 
       
  4958     // Message sent via Phonet
       
  4959     return iPhoNetSender->Send( csdIsiMsg.Complete() );
       
  4960     }
       
  4961 
       
  4962 // -----------------------------------------------------------------------------
       
  4963 // CMmCallMessHandler::CsdCallControlResp
       
  4964 // Breaks received CSD_CALL_CONTROL_RESP ISI message.
       
  4965 // -----------------------------------------------------------------------------
       
  4966 //
       
  4967 void CMmCallMessHandler::CsdCallControlResp( const TIsiReceiveC &aIsiMessage )
       
  4968     {
       
  4969 TFLOGSTRING( "TSY: CMmCallMessHandler::CsdCallControlResp" );
       
  4970 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CSDCALLCONTROLRESP, "CMmCallMessHandler::CsdCallControlResp" );
       
  4971 
       
  4972     // Get cause
       
  4973     TUint8 causeValue( aIsiMessage.Get8bit(
       
  4974         ISI_HEADER_SIZE + CSD_CALL_CONTROL_RESP_OFFSET_CAUSE ) );
       
  4975 
       
  4976 TFLOGSTRING2( "TSY: CMmCallMessHandler::CsdCallControlResp. Cause value: %d", causeValue );
       
  4977 OstTrace1( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_CSDCALLCONTROLRESP, "CMmCallMessHandler::CsdCallControlResp;causeValue=%d", causeValue );
       
  4978 
       
  4979     TUint8 oper_Id( aIsiMessage.Get8bit(
       
  4980         ISI_HEADER_SIZE + CSD_CALL_CONTROL_RESP_OFFSET_OPERID ) );
       
  4981 
       
  4982 TFLOGSTRING2( "TSY: CMmCallMessHandler::CsdCallControlResp. Call operation id: %d", oper_Id );
       
  4983 OstTrace1( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_CSDCALLCONTROLRESP, "CMmCallMessHandler::CsdCallControlResp;oper_Id=%d", oper_Id );
       
  4984 
       
  4985     TInt result( KErrNone );
       
  4986 
       
  4987     // create call data package
       
  4988     CCallDataPackage callDataPackage;
       
  4989 
       
  4990     if( CSD_CALL_CAUSE_NONE != causeValue )
       
  4991         {
       
  4992         result = CMmStaticUtility::CSCauseToEpocError( PN_CSD, 0x00, causeValue );
       
  4993 
       
  4994         //Remove Pipe for wideo telephony
       
  4995         PnsPipeRemoveReq();
       
  4996 
       
  4997         // set call id and mode
       
  4998         if ( iMobileCallInfo.iCallId < 0 )
       
  4999             {
       
  5000             // call id not defined, complete with id 0
       
  5001             // =>special cases in CMmMessageRouterBase::RouteCompletionL
       
  5002             callDataPackage.SetCallIdAndMode(
       
  5003                 0, iMobileCallInfo.iService );
       
  5004             }
       
  5005         else
       
  5006             {
       
  5007             // normal completion
       
  5008             callDataPackage.SetCallIdAndMode(
       
  5009                     iMobileCallInfo.iCallId, iMobileCallInfo.iService );
       
  5010             }
       
  5011 
       
  5012         switch( oper_Id )
       
  5013             {
       
  5014             case CSD_CALL_CREATE:
       
  5015             // Csd call set up, user init and dial are sent in first phase
       
  5016             // of data call creation attempt.
       
  5017                 {
       
  5018                 // complete dial request, with error
       
  5019                 iMessageRouter->Complete(
       
  5020                         EEtelCallDial,
       
  5021                         &callDataPackage,
       
  5022                         result );
       
  5023                 break;
       
  5024                 }
       
  5025             case CSD_CALL_ANSWER:
       
  5026             // Answer and autoanswer are sent in answering to incoming call
       
  5027                 {
       
  5028                 // complete answer request, with error
       
  5029                 iMessageRouter->Complete(
       
  5030                         EEtelCallAnswer,
       
  5031                         &callDataPackage,
       
  5032                         result );
       
  5033                 break;
       
  5034                 }
       
  5035             case CSD_CALL_RELEASE:
       
  5036                 {
       
  5037                 // Complete failed HangUp request
       
  5038                 iMessageRouter->Complete(
       
  5039                         EEtelCallHangUp,
       
  5040                         &callDataPackage,
       
  5041                         result );
       
  5042                 break;
       
  5043                 }
       
  5044             case CSD_CALL_REJECT:
       
  5045             default:
       
  5046                 {
       
  5047 TFLOGSTRING("TSY: CMmCallMessHandler::CsdCallControlResp. Switch oper_Id case default.");
       
  5048 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CSDCALLCONTROLRESP, "CMmCallMessHandler::CsdCallControlResp, Switch oper_Id case default" );
       
  5049                 break;
       
  5050                 }
       
  5051             }
       
  5052         }
       
  5053     else
       
  5054         {
       
  5055         if ( CSD_CALL_RELEASE == oper_Id )
       
  5056             {
       
  5057             //Remove Pipe for wideo telephony
       
  5058             PnsPipeRemoveReq();
       
  5059             }
       
  5060         }
       
  5061     }
       
  5062 
       
  5063 // -----------------------------------------------------------------------------
       
  5064 // CMmCallMessHandler::CsdVideoCallStatusInd
       
  5065 // Breaks received CSD_VIDEO_CALL_STATUS_IND ISI message.
       
  5066 // -----------------------------------------------------------------------------
       
  5067 //
       
  5068 void CMmCallMessHandler::CsdVideoCallStatusInd( const TIsiReceiveC &aIsiMessage )
       
  5069     {
       
  5070 TFLOGSTRING( "TSY: CMmCallMessHandler::CsdVideoCallStatusInd" );
       
  5071 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd" );
       
  5072 
       
  5073     iVideoCallStatus = aIsiMessage.Get8bit(
       
  5074         ISI_HEADER_SIZE + CSD_VIDEO_CALL_STATUS_IND_OFFSET_STATUS );
       
  5075 
       
  5076     // CSD_VIDEO_CALL_STATUS_CONNECT
       
  5077     // Video call connected
       
  5078     if( CSD_VIDEO_CALL_STATUS_CONNECT == iVideoCallStatus )
       
  5079         {
       
  5080         CCallDataPackage callData;
       
  5081         // set call id and mode
       
  5082         callData.SetCallIdAndMode(
       
  5083             iMobileCallInfo.iCallId, iMobileCallInfo.iService );
       
  5084         if ( RMobileCall::EMobileOriginated == iCallDirection )
       
  5085             {
       
  5086 TFLOGSTRING("TSY: CMmCallMessHandler::CsdVideoCallStatusInd: MO call connected");
       
  5087 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd: MO call connected" );
       
  5088             iMessageRouter->Complete(
       
  5089                 EEtelCallDial, &callData, KErrNone );
       
  5090             }
       
  5091         else if ( RMobileCall::EMobileTerminated == iCallDirection )
       
  5092             {
       
  5093 TFLOGSTRING("TSY: CMmCallMessHandler::CsdVideoCallStatusInd: MT call connected");
       
  5094 OstTrace0( TRACE_NORMAL, DUP3_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd: MT call connected" );
       
  5095             iMessageRouter->Complete(
       
  5096                 EEtelCallAnswer, &callData, KErrNone );
       
  5097             }
       
  5098         }
       
  5099     else
       
  5100         {
       
  5101         // MT video call case we have to remove pipe
       
  5102         if ( iVideoCallMtReleased )
       
  5103             {
       
  5104 TFLOGSTRING("TSY: CMmCallMessHandler::CsdVideoCallStatusInd: call MT releated");
       
  5105 OstTrace0( TRACE_NORMAL, DUP4_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd: call MT released" );
       
  5106             //Remove Pipe for wideo telephony
       
  5107             PnsPipeRemoveReq();
       
  5108             iVideoCallMtReleased = EFalse;
       
  5109             }
       
  5110         }
       
  5111     // CSD_VIDEO_CALL_STATUS_DISCONNECT arrives also when call establishment
       
  5112     // fails
       
  5113     // reset call direction to avoid further unnecessary IPC completions
       
  5114     iCallDirection = RMobileCall::EDirectionUnknown;
       
  5115 
       
  5116 TFLOGSTRING2( "TSY: CMmCallMessHandler::CsdVideoCallStatusInd. VideoCallStatus: %d", iVideoCallStatus );
       
  5117 OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CSDVIDEOCALLSTATUSIND, "CMmCallMessHandler::CsdVideoCallStatusInd. VideoCallStatus: %d", iVideoCallStatus );
       
  5118     }
       
  5119 
       
  5120 // -----------------------------------------------------------------------------
       
  5121 // CMmCallMessHandler::CsdMultimediaDataRateInd
       
  5122 // Breaks received CSD_MULTIMEDIA_DATA_RATE_IND ISI message.
       
  5123 // -----------------------------------------------------------------------------
       
  5124 //
       
  5125 void CMmCallMessHandler::CsdMultimediaDataRateInd( const TIsiReceiveC &aIsiMessage )
       
  5126     {
       
  5127 TFLOGSTRING( "TSY: CMmCallMessHandler::CsdMultimediaDataRateInd" );
       
  5128 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_CSDMULTIMEDIADATARATEIND, "CMmCallMessHandler::CsdMultimediaDataRateInd" );
       
  5129 
       
  5130     // Current maximum bearer rate for multimedia call in bits/s
       
  5131     TUint dataRate( aIsiMessage.Get8bit(
       
  5132         ISI_HEADER_SIZE + CSD_MULTIMEDIA_DATA_RATE_IND_OFFSET_RATE ) );
       
  5133 
       
  5134 TFLOGSTRING2( "TSY: CMmCallMessHandler::CsdMultimediaDataRateInd. dataRate: %d", dataRate);
       
  5135 OstTrace1( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_CSDMULTIMEDIADATARATEIND, "CMmCallMessHandler::CsdMultimediaDataRateInd. dataRate: %d", dataRate);
       
  5136 
       
  5137     // Match the bearer speed
       
  5138     switch ( dataRate )
       
  5139         {
       
  5140         case KBps28800:
       
  5141             {
       
  5142             iDataRateCode = KRateCode28800;
       
  5143             break;
       
  5144             }
       
  5145         case KBps32000:
       
  5146             {
       
  5147             iDataRateCode = KRateCode32000;
       
  5148             break;
       
  5149             }
       
  5150         case KBps33600:
       
  5151             {
       
  5152             iDataRateCode = KRateCode33600;
       
  5153             break;
       
  5154             }
       
  5155         case KBps56000:
       
  5156             {
       
  5157             iDataRateCode = KRateCode56000;
       
  5158             break;
       
  5159             }
       
  5160         case KBps64000:
       
  5161             {
       
  5162             iDataRateCode = KRateCode64000;
       
  5163             break;
       
  5164             }
       
  5165         default:
       
  5166             {
       
  5167             iDataRateCode = KRateCodeAuto;
       
  5168             break;
       
  5169             }
       
  5170         }
       
  5171     }
       
  5172 
       
  5173 // -----------------------------------------------------------------------------
       
  5174 // CMmCallGsmWcdmaExt::SetMobileCallinfo
       
  5175 // This method sets GSM specific mobile call information
       
  5176 // (other items were commented in a header).
       
  5177 // -----------------------------------------------------------------------------
       
  5178 //
       
  5179 void CMmCallMessHandler::SetMobileCallInfo(
       
  5180     const RMobileCall::TMobileCallInfoV1& aMobileCallInfo,
       
  5181     const TBool aIsMultimedia,
       
  5182     const TBool aIsWaitingCall )
       
  5183     {
       
  5184 
       
  5185 TFLOGSTRING3("TSY: CMmCallMessHandler::SetMobileCallInfo. Multimedia:%d, CallWaiting:%d", aIsMultimedia, aIsWaitingCall );
       
  5186 OstTraceExt2( TRACE_NORMAL, CMMCALLMESSHANDLER_SETMOBILECALLINFO, "CMmCallMessHandler::SetMobileCallInfo;aIsMultimedia=%d;aIsWaitingCall=%d", aIsMultimedia, aIsWaitingCall );
       
  5187 
       
  5188 TFLOGSTRING("TSY: CMmCallMessHandler::SetMobileCallInfo. iStatus != RMobileCall::EStatusIdle");
       
  5189 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_SETMOBILECALLINFO, "CMmCallMessHandler::SetMobileCallInfo, iStatus != RMobileCall::EStatusIdle" );
       
  5190 
       
  5191     // Is call multimedia/video
       
  5192     iIsMultimedia = aIsMultimedia;
       
  5193     // Is this a waiting call
       
  5194     iIsWaitingCall = aIsWaitingCall;
       
  5195 
       
  5196     if ( iIsWaitingCall )
       
  5197         {
       
  5198         // We are receicing MT call. Set call direction here,
       
  5199         // because +CRING can be missed when answering waiting call
       
  5200         // (e.g. when replace is selected from UI)
       
  5201         iCallDirection = RMobileCall::EMobileTerminated;
       
  5202         iMobileCallInfo.iRemoteParty.iDirection = iCallDirection;
       
  5203         }
       
  5204     //no else
       
  5205 
       
  5206     // call id should be always available
       
  5207     iMobileCallInfo.iCallId = aMobileCallInfo.iCallId;
       
  5208 
       
  5209     // call mode should be always available
       
  5210     iMobileCallInfo.iService = aMobileCallInfo.iService;
       
  5211 
       
  5212     // call status should be always available
       
  5213     iMobileCallInfo.iStatus = aMobileCallInfo.iStatus;
       
  5214 
       
  5215     // is this an emergency call
       
  5216     if ( RMobileCall::KCallEmergency & aMobileCallInfo.iValid )
       
  5217         {
       
  5218         iMobileCallInfo.iEmergency = aMobileCallInfo.iEmergency;
       
  5219         }
       
  5220     //no else
       
  5221 
       
  5222     if ( 0 < aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Length() &&
       
  5223         ( RMobilePhone::KMaxMobileTelNumberSize >=
       
  5224             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Length() ) )
       
  5225         {
       
  5226         iMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Zero();
       
  5227         iMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber.Copy(
       
  5228             aMobileCallInfo.iRemoteParty.iRemoteNumber.iTelNumber );
       
  5229 
       
  5230         iMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan
       
  5231             = aMobileCallInfo.iRemoteParty.iRemoteNumber.iNumberPlan;
       
  5232         iMobileCallInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber
       
  5233             = aMobileCallInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber;
       
  5234 
       
  5235         iMobileCallInfo.iRemoteParty.iRemoteIdStatus
       
  5236             = aMobileCallInfo.iRemoteParty.iRemoteIdStatus;
       
  5237         }
       
  5238     //no else
       
  5239 
       
  5240     if ( RMobileCall::KCallRemoteParty & aMobileCallInfo.iValid )
       
  5241         {
       
  5242         iMobileCallInfo.iRemoteParty.iRemoteIdStatus
       
  5243             = aMobileCallInfo.iRemoteParty.iRemoteIdStatus;
       
  5244         }
       
  5245     //no else
       
  5246 
       
  5247     if ( 0 < aMobileCallInfo.iRemoteParty.iCallingName.Length() &&
       
  5248         ( RMobileCall::KCallingNameSize >=
       
  5249             aMobileCallInfo.iRemoteParty.iCallingName.Length() ) )
       
  5250         {
       
  5251         iMobileCallInfo.iRemoteParty.iCallingName.Zero();
       
  5252         iMobileCallInfo.iRemoteParty.iCallingName.Copy(
       
  5253             aMobileCallInfo.iRemoteParty.iCallingName );
       
  5254 
       
  5255         iMobileCallInfo.iRemoteParty.iRemoteIdStatus
       
  5256             = aMobileCallInfo.iRemoteParty.iRemoteIdStatus;
       
  5257         }
       
  5258     //no else
       
  5259 
       
  5260     if ( 0 < aMobileCallInfo.iDialledParty.iTelNumber.Length() &&
       
  5261         ( RMobilePhone::KMaxMobileTelNumberSize >=
       
  5262             aMobileCallInfo.iDialledParty.iTelNumber.Length() ) )
       
  5263         {
       
  5264         iMobileCallInfo.iDialledParty.iTelNumber.Zero();
       
  5265         iMobileCallInfo.iDialledParty.iTelNumber.Copy(
       
  5266             aMobileCallInfo.iDialledParty.iTelNumber );
       
  5267 
       
  5268         iMobileCallInfo.iDialledParty.iNumberPlan
       
  5269             = aMobileCallInfo.iDialledParty.iNumberPlan;
       
  5270         iMobileCallInfo.iDialledParty.iTypeOfNumber
       
  5271             = aMobileCallInfo.iDialledParty.iTypeOfNumber;
       
  5272         }
       
  5273     //no else
       
  5274 
       
  5275     if ( RMobileCall::KCallForwarded & aMobileCallInfo.iValid )
       
  5276         {
       
  5277         iMobileCallInfo.iForwarded = aMobileCallInfo.iForwarded;
       
  5278         }
       
  5279     //no else
       
  5280 
       
  5281     if ( RMobileCall::KCallAlternating & aMobileCallInfo.iValid )
       
  5282         {
       
  5283         iMobileCallInfo.iAlternatingCall = aMobileCallInfo.iAlternatingCall;
       
  5284         }
       
  5285     //no else
       
  5286 
       
  5287     // update validity flags
       
  5288     iMobileCallInfo.iValid |= aMobileCallInfo.iValid;
       
  5289     }
       
  5290 
       
  5291 // -----------------------------------------------------------------------------
       
  5292 // CMmCallMessHandler::DialDataCall
       
  5293 // Dial method for data calls
       
  5294 // (other items were commented in a header).
       
  5295 // -----------------------------------------------------------------------------
       
  5296 //
       
  5297 TInt CMmCallMessHandler::DialDataCall(
       
  5298     const CCallDataPackage* aDataPackage )
       
  5299     {
       
  5300 
       
  5301 TFLOGSTRING("TSY: CMmCallMessHandler::DialDataCall");
       
  5302 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_DIALDATACALL, "CMmCallMessHandler::DialDataCall" );
       
  5303 
       
  5304     TInt ret( KErrNone );
       
  5305     RMobileCall::TMobileCallParamsV1Pckg* callParams( NULL );
       
  5306     RMobileCall::TMobileCallInfoV1* callInfo( NULL );
       
  5307     aDataPackage->UnPackData( &callParams, &callInfo );
       
  5308 
       
  5309     RMobileCall::TMobileCallParamsV1Pckg* paramsPckgV1(
       
  5310        reinterpret_cast<RMobileCall::TMobileCallParamsV1Pckg*>( callParams ) );
       
  5311 
       
  5312     RMobileCall::TMobileCallParamsV1 recentCallParams( ( *paramsPckgV1 )() );
       
  5313 
       
  5314     if ( callParams && callInfo )
       
  5315         {
       
  5316 TFLOGSTRING("TSY: CMmCallMessHandler::DialDataCall. callParams and callInfo ok." );
       
  5317 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_DIALDATACALL, "CMmCallMessHandler::DialDataCall;callParams and callInfo ok." );
       
  5318 
       
  5319         SetMobileCallInfo( *callInfo );
       
  5320 
       
  5321         iIdRestrict = recentCallParams.iIdRestrict;
       
  5322         iTelNumber = callInfo->iDialledParty.iTelNumber;
       
  5323 
       
  5324         // Dial the call
       
  5325         iCallOperationID = CSD_CALL_CREATE;
       
  5326 
       
  5327         // Create Pipe for wideo telephony
       
  5328         // If creation succeed, then CsdCallControlReq( CSD_CALL_CREATE )
       
  5329         // is called on PnsPipeCreateResp()
       
  5330         PnsPipeCreateReq( PN_PIPE_ENABLE );
       
  5331         }
       
  5332     else
       
  5333         {
       
  5334         ret = KErrArgument;
       
  5335         }
       
  5336 
       
  5337     return ret;
       
  5338     }
       
  5339 
       
  5340 // -----------------------------------------------------------------------------
       
  5341 // CMmCallMessHandler::AnswerIncomingDataCall
       
  5342 // Answer incoming data call or set automatic answering ready
       
  5343 // for next incoming data call.
       
  5344 // (other items were commented in a header).
       
  5345 // -----------------------------------------------------------------------------
       
  5346 //
       
  5347 TInt CMmCallMessHandler::AnswerIncomingDataCall(
       
  5348     const CCallDataPackage* aCallDataPackage )
       
  5349     {
       
  5350 
       
  5351     TFLOGSTRING("TSY: CMmCallMessHandler::AnswerIncomingDataCall");
       
  5352 //OstTrace0( TRACE_NORMAL, CMMDATAPORTHANDLER_ANSWERINCOMINGDATACALL, "CMmCallMessHandler::AnswerIncomingDataCall" );
       
  5353 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_ANSWERINCOMINGDATACALL, "CMmCallMessHandler::AnswerIncomingDataCall" );
       
  5354 
       
  5355     TInt ret( KErrNone );
       
  5356     TInt callId( KCallIdNone );
       
  5357     RMobilePhone::TMobileService callMode( RMobilePhone::EServiceUnspecified );
       
  5358 
       
  5359     aCallDataPackage->GetCallIdAndMode( callId, callMode );
       
  5360 
       
  5361 TFLOGSTRING3("TSY: CMmCallMessHandler::AnswerIncomingDataCall. CallId:%d, CallMode:%d", callId, callMode);
       
  5362 OstTraceExt2( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_ANSWERINCOMINGDATACALL, "CMmCallMessHandler::AnswerIncomingDataCall;callId=%d;callMode=%d", callId, callMode );
       
  5363 
       
  5364     // If we are answering an incoming call, the call status is not idle
       
  5365     if ( RMobileCall::EStatusIdle < iMobileCallInfo.iStatus )
       
  5366         {
       
  5367 TFLOGSTRING("TSY: CMmCallMessHandler::AnswerIncomingDataCall. Send ATA");
       
  5368 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_ANSWERINCOMINGDATACALL, "CMmCallMessHandler::AnswerIncomingDataCall, Send ATA" );
       
  5369 
       
  5370         // Answer the call
       
  5371         iCallOperationID = CSD_CALL_ANSWER;
       
  5372 
       
  5373         //Create Pipe for wideo telephony
       
  5374         // If creation succeed, then CsdCallControlReq( CSD_CALL_ANSWER )
       
  5375         // is called on PnsPipeCreateResp()
       
  5376         PnsPipeCreateReq( PN_PIPE_ENABLE );
       
  5377         }
       
  5378         // If we are setting auto answer, the status is unknown
       
  5379     else if ( RMobileCall::EStatusIdle >= iMobileCallInfo.iStatus )
       
  5380         {
       
  5381         // set status to Idle
       
  5382         iMobileCallInfo.iStatus = RMobileCall::EStatusIdle;
       
  5383         }
       
  5384     //no else
       
  5385 
       
  5386     return ret;
       
  5387     }
       
  5388 
       
  5389 // ----------------------------------------------------------------------------
       
  5390 // CMmCallMessHandler::HangUp
       
  5391 // This CORE API method disconnects the call. Used with normal voice calls,
       
  5392 // emergency calls as well as data calls. DialCancel also uses this method.
       
  5393 // (other items were commented in a header).
       
  5394 // ----------------------------------------------------------------------------
       
  5395 //
       
  5396 TInt CMmCallMessHandler::HangUp(
       
  5397     const TInt aCallId )
       
  5398     {
       
  5399 TFLOGSTRING2("TSY: CMmCallMessHandler::HangUp - Call Id: %d", aCallId);
       
  5400 OstTrace1( TRACE_NORMAL, CMMCALLMESSHANDLER_HANGUP, "CMmCallMessHandler::HangUp;aCallId=%d", aCallId );
       
  5401 
       
  5402     TInt ret( KErrNone );
       
  5403 
       
  5404     // If valid call id
       
  5405     if ( 0 < aCallId )
       
  5406         {
       
  5407         // Hangup the call
       
  5408         ret = CsdCallControlReq( CSD_CALL_RELEASE );
       
  5409         }
       
  5410     else if ( RMobileCall::EStatusIdle == iMobileCallInfo.iStatus )
       
  5411         {
       
  5412         iMobileCallInfo.iStatus = RMobileCall::EStatusUnknown;
       
  5413         }
       
  5414     //no else
       
  5415     return ret;
       
  5416     }
       
  5417 
       
  5418 // ----------------------------------------------------------------------------
       
  5419 // CMmCallMessHandler::PnsPipeCreateReq
       
  5420 // Construct a PNS_PIPE_CREATE_REQ ISI-message
       
  5421 // ----------------------------------------------------------------------------
       
  5422 //
       
  5423 TInt CMmCallMessHandler::PnsPipeCreateReq( const TUint8 aPipeStateAfter ) const
       
  5424     {
       
  5425 
       
  5426     TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeCreateReq" );
       
  5427 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPECREATEREQ, "CMmCallMessHandler::PnsPipeCreateReq" );
       
  5428 
       
  5429    // create buffer for isi msg data
       
  5430 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5431     TBuf8<SIZE_PNS_PIPE_CREATE_REQ> data;
       
  5432 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5433     TBuf8<SIZE_CM_PIPE_CREATE_REQ> data;
       
  5434 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5435     // set message data
       
  5436     data.Append( aPipeStateAfter );
       
  5437     data.Append( PN_MSG_PRIORITY_HIGH );
       
  5438     data.Append( KFirstPepDevice );
       
  5439     data.Append( EIscNokiaDataport1 );
       
  5440     data.Append( KFirstPepType );
       
  5441     data.Append( KCallPadding );
       
  5442     data.Append( iSecondPepDeviceId );
       
  5443     data.Append( iSecondPepObjectId );
       
  5444     data.Append( KSecondPepType );
       
  5445     data.Append( KCallPadding );
       
  5446 
       
  5447     // Sending message to phonet
       
  5448     return iPhoNetSender->Send(
       
  5449         PN_PIPE, KPipeTransID, PNS_PIPE_CREATE_REQ, data );
       
  5450     }
       
  5451 
       
  5452 // ----------------------------------------------------------------------------
       
  5453 // CMmCallMessHandler::PnsPipeCreateResp
       
  5454 // Breaks a PNS_PIPE_CREATE_RESP ISI-message.
       
  5455 // ----------------------------------------------------------------------------
       
  5456 //
       
  5457 void CMmCallMessHandler::PnsPipeCreateResp(
       
  5458     const TIsiReceiveC& aIsiMessage )
       
  5459     {
       
  5460 TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeCreateResp");
       
  5461 OstTrace0( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPECREATERESP, "CMmCallMessHandler::PnsPipeCreateResp" );
       
  5462 
       
  5463     // Get transaction Id
       
  5464     TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
       
  5465 
       
  5466     if ( KPipeTransID == transId )
       
  5467         {
       
  5468         iPipeHandle = aIsiMessage.Get8bit(
       
  5469 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5470             ISI_HEADER_SIZE + PNS_PIPE_CREATE_RESP_OFFSET_PIPEHANDLE );
       
  5471 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5472             ISI_HEADER_SIZE + CM_PIPE_CREATE_RESP_OFFSET_PIPEHANDLE );
       
  5473 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5474 
       
  5475         TUint8 errorCode( aIsiMessage.Get8bit(
       
  5476 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5477             ISI_HEADER_SIZE + PNS_PIPE_CREATE_RESP_OFFSET_ERRORCODE ) );
       
  5478 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5479             ISI_HEADER_SIZE + CM_PIPE_CREATE_RESP_OFFSET_ERRORCODE ) );
       
  5480 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5481 
       
  5482 TFLOGSTRING4("TSY: CMmCallMessHandler::PnsPipeCreateResp. TransactionId: %d, PipeHandle: %d, error code: %d", transId, iPipeHandle, errorCode );
       
  5483 OstTraceExt3( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPECREATERESP, "CMmCallMessHandler::PnsPipeCreateResp;transId=%hhu;pipeHandle=%hhu;errorCode=%hhu", transId, iPipeHandle, errorCode );
       
  5484 
       
  5485         if ( PN_PIPE_NO_ERROR == errorCode )
       
  5486             {
       
  5487             // Dial or Answer the call
       
  5488             CsdCallControlReq( iCallOperationID );
       
  5489             }
       
  5490         else if ( PN_PIPE_ERR_GENERAL == errorCode ) // Check PIPE Error Code
       
  5491             {
       
  5492             TUint8 pep1ErrorCode( aIsiMessage.Get8bit(
       
  5493 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5494                 ISI_HEADER_SIZE + PNS_PIPE_CREATE_RESP_OFFSET_PEP1ERRORCODE ) );
       
  5495 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5496                 ISI_HEADER_SIZE + CM_PIPE_CREATE_RESP_OFFSET_PEP1ERRORCODE ) );
       
  5497 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5498 
       
  5499             TUint8 pep2ErrorCode( aIsiMessage.Get8bit(
       
  5500 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5501                 ISI_HEADER_SIZE + PNS_PIPE_CREATE_RESP_OFFSET_PEP2ERRORCODE ) );
       
  5502 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5503                 ISI_HEADER_SIZE + CM_PIPE_CREATE_RESP_OFFSET_PEP2ERRORCODE ) );
       
  5504 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5505 
       
  5506             // Check PEP Error Codes
       
  5507             if ( pep1ErrorCode == PN_PIPE_ERR_PEP_IN_USE ||
       
  5508                  pep1ErrorCode == PN_PIPE_ERR_ALL_PIPES_IN_USE ||
       
  5509                  pep2ErrorCode == PN_PIPE_ERR_PEP_IN_USE ||
       
  5510                  pep2ErrorCode == PN_PIPE_ERR_ALL_PIPES_IN_USE )
       
  5511                 {
       
  5512                 // PEP can't create more pipes (all pipes in use),
       
  5513                 // error value is updated here
       
  5514 TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeCreateResp. ErrorCode changed to PN_PIPE_ERR_ALL_PIPES_IN_USE" );
       
  5515 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_PNSPIPECREATERESP, "CMmCallMessHandler::PnsPipeCreateResp, ErrorCode changed to PN_PIPE_ERR_ALL_PIPES_IN_USE" );
       
  5516                 }
       
  5517             }
       
  5518         //no else
       
  5519         }
       
  5520     //no else
       
  5521     }
       
  5522 
       
  5523 // ----------------------------------------------------------------------------
       
  5524 // CMmCallMessHandler::PnsPipeEnableReq
       
  5525 // Construct a PNS_PIPE_ENABLE_REQ ISI-message.
       
  5526 // ----------------------------------------------------------------------------
       
  5527 //
       
  5528 TInt CMmCallMessHandler::PnsPipeEnableReq() const
       
  5529     {
       
  5530     TFLOGSTRING2("TSY: CMmCallMessHandler::PnsPipeEnableReq. PipeHandle: %d", iPipeHandle );
       
  5531 OstTraceExt1( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_PNSPIPEENABLEREQ, "CMmCallMessHandler::PnsPipeEnableReq;pipehandle=%hhu", iPipeHandle );
       
  5532 
       
  5533     // TODO: this method is not called. See TelAd-110
       
  5534 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5535     TBuf8<SIZE_PNS_PIPE_ENABLE_REQ> data;
       
  5536 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5537     TBuf8<SIZE_CM_PIPE_ENABLE_REQ> data;
       
  5538 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5539 
       
  5540     data.Append( iPipeHandle );
       
  5541     data.Append( KCallPadding );
       
  5542 
       
  5543     // Send Isi message via phonet
       
  5544     return iPhoNetSender->Send(
       
  5545         PN_PIPE, KPipeTransID, PNS_PIPE_ENABLE_REQ, data );
       
  5546     }
       
  5547 
       
  5548 // ----------------------------------------------------------------------------
       
  5549 // CMmCallMessHandler::PnsPipeEnableResp
       
  5550 // Breaks a PNS_PIPE_ENABLE_RESP ISI-message.
       
  5551 // ----------------------------------------------------------------------------
       
  5552 //
       
  5553 void CMmCallMessHandler::PnsPipeEnableResp(
       
  5554     const TIsiReceiveC& aIsiMessage )
       
  5555     {
       
  5556 TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeEnableResp");
       
  5557 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPEENABLERESP, "CMmCallMessHandler::PnsPipeEnableResp" );
       
  5558     // Get Transaction Id from the ISI message
       
  5559     TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
       
  5560 
       
  5561     // TODO: this code makes no sense. See TelAd-110
       
  5562     if ( KPipeTransID == transId )
       
  5563         {
       
  5564         // Get Errorcode from the ISI message
       
  5565         TUint8 errorCode( aIsiMessage.Get8bit(
       
  5566 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5567             ISI_HEADER_SIZE + PNS_PIPE_ENABLE_RESP_OFFSET_ERRORCODE ) );
       
  5568 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5569             ISI_HEADER_SIZE + CM_PIPE_ENABLE_RESP_OFFSET_ERRORCODE ) );
       
  5570 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5571 
       
  5572 TFLOGSTRING4("TSY: CMmCallMessHandler::PnsPipeEnableResp - traId: %d, PipeHandle: %d, ErrorCode: %d", transId, iPipeHandle, errorCode );
       
  5573 OstTraceExt3( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEENABLERESP, "CMmCallMessHandler::PnsPipeEnableResp;transId=%hhu;pipeHandle=%hhu;errorCode=%hhu", transId, iPipeHandle, errorCode );
       
  5574         }
       
  5575     // no else
       
  5576     }
       
  5577 
       
  5578 // ----------------------------------------------------------------------------
       
  5579 // CMmCallMessHandler::PnsPipeResetReq
       
  5580 // Construct a PNS_PIPE_RESET_REQ ISI-message.
       
  5581 // ----------------------------------------------------------------------------
       
  5582 //
       
  5583 TInt CMmCallMessHandler::PnsPipeResetReq(
       
  5584     const TUint8 aStateAfterReset )
       
  5585     {
       
  5586     TFLOGSTRING2("TSY: CMmCallMessHandler::PnsPipeResetReq. PipeHandle: %d", iPipeHandle );
       
  5587 OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPERESETREQ, "CMmCallMessHandler::PnsPipeResetReq;aPipeHandle=%hhu", iPipeHandle );
       
  5588 
       
  5589     // TODO: this method is not called. See TelAd-110
       
  5590     // Create buffer for isi msg data
       
  5591 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5592     TBuf8<SIZE_PNS_PIPE_RESET_REQ> data;
       
  5593 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5594     TBuf8<SIZE_CM_PIPE_RESET_REQ> data;
       
  5595 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5596 
       
  5597     data.Append( iPipeHandle );
       
  5598     data.Append( aStateAfterReset );
       
  5599 
       
  5600     // Send Isi message via phonet
       
  5601     return iPhoNetSender->Send(
       
  5602         PN_PIPE, KPipeTransID, PNS_PIPE_RESET_REQ, data );
       
  5603     }
       
  5604 
       
  5605 // ----------------------------------------------------------------------------
       
  5606 // CMmCallMessHandler::PnsPipeResetResp
       
  5607 // Breaks a PNS_PIPE_RESET_RESP ISI-message.
       
  5608 // ----------------------------------------------------------------------------
       
  5609 //
       
  5610 void CMmCallMessHandler::PnsPipeResetResp(
       
  5611     const TIsiReceiveC& aIsiMessage )
       
  5612     {
       
  5613 TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeResetResp");
       
  5614 OstTrace0( TRACE_NORMAL, DUP2_CMMCALLMESSHANDLER_PNSPIPERESETRESP, "CMmCallMessHandler::PnsPipeResetResp" );
       
  5615     // Get Transaction Id from the ISI message
       
  5616     TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
       
  5617 
       
  5618     // TODO: this code makes no sense. See TelAd-110
       
  5619     if ( KPipeTransID == transId )
       
  5620         {
       
  5621         // Get Pipehandle from the ISI message
       
  5622         TUint8 pipeHandle( aIsiMessage.Get8bit(
       
  5623 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5624             ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_RESP_OFFSET_PIPEHANDLE ) );
       
  5625 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5626             ISI_HEADER_SIZE + CM_PIPE_REDIRECT_RESP_OFFSET_PIPEHANDLE ) );
       
  5627 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5628 
       
  5629         iPipeHandle = pipeHandle;
       
  5630 
       
  5631 TFLOGSTRING3("TSY: CMmCallMessHandler::PnsPipeResetResp - traId: %d, pipe handle: %d", transId, pipeHandle);
       
  5632 OstTraceExt2( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPERESETRESP, "CMmCallMessHandler::PnsPipeResetResp;transId=%hhu;pipeHandle=%hhu", transId, pipeHandle );
       
  5633 
       
  5634         TUint8 errorCode( aIsiMessage.Get8bit(
       
  5635 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5636             ISI_HEADER_SIZE + PNS_PIPE_RESET_RESP_OFFSET_ERRORCODE ) );
       
  5637 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5638             ISI_HEADER_SIZE + CM_PIPE_RESET_RESP_OFFSET_ERRORCODE ) );
       
  5639 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5640 
       
  5641 TFLOGSTRING3("TSY: CMmCallMessHandler::PnsPipeResetResp. PipeHandle: %d ErrorCode: %d", pipeHandle, errorCode );
       
  5642 OstTraceExt2( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPERESETRESP, "CMmCallMessHandler::PnsPipeResetResp;pipeHandle=%hhu;errorCode=%hhu", pipeHandle, errorCode );
       
  5643         }
       
  5644     // no else
       
  5645     }
       
  5646 
       
  5647 // ----------------------------------------------------------------------------
       
  5648 // CMmCallMessHandler::PnsPipeRemoveReq
       
  5649 // Construct a PNS_PIPE_REMOVE_REQ ISI-message.
       
  5650 // ----------------------------------------------------------------------------
       
  5651 //
       
  5652 TInt CMmCallMessHandler::PnsPipeRemoveReq()
       
  5653     {
       
  5654     TFLOGSTRING2("TSY: CMmCallMessHandler::PnsPipeRemoveReq. PipeHandle: %d", iPipeHandle );
       
  5655 OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEREMOVEREQ, "CMmCallMessHandler::PnsPipeRemoveReq;aPipeHandle=%hhu", iPipeHandle );
       
  5656 
       
  5657     // Create buffer for isi msg data
       
  5658 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5659     TBuf8<SIZE_PNS_PIPE_REMOVE_REQ> data;
       
  5660 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5661     TBuf8<SIZE_CM_PIPE_REMOVE_REQ> data;
       
  5662 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5663 
       
  5664     data.Append( iPipeHandle );
       
  5665     data.Append( KCallPadding );
       
  5666 
       
  5667     // Send Isi message via phonet
       
  5668     return iPhoNetSender->Send(
       
  5669         PN_PIPE,
       
  5670         KPipeTransID,
       
  5671         PNS_PIPE_REMOVE_REQ,
       
  5672         data );
       
  5673     }
       
  5674 
       
  5675 // ----------------------------------------------------------------------------
       
  5676 // CMmCallMessHandler::PnsPipeRemoveResp
       
  5677 // Breaks a PNS_PIPE_REMOVE_RESP ISI-message.
       
  5678 // ----------------------------------------------------------------------------
       
  5679 //
       
  5680 void CMmCallMessHandler::PnsPipeRemoveResp(
       
  5681     const TIsiReceiveC& aIsiMessage )
       
  5682     {
       
  5683 TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeRemoveResp");
       
  5684 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPEREMOVERESP, "CMmCallMessHandler::PnsPipeRemoveResp" );
       
  5685     // Get Transaction Id from the ISI message
       
  5686     TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
       
  5687 
       
  5688     // TODO: this code makes no sense. See TelAd-110
       
  5689     if ( KPipeTransID == transId )
       
  5690         {
       
  5691         // Get Errorcode from the ISI message
       
  5692         TUint8 errorCode( aIsiMessage.Get8bit(
       
  5693 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5694             ISI_HEADER_SIZE + PNS_PIPE_REMOVE_RESP_OFFSET_ERRORCODE ) );
       
  5695 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5696             ISI_HEADER_SIZE + CM_PIPE_REMOVE_RESP_OFFSET_ERRORCODE ) );
       
  5697 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5698 
       
  5699 TFLOGSTRING4("TSY: CMmCallMessHandler::PnsPipeRemoveResp - traId: %d, PipeHandle: %d, ErrorCode: %d", transId, iPipeHandle, errorCode );
       
  5700 OstTraceExt3( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEREMOVERESP, "CMmCallMessHandler::PnsPipeRemoveResp;transId=%hhu;pipeHandle=%hhu;errorCode=%hhu", transId, iPipeHandle, errorCode );
       
  5701         }
       
  5702     // no else
       
  5703     }
       
  5704 
       
  5705 // ----------------------------------------------------------------------------
       
  5706 // CMmCallMessHandler::PnsPipeRedirectReq
       
  5707 // Construct a PNS_PIPE_REDIRECT_REQ ISI-message.
       
  5708 // ----------------------------------------------------------------------------
       
  5709 //
       
  5710 TInt CMmCallMessHandler::PnsPipeRedirectReq()
       
  5711     {
       
  5712     TFLOGSTRING2("TSY: CMmCallMessHandler::PnsPipeRedirectReq. PipeHandle: %d", iPipeHandle );
       
  5713 OstTraceExt1( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEREDIRECTREQ, "CMmCallMessHandler::PnsPipeRedirectReq;aPipeHandle=%hhu", iPipeHandle );
       
  5714 
       
  5715     // TODO: this method is not called. See TelAd-110
       
  5716     // Create buffer for isi msg data
       
  5717 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5718     TBuf8<SIZE_PNS_PIPE_REDIRECT_REQ> data;
       
  5719 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5720     TBuf8<SIZE_CM_PIPE_REDIRECT_REQ> data;
       
  5721 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5722     data.Append( iPipeHandle );
       
  5723     data.Append( PN_PIPE_ENABLE );
       
  5724     data.Append( iSecondPepDeviceId );
       
  5725     data.Append( iSecondPepObjectId );
       
  5726     data.Append( KSecondPepType );
       
  5727     data.Append( KCallPadding );
       
  5728     data.Append( KSecondPepDevice );
       
  5729     data.Append( KRedirectPepObject );
       
  5730     data.Append( KSecondPepType );
       
  5731 
       
  5732     // Send Isi message via phonet
       
  5733     return iPhoNetSender->Send(
       
  5734         PN_PIPE,
       
  5735         KPipeTransID,
       
  5736         PNS_PIPE_REDIRECT_REQ,
       
  5737         data );
       
  5738     }
       
  5739 
       
  5740 // ----------------------------------------------------------------------------
       
  5741 // CMmCallMessHandler::PnsPipeRedirectResp
       
  5742 // Breaks a PNS_PIPE_REDIRECT_RESP ISI-message.
       
  5743 // ----------------------------------------------------------------------------
       
  5744 //
       
  5745 void CMmCallMessHandler::PnsPipeRedirectResp(
       
  5746     const TIsiReceiveC& aIsiMessage )
       
  5747     {
       
  5748 TFLOGSTRING("TSY: CMmCallMessHandler::PnsPipeRedirectResp");
       
  5749 OstTrace0( TRACE_NORMAL, DUP1_CMMCALLMESSHANDLER_PNSPIPEREDIRECTRESP, "CMmCallMessHandler::PnsPipeRedirectResp" );
       
  5750     // Get Transaction Id from the ISI message
       
  5751     TUint8 transId( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
       
  5752 
       
  5753     if ( KPipeTransID == transId )
       
  5754         {
       
  5755         // Get Pipehandle from the ISI message
       
  5756         TUint8 pipeHandle( aIsiMessage.Get8bit(
       
  5757 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5758             ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_RESP_OFFSET_PIPEHANDLE ) );
       
  5759 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5760             ISI_HEADER_SIZE + CM_PIPE_REDIRECT_RESP_OFFSET_PIPEHANDLE ) );
       
  5761 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5762 
       
  5763         iPipeHandle = pipeHandle;
       
  5764 
       
  5765         // Get Errorcode from the ISI message
       
  5766         TUint8 errorCode( aIsiMessage.Get8bit(
       
  5767 #ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING
       
  5768             ISI_HEADER_SIZE + PNS_PIPE_REDIRECT_RESP_OFFSET_ERRORCODE ) );
       
  5769 #else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5770             ISI_HEADER_SIZE + CM_PIPE_REDIRECT_RESP_OFFSET_ERRORCODE ) );
       
  5771 #endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */
       
  5772 
       
  5773 TFLOGSTRING4("TSY: CMmCallMessHandler::PnsPipeRedirectResp - traId: %d, PipeHandle: %d, ErrorCode: %d", transId, pipeHandle, errorCode );
       
  5774 OstTraceExt3( TRACE_NORMAL, CMMCALLMESSHANDLER_PNSPIPEREDIRECTRESP, "CMmCallMessHandler::PnsPipeRedirectResp;transId=%hhu;pipeHandle=%hhu;errorCode=%hhu", transId, pipeHandle, errorCode );
       
  5775         }
       
  5776     // no else
       
  5777     }
       
  5778 
       
  5779 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
  5780 
       
  5781     // None
       
  5782 
       
  5783 //  End of File