sipvoipprovider/src/svpmosession.cpp
branchRCL_3
changeset 10 ed1e38b404e5
parent 0 a4daefaec16c
child 11 6134b5029079
equal deleted inserted replaced
9:bddb6d4447db 10:ed1e38b404e5
   138         
   138         
   139         if ( KErrNone == err )
   139         if ( KErrNone == err )
   140             {
   140             {
   141             // set crypto contexts
   141             // set crypto contexts
   142             SetCryptoContextL();
   142             SetCryptoContextL();
   143             // Set AVP to use instead of SAVP
       
   144             iSession->SetModifierL( KMceSecureSession, KMceSecurePlainAVP );
       
   145             // set secured flag to ETrue to indicate that this is secure session
   143             // set secured flag to ETrue to indicate that this is secure session
   146             SetSecurePreferred( ETrue );
   144             SetSecurePreferred( ETrue );
   147             // set iSecured flag so UI can show right icon
   145             // set iSecured flag so UI can show right icon
   148             iSecured = ETrue;
   146             iSecured = ETrue;
   149             }
   147             }
   156         
   154         
   157         if ( KErrNone == err )
   155         if ( KErrNone == err )
   158             {
   156             {
   159             // set crypto contexts
   157             // set crypto contexts
   160             SetCryptoContextL();
   158             SetCryptoContextL();
   161             // Set AVP to use instead of SAVP
       
   162             iSession->SetModifierL( KMceSecureSession, KMceSecurePlainAVP );
       
   163             // set secure mandatory flag ETrue, only secure session allowed       
   159             // set secure mandatory flag ETrue, only secure session allowed       
   164             SetSecureMandatory( ETrue );
   160             SetSecureMandatory( ETrue );
   165             // set iSecured flag so UI can show right icon
   161             // set iSecured flag so UI can show right icon
   166             iSecured = ETrue;
   162             iSecured = ETrue;
   167             }
   163             }
   289                                      const CSIPProfile& aSIPProfile,
   285                                      const CSIPProfile& aSIPProfile,
   290                                      const TUint32& aSecurityStatus,
   286                                      const TUint32& aSecurityStatus,
   291                                      TBool aUserEqualsPhoneRequired )
   287                                      TBool aUserEqualsPhoneRequired )
   292     {
   288     {
   293     SVPDEBUG1( "CSVPMoSession::CompleteUriL In" )
   289     SVPDEBUG1( "CSVPMoSession::CompleteUriL In" )
   294    
   290 
   295     // create instance of uri parser
   291     // create instance of uri parser
   296     CSVPUriParser* uriParser = CSVPUriParser::NewLC();
   292     CSVPUriParser* uriParser = CSVPUriParser::NewLC();
   297      
   293     
   298     const TDesC8* userAor = NULL;
   294     HBufC8* userAor( NULL );
   299     aSIPProfile.GetParameter( KSIPUserAor, userAor );
   295     const MDesC8Array* aors( NULL ); // Array of registered address of records
   300     
   296     
       
   297     TInt result = aSIPProfile.GetParameter( KSIPRegisteredAors, aors );
       
   298     
       
   299     if ( !aors || aors->MdcaCount() == KErrNone )
       
   300         {
       
   301         SVPDEBUG1( "CSVPMoSession::CompleteUriL - registered aors array empty" )
       
   302         const TDesC8* userAorStr = NULL;
       
   303         result = aSIPProfile.GetParameter( KSIPUserAor, userAorStr );
       
   304         SVPDEBUG2( "CSVPMoSession::CompleteUriL - KSIPUserAor result: %d", result )
       
   305         userAor = HBufC8::NewLC( userAorStr->Length() );
       
   306         userAor->Des().Copy( *userAorStr );
       
   307         }
       
   308     else
       
   309         {
       
   310         #ifdef _DEBUG
       
   311             TBuf<KSvpMaxDebugBufferSize> tmpUri;
       
   312             for ( TInt i = 0; i < aors->MdcaCount(); i++ )
       
   313                 {
       
   314                 tmpUri.Copy( aors->MdcaPoint( i ) );
       
   315                 SVPDEBUG3( "CSVPMoSession::CompleteUriL - registered AOR[%d]: %S", i, &tmpUri )
       
   316                 }
       
   317         #endif
       
   318         userAor = HBufC8::NewLC( aors->MdcaPoint( 0 ).Length() );
       
   319         userAor->Des().Copy( aors->MdcaPoint( 0 ) );
       
   320         }
   301     // set service id to uri parser, needed for setting user=phone
   321     // set service id to uri parser, needed for setting user=phone
   302     uriParser->SetUserEqualsPhoneRequiredL( aUserEqualsPhoneRequired );
   322     uriParser->SetUserEqualsPhoneRequiredL( aUserEqualsPhoneRequired );
   303     
   323     
   304     // complete URI by security status preference
   324     // complete URI by security status preference
   305     HBufC8* uri = NULL;
   325     HBufC8* uri = NULL;
   319     else
   339     else
   320         {
   340         {
   321         SVPDEBUG1( "CSVPMoSession::CompleteUriL Completing SIPS URI..." )
   341         SVPDEBUG1( "CSVPMoSession::CompleteUriL Completing SIPS URI..." )
   322         uri = uriParser->CompleteSecureSipUriL( aRecipient, *userAor );
   342         uri = uriParser->CompleteSecureSipUriL( aRecipient, *userAor );
   323         }
   343         }
   324   
   344     CleanupStack::PopAndDestroy( userAor );
   325     CleanupStack::PopAndDestroy( uriParser );
   345     CleanupStack::PopAndDestroy( uriParser );
   326     
   346     
   327     SVPDEBUG1( "CSVPMoSession::CompleteUriL Out" )
   347     SVPDEBUG1( "CSVPMoSession::CompleteUriL Out" )
   328     return uri;
   348     return uri;
   329     }
   349     }