mmsharing/mmshengine/src/musengmceoutsession.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // USER
    19 // USER
    20 #include "musengmceoutsession.h"
    20 #include "musengmceoutsession.h"
       
    21 #include "musengoutsessionobserver.h"
       
    22 #include "musenglivesessionobserver.h"
    21 #include "mussettings.h"
    23 #include "mussettings.h"
    22 #include "musengmceutils.h"
    24 #include "musengmceutils.h"
    23 #include "musenguriparser.h"
    25 #include "musenguriparser.h"
    24 #include "musenglogger.h"
    26 #include "musenglogger.h"
       
    27 #include "mussesseioninformationapi.h"
    25 #include "mussipprofilehandler.h"
    28 #include "mussipprofilehandler.h"
    26 #include "mussessionproperties.h"
       
    27 #include "musresourceproperties.h"
       
    28 
    29 
    29 // SYSTEM
    30 // SYSTEM
    30 #include <lcsessionobserver.h>
       
    31 #include <lcuiprovider.h>
       
    32 #include <mcestreambundle.h>
    31 #include <mcestreambundle.h>
    33 #include <mcemediastream.h>
    32 #include <mcemediastream.h>
    34 #include <mceoutsession.h>
    33 #include <mceoutsession.h>
    35 #include <mcevideostream.h>
    34 #include <mcevideostream.h>
    36 #include <mcemediasource.h>
    35 #include <mcemediasource.h>
    39 #include <mcertpsink.h>
    38 #include <mcertpsink.h>
    40 #include <mcespeakersink.h>
    39 #include <mcespeakersink.h>
    41 #include <mcedisplaysink.h>
    40 #include <mcedisplaysink.h>
    42 #include <mcevideocodec.h>
    41 #include <mcevideocodec.h>
    43 #include <mceaudiocodec.h>
    42 #include <mceaudiocodec.h>
    44 #include <e32property.h>
       
    45 
    43 
    46 #include <sipprofile.h>
    44 #include <sipprofile.h>
    47 #include <sipextensionheader.h>
    45 #include <sipextensionheader.h>
    48 #include <sipaddress.h>
    46 #include <sipaddress.h>
    49 #include <uri8.h>
    47 #include <uri8.h>
    50 
    48 #include <e32property.h>
       
    49 
       
    50 
       
    51 
       
    52 const TInt KMusEngSipReasonCodeBadRequest = 400;
       
    53 const TInt KMusEngSipReasonCodeUnauthorized = 401;
       
    54 const TInt KMusEngSipReasonCodePaymentRequired = 402;
    51 const TInt KMusEngSipReasonCodeRecipientNotFound  = 404;
    55 const TInt KMusEngSipReasonCodeRecipientNotFound  = 404;
       
    56 const TInt KMusEngSipReasonCodeProxyAuthenticationRequired = 407;
    52 const TInt KMusEngSipReasonCodeRequestTimeout = 408;
    57 const TInt KMusEngSipReasonCodeRequestTimeout = 408;
    53 const TInt KMusEngSipReasonCodeUnsupportedMediaType = 415;
    58 const TInt KMusEngSipReasonCodeUnsupportedMediaType = 415;
    54 const TInt KMusEngSipReasonCodeUnsupportedUriScheme = 416;
    59 const TInt KMusEngSipReasonCodeUnsupportedUriScheme = 416;
    55 const TInt KMusEngSipReasonCodeTemporarilyNotAvailable = 480;
    60 const TInt KMusEngSipReasonCodeTemporarilyNotAvailable = 480;
    56 const TInt KMusEngSipReasonCodeBusyHere = 486;
    61 const TInt KMusEngSipReasonCodeBusyHere = 486;
    57 const TInt KMusEngSipReasonCodeRequestCancelled = 487;
    62 const TInt KMusEngSipReasonCodeRequestCancelled = 487;
    58 const TInt KMusEngSipReasonCodeNotAcceptableHere = 488;
    63 const TInt KMusEngSipReasonCodeNotAcceptableHere = 488;
    59 const TInt KMusEngSipReasonCodeDecline = 603;
    64 const TInt KMusEngSipReasonCodeDecline = 603;
    60 const TInt KMusEngSipReasonCodeNotAcceptable = 606;
    65 const TInt KMusEngSipReasonCodeNotAcceptable = 606;
    61 // The next code represents unofficial sip error code
    66 // The next code represents unofficial sip error code
       
    67 // "478 Unresolveable Destination, we were not able to process the URI (478/TM)
       
    68 const TInt KMusEngSipReasonCode478NotAbleToProcessURI = 478;
       
    69 // The next code represents unofficial sip error code
    62 // "479 Regretfuly, we were not able to process the URI (479/SL)
    70 // "479 Regretfuly, we were not able to process the URI (479/SL)
    63 const TInt KMusEngSipReasonCode479NotAbleToProcessURI = 479;
    71 const TInt KMusEngSipReasonCode479NotAbleToProcessURI = 479;
    64 
    72 
    65 const TUint8 KMusEngPayloadTypeVideoH263 = 96;
    73 const TUint8 KMusEngPayloadTypeVideoH263 = 96;
    66 const TUint8 KMusEngPayloadTypeAudio = 97;
    74 const TUint8 KMusEngPayloadTypeAudio = 97;
    67 const TUint8 KMusEngPayloadTypeVideoAvc = 98;
    75 const TUint8 KMusEngPayloadTypeVideoAvc = 98;
    68 
    76 
    69 const TInt KMusEngSipAddressMaxLength = 256;
    77 using namespace NMusSessionInformationApi;
    70 const TInt KMusEngSipAddressesMaxAmount  =   8;
       
    71 _LIT( KMusEngCommaSymbol, "," );
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CMusEngMceOutSession::CMusEngMceOutSession()
       
    78     : CMusEngMceSession(),
       
    79       iTriedInvitations( 0 ),
       
    80       iAsyncBrakeCallBack( AsyncBrakeCompleted, this ),
       
    81       iRegistrationCallBack( RegistrationTimerExpired, this ),
       
    82       iInvitationResponseCallBack( InvitationResponseTimerExpired, this )
       
    83     {
       
    84     iAsyncBrakeEntry.Set( iAsyncBrakeCallBack );
       
    85     iRegistrationEntry.Set( iRegistrationCallBack );
       
    86     iInvitationResponseEntry.Set( iInvitationResponseCallBack );
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 void CMusEngMceOutSession::ConstructL()
       
    94     {
       
    95     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::ConstructL()" )
       
    96     
       
    97     CMusEngMceSession::ConstructL();
       
    98     TInt sipProfileId;
       
    99     TInt error = KErrNone;
       
   100     error = ( RProperty::Get( NMusSessionApi::KCategoryUid, 
       
   101                              NMusSessionApi::KSipProfileId, sipProfileId ) );
       
   102     if ( error != KErrNone )
       
   103        {
       
   104        sipProfileId = KErrNone;
       
   105        error = KErrNone;
       
   106        }
       
   107     iSipProfileHandler->CreateProfileL( sipProfileId );
       
   108     iVideoCodecList = NULL;
       
   109     TBuf<RProperty::KMaxPropertySize> buffer;
       
   110     error = ( RProperty::Get( NMusSessionApi::KCategoryUid, 
       
   111                                  NMusSessionApi::KVideoCodecs, buffer ) );
       
   112     if ( error == KErrNone && buffer.Length() )
       
   113         {
       
   114         iVideoCodecList = 
       
   115                     CnvUtfConverter::ConvertFromUnicodeToUtf8L( buffer );
       
   116         }
       
   117         
       
   118     iDeltaTimer = CDeltaTimer::NewL( CActive::EPriorityStandard );
       
   119     
       
   120     /* Read the contact name set by availability plugin */    
       
   121     error = RProperty::Get( NMusSessionApi::KCategoryUid,
       
   122                                  NMusSessionApi::KContactName,
       
   123                                  buffer );
       
   124     iRemoteDisplayName = ( error == KErrNone && buffer.Length() ) 
       
   125                          ? buffer.AllocL() : KNullDesC().AllocL();
       
   126     
       
   127     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::ConstructL()" )
       
   128     }
       
   129 
    78 
   130 // -----------------------------------------------------------------------------
    79 // -----------------------------------------------------------------------------
   131 //
    80 //
   132 // -----------------------------------------------------------------------------
    81 // -----------------------------------------------------------------------------
   133 //
    82 //
   134 CMusEngMceOutSession::~CMusEngMceOutSession()
    83 CMusEngMceOutSession::~CMusEngMceOutSession()
   135     {
    84     {
   136     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::~CMusEngMceOutSession()" )
    85     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::~CMusEngMceOutSession()" )
   137  
    86 
   138     if ( iAddressQueried && iRecipient )
       
   139         {
       
   140         TRAP_IGNORE( SaveContactL( *iRecipient ) )
       
   141         }
       
   142     
       
   143     delete iDeltaTimer;
       
   144     delete iRecipient;
    87     delete iRecipient;
   145     delete iVideoCodecList;
    88     delete iVideoCodecList;
   146     delete iRemoteSipAddressProposal;
    89     
   147     delete iRemoteDisplayName;
       
   148     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::~CMusEngMceOutSession()" )
    90     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::~CMusEngMceOutSession()" )
   149     }
    91     }
   150 
    92 
   151 // -----------------------------------------------------------------------------
    93 
   152 // From MLcSession
    94 // -----------------------------------------------------------------------------
   153 // -----------------------------------------------------------------------------
    95 //
   154 //
    96 // -----------------------------------------------------------------------------
   155 void CMusEngMceOutSession::EstablishLcSessionL()
    97 //
   156     {
    98 EXPORT_C void CMusEngMceOutSession::InviteL( const TDesC& aRecipient )
   157     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::EstablishLcSessionL()")
    99     {
   158 
   100     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::InviteL()")
   159     iAddressQueried = EFalse;
   101 
   160     if ( LcUiProvider() && !IsBackgroundStartup() )
   102     if ( iSession )
   161         {
   103         {
   162         LcUiProvider()->HandleForegroundStatus( ETrue );
   104         MUS_ENG_LOG_SESSION_STATE( *iSession ) 
   163         }
   105 
   164     TRAPD( err, DoInviteL() );
   106         if ( iSession->State() == CMceSession::EIdle ||
   165         
   107              iSession->State() == CMceSession::ETerminated )
   166     // If address is in wrong format, Manual Address Entry Dialog is displayed
   108             {
   167     if ( ( err == KErrArgument ) && DoSyncRetryL() )
   109             // This is the case when last invite has ended up to an error,
   168         {  
   110             // last sharing has ended normally, or construction of the session
   169         err = KErrNone; // Doing retry
   111             // stucture has not been completed. Delete old session and try to
   170         }
   112             // continue normally.
   171     
   113             delete iSession;
   172     User::LeaveIfError( err );
   114             iSession = NULL;
   173         
   115             MUS_LOG( "mus: [ENGINE]     Existing session deleted")
   174     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::EstablishLcSessionL")
   116             }
   175     }
   117         else
   176 
   118             {
   177 // -----------------------------------------------------------------------------
   119             // Session is already ongoing. Leave.
   178 // From MLcSession
   120             User::Leave( KErrAlreadyExists );
   179 // -----------------------------------------------------------------------------
   121             }
   180 //
   122 
   181 void CMusEngMceOutSession::TerminateLcSessionL()
   123         }
   182     {
   124 
   183     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::TerminateLcSessionL" )
   125     MUS_LOG_TDESC( "mus: [ENGINE]      CMusEngMceOutSession::InviteL() recipient=",
       
   126                    aRecipient )
       
   127 
       
   128     // delete possibly existing recipient
       
   129     delete iRecipient;
       
   130     iRecipient = NULL;  
       
   131     
       
   132     TMusEngUriParser parser( aRecipient ); 
       
   133     parser.ParseUriL();    
       
   134     iRecipient = parser.GetUri8L();
       
   135 
       
   136     CreateMceSessionStructureL();
       
   137 
       
   138     EstablishSessionL();
       
   139 
       
   140     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::InviteL()")
       
   141     }
       
   142 
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 EXPORT_C void CMusEngMceOutSession::CancelInviteL()
       
   149     {
       
   150     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::CancelInviteL()" )
   184 
   151 
   185     __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) );
   152     __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) );
       
   153     
       
   154     MUS_ENG_LOG_SESSION_STATE( *iSession ) 
   186 
   155 
   187     if( iSession->State() == CMceSession::EOffering )
   156     if( iSession->State() == CMceSession::EOffering )
   188         {
   157         {
   189         static_cast< CMceOutSession* >( iSession )->CancelL();
   158         MUS_LOG( "mus: [ENGINE]     CMceOutSession->CancelL()" )
   190         }
   159         static_cast<CMceOutSession*>( iSession )->CancelL();
   191     else
   160         }
   192         {
   161 
   193         iSession->TerminateL();
   162     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::CancelInviteL()" )
   194         }
   163     }
   195     
   164 
   196     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::TerminateLcSessionL" )
   165 
   197     }
   166 // -----------------------------------------------------------------------------
   198 
   167 //
   199 // -----------------------------------------------------------------------------
   168 // -----------------------------------------------------------------------------
   200 //
   169 //
   201 // -----------------------------------------------------------------------------
   170 EXPORT_C void CMusEngMceOutSession::SetSupportedVideoCodecListL( 
   202 //
   171                                                 const TDesC& aVideoCodecs )
   203 void CMusEngMceOutSession::AddDisplayL( CMceMediaStream& aStream )
   172     {
   204     {
   173     MUS_LOG_TDESC( "mus: [ENGINE]  -> CMusEngMceOutSession::SetSupportedVideoCodecListL: ",
   205     MusEngMceUtils::AddDisplayL( aStream, *iManager, Rect() );
   174                    aVideoCodecs )
   206     }
   175 
       
   176     HBufC8* newVideoCodecList = 
       
   177                     CnvUtfConverter::ConvertFromUnicodeToUtf8L( aVideoCodecs );
       
   178     delete iVideoCodecList;
       
   179     iVideoCodecList = newVideoCodecList;
       
   180 
       
   181     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::SetSupportedVideoCodecListL" )
       
   182     }
       
   183 
   207 
   184 
   208 // -----------------------------------------------------------------------------
   185 // -----------------------------------------------------------------------------
   209 // Calls MCE function EstablishL with feature tag in Accept-Contact header.
   186 // Calls MCE function EstablishL with feature tag in Accept-Contact header.
   210 // Adjusts stream and codec values.
   187 // Adjusts stream and codec values.
   211 // -----------------------------------------------------------------------------
   188 // -----------------------------------------------------------------------------
   235         CleanupStack::PushL( headInText );
   212         CleanupStack::PushL( headInText );
   236         headers->AppendL( *headInText );
   213         headers->AppendL( *headInText );
   237         CleanupStack::PopAndDestroy( headInText );
   214         CleanupStack::PopAndDestroy( headInText );
   238         }
   215         }
   239       
   216       
   240       
   217      /* Add the privacy header if cs call privacy setting is switched on */
       
   218     if ( iPrivate && iPrivateNumber )
       
   219         {
       
   220         AddPrivacyHeaderL( *headers );
       
   221         }
   241     static_cast<CMceOutSession*>( iSession )->EstablishL( 0, headers );
   222     static_cast<CMceOutSession*>( iSession )->EstablishL( 0, headers );
   242     CleanupStack::Pop( headers );
   223     CleanupStack::Pop( headers );
   243     
   224     
   244     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::EstablishSessionL()" )
   225     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::EstablishSessionL()" )
   245     }
   226     }
   246 
   227 
       
   228 
   247 // -----------------------------------------------------------------------------
   229 // -----------------------------------------------------------------------------
   248 // Handle MCE session termination. Called by MCE observer function of the
   230 // Handle MCE session termination. Called by MCE observer function of the
   249 // base class.
   231 // base class.
   250 // -----------------------------------------------------------------------------
   232 // -----------------------------------------------------------------------------
   251 //
   233 //
   254     {
   236     {
   255     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::HandleTermination()" )
   237     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::HandleTermination()" )
   256 
   238 
   257     switch ( aStatusCode )
   239     switch ( aStatusCode )
   258         {
   240         {
   259         case KMusEngSipReasonCodeRecipientNotFound : 
   241 
       
   242         case KMusEngSipReasonCodeBadRequest :
       
   243             {
       
   244             iOutSessionObserver.SessionBadRequest();
       
   245             break;
       
   246             }
       
   247         case KMusEngSipReasonCodeUnauthorized :
       
   248             {
       
   249             iOutSessionObserver.SessionUnauthorized();
       
   250             break;
       
   251             }
       
   252         case KMusEngSipReasonCodePaymentRequired :
       
   253             {
       
   254             iOutSessionObserver.SessionPaymentRequired();
       
   255             break;
       
   256             }
       
   257         case KMusEngSipReasonCodeRecipientNotFound :
       
   258         	//lint -fallthrough
       
   259         case KMusEngSipReasonCode478NotAbleToProcessURI:
   260             //lint -fallthrough
   260             //lint -fallthrough
   261         case KMusEngSipReasonCode479NotAbleToProcessURI:
   261         case KMusEngSipReasonCode479NotAbleToProcessURI:
   262             //lint -fallthrough
   262             //lint -fallthrough
   263         case KMusEngSipReasonCodeUnsupportedUriScheme : 
   263         case KMusEngSipReasonCodeUnsupportedUriScheme : 
   264             {
   264             {
   265             InitRecipientNotFoundHandling();
   265             iOutSessionObserver.SessionRecipientNotFound();
       
   266             break;
       
   267             }
       
   268         case KMusEngSipReasonCodeProxyAuthenticationRequired :
       
   269             {
       
   270             iOutSessionObserver.SessionProxyAuthenticationRequired();
   266             break;
   271             break;
   267             }
   272             }
   268         case KMusEngSipReasonCodeRequestTimeout :
   273         case KMusEngSipReasonCodeRequestTimeout :
   269             {
   274             {
   270             InformObserverAboutSessionFailure( MLcSession::ENoAnswer );
   275             iOutSessionObserver.SessionRequestTimeOut();
   271             break;
   276             break;
   272             }
   277             }
   273         case KMusEngSipReasonCodeUnsupportedMediaType :
   278         case KMusEngSipReasonCodeUnsupportedMediaType :
   274             //lint -fallthrough
   279             //lint -fallthrough
   275         case KMusEngSipReasonCodeNotAcceptableHere:
   280         case KMusEngSipReasonCodeNotAcceptableHere:
   276             //lint -fallthrough
   281             //lint -fallthrough
   277         case KMusEngSipReasonCodeNotAcceptable:
   282         case KMusEngSipReasonCodeNotAcceptable:
   278             {
   283             {
   279             InformObserverAboutSessionFailure( MLcSession::ESessionRejected );
   284             iOutSessionObserver.SessionUnsupportedMediaType();
   280             break;
   285             break;
   281             }
   286             }
   282         case KMusEngSipReasonCodeBusyHere :
   287         case KMusEngSipReasonCodeBusyHere :
   283             {
   288             {
   284             // Operator variant uses 486 to rejection instead of 603
   289             // Operator variant uses 486 to rejection instead of 603
   285             if ( iOperatorVariant )
   290             if ( iOperatorVariant )
   286                 {
   291                 {
   287                 InformObserverAboutSessionFailure( 
   292                 iOutSessionObserver.SessionRejected();
   288                     MLcSession::ESessionRejected );
       
   289                 }
   293                 }
   290             else
   294             else
   291                 {
   295                 {
   292                 InformObserverAboutSessionFailure( 
   296                 iOutSessionObserver.SessionBusyHere();
   293                     MLcSession::ERecipientBusy );
       
   294                 }
   297                 }
   295             break;
   298             break;
   296             }
   299             }
   297         case KMusEngSipReasonCodeRequestCancelled :  
   300         case KMusEngSipReasonCodeRequestCancelled :  
   298             {
   301             {
   299             InformObserverAboutSessionFailure( MLcSession::ESessionCancelled );
   302             iOutSessionObserver.SessionRequestCancelled();
   300             break;
   303             break;
   301             }
   304             }
   302         case KMusEngSipReasonCodeDecline :
   305         case KMusEngSipReasonCodeDecline :
   303             {
   306             {
   304             InformObserverAboutSessionFailure( MLcSession::ESessionRejected );
   307             iOutSessionObserver.SessionRejected();
   305             break;
   308             break;
   306             }
   309             }
   307         case KMusEngSipReasonCodeTemporarilyNotAvailable :
   310         case KMusEngSipReasonCodeTemporarilyNotAvailable :
   308             {
   311             {
   309             InformObserverAboutSessionFailure( 
   312             iOutSessionObserver.SessionTemporarilyNotAvailable();
   310                 MLcSession::ERecipientTemporarilyNotAvailable );
       
   311             break;
   313             break;
   312             }
   314             }
   313         default:
   315         default:
   314             {
   316             {
   315             // Termination reason is not outsession specific.
   317             // Termination reason is not outsession specific.
   320 
   322 
   321 
   323 
   322     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::HandleTermination()" )
   324     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::HandleTermination()" )
   323     }
   325     }
   324 
   326 
       
   327 
   325 // -----------------------------------------------------------------------------
   328 // -----------------------------------------------------------------------------
   326 // Sets payload type and calls overridden base class version
   329 // Sets payload type and calls overridden base class version
   327 // -----------------------------------------------------------------------------
   330 // -----------------------------------------------------------------------------
   328 //
   331 //
   329 void CMusEngMceOutSession::AdjustVideoCodecL( CMceVideoCodec& aVideoCodec,
   332 void CMusEngMceOutSession::AdjustVideoCodecL( CMceVideoCodec& aVideoCodec )
   330                                               TMceSourceType aSourceType )
       
   331     {
   333     {
   332     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::AdjustVideoCodecL()" )
   334     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::AdjustVideoCodecL()" )
   333     
   335     
   334     CMusEngMceSession::AdjustVideoCodecL( aVideoCodec, aSourceType );
   336     CMusEngMceSession::AdjustVideoCodecL( aVideoCodec );
   335     
   337     
   336     if ( aVideoCodec.SdpName() == KMceSDPNameH263() ||
   338     if ( aVideoCodec.SdpName() == KMceSDPNameH263() ||
   337          aVideoCodec.SdpName() == KMceSDPNameH2632000() )
   339          aVideoCodec.SdpName() == KMceSDPNameH2632000() )
   338         {
   340         {
   339         User::LeaveIfError( 
   341         User::LeaveIfError( 
   350         }
   352         }
   351     
   353     
   352     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::AdjustVideoCodecL()" )
   354     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::AdjustVideoCodecL()" )
   353     }
   355     }
   354 
   356 
       
   357 
   355 // -----------------------------------------------------------------------------
   358 // -----------------------------------------------------------------------------
   356 // Sets payload type and calls overridden base class version
   359 // Sets payload type and calls overridden base class version
   357 // -----------------------------------------------------------------------------
   360 // -----------------------------------------------------------------------------
   358 //        
   361 //        
   359 void CMusEngMceOutSession::AdjustAudioCodecL( CMceAudioCodec& aAudioCodec )
   362 void CMusEngMceOutSession::AdjustAudioCodecL( CMceAudioCodec& aAudioCodec )
   363     CMusEngMceSession::AdjustAudioCodecL( aAudioCodec );
   366     CMusEngMceSession::AdjustAudioCodecL( aAudioCodec );
   364     
   367     
   365     User::LeaveIfError( aAudioCodec.SetPayloadType( KMusEngPayloadTypeAudio ) );
   368     User::LeaveIfError( aAudioCodec.SetPayloadType( KMusEngPayloadTypeAudio ) );
   366     
   369     
   367     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::AdjustAudioCodecL()" )
   370     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::AdjustAudioCodecL()" )
   368     }  
   371     }
   369 
       
   370 // -----------------------------------------------------------------------------
       
   371 //
       
   372 // -----------------------------------------------------------------------------
       
   373 //
       
   374 void CMusEngMceOutSession::ProfileRegistered()
       
   375     {
       
   376     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::ProfileRegistered()" )
       
   377     
       
   378     if ( iRegistrationPending )
       
   379         {
       
   380         iDeltaTimer->Remove( iRegistrationEntry );
       
   381         iRegistrationPending = EFalse;
       
   382         
   372         
       
   373 
       
   374 // -----------------------------------------------------------------------------
       
   375 //
       
   376 // -----------------------------------------------------------------------------
       
   377 //
       
   378 CMusEngMceOutSession::CMusEngMceOutSession( 
       
   379                                 const TRect& aRect,
       
   380                                 MMusEngSessionObserver& aSessionObserver,
       
   381                                 MMusEngOutSessionObserver& aOutSessionObserver )
       
   382     : CMusEngMceSession( aRect, aSessionObserver ),      
       
   383       iOutSessionObserver( aOutSessionObserver )
       
   384     {
       
   385     }
       
   386 
       
   387 
       
   388 // -----------------------------------------------------------------------------
       
   389 //
       
   390 // -----------------------------------------------------------------------------
       
   391 //
       
   392 void CMusEngMceOutSession::ConstructL( TUint aSipProfileId )
       
   393     {
       
   394     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::ConstructL()" )
       
   395 
       
   396     CMusEngMceSession::ConstructL();
       
   397     iSipProfileHandler->CreateProfileL( aSipProfileId );
       
   398     
       
   399     // Check if feature specific behavior is expected
       
   400     iPrivate = ( MultimediaSharingSettings::PrivacySetting());
   383         
   401         
   384         HBufC* resolvedRecipient = NULL;
   402     NMusSessionInformationApi::TMusClirSetting clir;
   385         TRAPD( error, resolvedRecipient = RemoteAddressL() )
   403     // Ignore RProperty::Get return value.Incase of error it should behave default.
   386         if ( error != KErrNone )
   404     RProperty::Get( NMusSessionInformationApi::KCategoryUid,
   387             {
   405                     NMusSessionInformationApi::KMusClirSetting,
   388             InformObserverAboutSessionFailure( error );
   406                     reinterpret_cast<TInt&>( clir ) );
   389             }
   407     iPrivateNumber = ( clir == NMusSessionInformationApi::ESendOwnNumber )? EFalse: ETrue;
   390         else
   408       
   391             {
   409     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::ConstructL()" )
   392             TRAP( error, DoInviteL( *resolvedRecipient ) )
   410     }
   393             delete resolvedRecipient; 
   411 
   394             if ( error != KErrNone )
   412 
   395                 {
   413 // -----------------------------------------------------------------------------
   396                 InformObserverAboutSessionFailure( error );
   414 //
   397                 }
   415 // -----------------------------------------------------------------------------
   398             }
   416 //
   399         }
   417 void CMusEngMceOutSession::CreateMceSessionStructureL()
   400     
       
   401     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::ProfileRegistered()" )
       
   402     }
       
   403 
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 // -----------------------------------------------------------------------------
       
   407 //
       
   408 TBool CMusEngMceOutSession::IsH264Supported() const
       
   409     {
       
   410     return ( iVideoCodecList && iVideoCodecList->FindF( KMceSDPNameH264() ) >= 0 );
       
   411     }
       
   412 
       
   413 // -----------------------------------------------------------------------------
       
   414 //
       
   415 // -----------------------------------------------------------------------------
       
   416 //
       
   417 void CMusEngMceOutSession::CreateMceSessionStructureL( TBool aForceSdpBandwidth )
       
   418     {
   418     {
   419     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::CreateMceSessionStructureL()" )
   419     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::CreateMceSessionStructureL()" )
   420 
   420 
   421     CSIPProfile* profile = iSipProfileHandler->Profile();
   421  	CSIPProfile* profile = iSipProfileHandler->Profile();
   422     __ASSERT_ALWAYS( profile != NULL, User::Leave( KErrNotReady ) );
   422     __ASSERT_ALWAYS( profile != NULL, User::Leave( KErrNotReady ) );
   423 
   423 
   424     // Create session
   424     // Create session
   425     iSession = CMceOutSession::NewL( *iManager, *profile, *iRecipient );
   425     if ( iPrivate && iPrivateNumber )
       
   426         {
       
   427         HBufC8* originator = KMusAnonymousHeader().AllocLC();
       
   428         iSession = CMceOutSession::NewL( *iManager, *profile, *iRecipient, originator );
       
   429         CleanupStack::Pop();
       
   430         }
       
   431     else
       
   432         {
       
   433         iSession = CMceOutSession::NewL( *iManager, *profile, *iRecipient );
       
   434         }
       
   435 
   426 
   436 
   427     // Remove QoS-lines if needed
   437     // Remove QoS-lines if needed
   428     if ( profile->Type().iSIPProfileClass == 
   438     if ( profile->Type().iSIPProfileClass == 
   429          TSIPProfileTypeInfo::EInternet ||
   439          TSIPProfileTypeInfo::EInternet ||
   430          MultimediaSharingSettings::ForceInternetSignalingSettingL() ==
   440          MultimediaSharingSettings::ForceInternetSignalingSettingL() ==
   433         {
   443         {
   434         iSession->SetModifierL( KMcePreconditions, KMcePreconditionsNotUsed );
   444         iSession->SetModifierL( KMcePreconditions, KMcePreconditionsNotUsed );
   435         MUS_LOG( "mus: [ENGINE]     Usage of preconditions denied" )
   445         MUS_LOG( "mus: [ENGINE]     Usage of preconditions denied" )
   436         }
   446         }
   437         
   447         
   438     SetSessionSdpLinesL( *iSession, aForceSdpBandwidth );
   448     SetSessionSdpLinesL( *iSession );
   439 
   449 
   440     // Create bundle for local streams
   450     // Create bundle for local streams
   441     
   451     
   442     CMceStreamBundle* localBundle = 
   452     CMceStreamBundle* localBundle = 
   443                         CMceStreamBundle::NewLC( CMceStreamBundle::ELS );
   453                         CMceStreamBundle::NewLC( CMceStreamBundle::ELS );
   449     // Create stream to display and share source with video outstream
   459     // Create stream to display and share source with video outstream
   450     CMceVideoStream* streamForDisplay = CMceVideoStream::NewLC();
   460     CMceVideoStream* streamForDisplay = CMceVideoStream::NewLC();
   451 
   461 
   452     CMceVideoStream* videoOut = MusEngMceUtils::GetVideoOutStreamL( *iSession );
   462     CMceVideoStream* videoOut = MusEngMceUtils::GetVideoOutStreamL( *iSession );
   453     
   463     
   454     SetMediaSdpLinesL( *videoOut, aForceSdpBandwidth );
   464     SetMediaSdpLinesL( *videoOut );
   455 		
   465 		
   456     streamForDisplay->SetSourceL( videoOut->Source() );
   466     streamForDisplay->SetSourceL( videoOut->Source() );
   457 
   467 
   458     AddDisplayL( *streamForDisplay );
   468     MusEngMceUtils::AddDisplayL( *streamForDisplay, *iManager, Rect() );
   459 
   469 
   460     iSession->AddStreamL( streamForDisplay );
   470     iSession->AddStreamL( streamForDisplay );
   461     CleanupStack::Pop( streamForDisplay );    
   471     CleanupStack::Pop( streamForDisplay );    
   462 
   472 
   463     // Check if there are audio streams to bundle with
   473     // Check if there are audio streams to bundle with
   473         }
   483         }
   474 
   484 
   475     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::CreateMceSessionStructureL()" )
   485     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::CreateMceSessionStructureL()" )
   476     }
   486     }
   477 
   487 
   478 // -----------------------------------------------------------------------------
   488 
   479 //
   489 // -----------------------------------------------------------------------------
   480 // -----------------------------------------------------------------------------
   490 // Add Privacy header if own phone number/id should not be sent to remote party
   481 //
   491 // -----------------------------------------------------------------------------
   482 void CMusEngMceOutSession::DoInviteL( const TDesC& aRecipient )
   492 //
   483     {
   493 void CMusEngMceOutSession::AddPrivacyHeaderL( CDesC8Array& aHeaders )
   484     MUS_LOG_TDESC( "mus: [ENGINE]  -> CMusEngMceOutSession::DoInviteL(): ",
   494     {
   485                    aRecipient ) 
   495     MUS_LOG( "mus: [ENGINE]  -> AddPrivacyHeaderL()" )
   486 
   496     _LIT8( KMusPrivacyHeaderValue, "id" );
   487     HBufC* resolvedRecipient = NULL;
   497     CSIPExtensionHeader* header = CSIPExtensionHeader::NewLC( 
   488     if ( aRecipient.Length() > 0 )
   498                                   KMusPrivacyHeader, KMusPrivacyHeaderValue );
   489         {
   499     HBufC8* headInText = header->ToTextL();
   490         resolvedRecipient = aRecipient.AllocLC();
   500     MUS_LOG_TDESC8( " mus: [ENGINE] Privacy header : ", headInText->Des() );
   491         }
   501     CleanupStack::PopAndDestroy( header );
   492     else
   502     CleanupStack::PushL( headInText );
   493         {
   503     aHeaders.AppendL( *headInText );
   494         resolvedRecipient = ResolveRecipientLC();
   504     CleanupStack::PopAndDestroy( headInText );
   495         }
   505     MUS_LOG( "mus: [ENGINE]  <- AddPrivacyHeaderL()" )
   496     
   506     }
   497     // delete possibly existing recipient
       
   498     delete iRecipient;
       
   499     iRecipient = NULL;  
       
   500     
       
   501     TMusEngUriParser parser( *resolvedRecipient ); 
       
   502     parser.ParseUriL();    
       
   503     iRecipient = parser.GetUri8L();    
       
   504     
       
   505     /* Set the display name to recipient address if displayname is empty */
       
   506     if ( !iRemoteDisplayName || iRemoteDisplayName->Length() == 0 )
       
   507         {
       
   508         HBufC* tmp = parser.GetUri16L( ETrue );
       
   509         delete iRemoteDisplayName;
       
   510         iRemoteDisplayName = tmp;
       
   511         }
       
   512     
       
   513     CleanupStack::PopAndDestroy( resolvedRecipient );
       
   514     
       
   515     if ( iSession )
       
   516         {
       
   517         MUS_ENG_LOG_SESSION_STATE( *iSession ) 
       
   518         
       
   519         if ( iSession->State() == CMceSession::EIdle ||
       
   520              iSession->State() == CMceSession::ETerminated )
       
   521             {
       
   522             // This is the case when last invite has ended up to an error,
       
   523             // last sharing has ended normally, or construction of the session
       
   524             // stucture has not been completed. Delete old session and try to
       
   525             // continue normally.
       
   526             delete iSession;
       
   527             iSession = NULL;
       
   528             MUS_LOG( "mus: [ENGINE]     Existing session deleted")
       
   529             }
       
   530         else
       
   531             {
       
   532             // Session is already ongoing. Leave.
       
   533             User::Leave( KErrAlreadyExists );
       
   534             }
       
   535       }
       
   536     
       
   537     const TUint KMusEngOneMinuteTimeout = 60000000;
       
   538     if ( iSipProfileHandler->IsRegistered() )
       
   539         {
       
   540         CreateMceSessionStructureL();   
       
   541         EstablishSessionL();
       
   542 	// Start one minute expiration timer
       
   543         TTimeIntervalMicroSeconds32 interval( KMusEngOneMinuteTimeout );
       
   544         iDeltaTimer->Remove( iInvitationResponseEntry );
       
   545         iDeltaTimer->Queue( interval, iInvitationResponseEntry );
       
   546         }
       
   547     else
       
   548         {
       
   549         iRegistrationPending = ETrue;
       
   550         // Start one minute expiration timer
       
   551         TTimeIntervalMicroSeconds32 interval( KMusEngOneMinuteTimeout );
       
   552         iDeltaTimer->Remove( iRegistrationEntry );
       
   553         iDeltaTimer->Queue( interval, iRegistrationEntry );
       
   554         }
       
   555     
       
   556     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::DoInviteL()" )
       
   557     }
       
   558 
       
   559 // -----------------------------------------------------------------------------
       
   560 //
       
   561 // -----------------------------------------------------------------------------
       
   562 //
       
   563 HBufC* CMusEngMceOutSession::ResolveRecipientLC()
       
   564     {
       
   565     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::ResolveRecipientLC()" )
       
   566     
       
   567     HBufC* resolvedRecipient = NULL;
       
   568     TRAPD( err, 
       
   569         resolvedRecipient = 
       
   570             ReadDescPropertyL( NMusSessionApi::KRemoteSipAddress ) );
       
   571     if ( err != KErrNone )
       
   572         {
       
   573         __ASSERT_ALWAYS( err != KErrNoMemory, User::Leave( KErrNoMemory ) );
       
   574         resolvedRecipient = KNullDesC().AllocL();
       
   575         }
       
   576     CleanupStack::PushL( resolvedRecipient );
       
   577     
       
   578     delete iRemoteSipAddressProposal;
       
   579     iRemoteSipAddressProposal = NULL;
       
   580     TRAP( err, 
       
   581         iRemoteSipAddressProposal = 
       
   582             ReadDescPropertyL( NMusSessionApi::KRemoteSipAddressProposal ) );
       
   583     if ( err != KErrNone )
       
   584         {
       
   585         __ASSERT_ALWAYS( err != KErrNoMemory, User::Leave( KErrNoMemory ) );
       
   586         iRemoteSipAddressProposal = KNullDesC().AllocL();
       
   587         }
       
   588     
       
   589     if ( resolvedRecipient->Length() > 0 )
       
   590         {
       
   591         if ( resolvedRecipient->Find( KMusEngCommaSymbol ) != KErrNotFound )
       
   592             {
       
   593             // Split the addresses using KMusCommaSymbol as a separator
       
   594             CDesCArray* addresses =
       
   595                 new( ELeave )CDesCArrayFlat( KMusEngSipAddressesMaxAmount );
       
   596             CleanupStack::PushL( addresses );
       
   597             SplitL( *resolvedRecipient, KMusEngCommaSymbol, addresses );          
       
   598             
       
   599             // Show List Query Dialog
       
   600             CleanupStack::Pop( addresses );
       
   601             CleanupStack::PopAndDestroy( resolvedRecipient );
       
   602             CleanupStack::PushL( addresses );
       
   603             resolvedRecipient = HBufC::NewLC( KMusEngSipAddressMaxLength );
       
   604             TPtr ptrRetryAddr( resolvedRecipient->Des() ); 
       
   605             if ( !LcUiProviderL().SelectRecipient( *addresses, ptrRetryAddr ) )
       
   606                 {
       
   607                 // Address not selected from provided list
       
   608                 User::Leave( KErrNotFound );
       
   609                 }
       
   610             CleanupStack::Pop( resolvedRecipient );
       
   611             CleanupStack::PopAndDestroy( addresses );
       
   612             CleanupStack::PushL( resolvedRecipient );
       
   613             }
       
   614         }
       
   615     else
       
   616         {
       
   617         __ASSERT_ALWAYS( ++iTriedInvitations < 2, User::Leave( KErrNotFound ) );
       
   618         
       
   619         CleanupStack::PopAndDestroy( resolvedRecipient );
       
   620         resolvedRecipient = NULL;
       
   621         resolvedRecipient = HBufC::NewLC( KMusEngSipAddressMaxLength );
       
   622         __ASSERT_ALWAYS( 
       
   623             iRemoteSipAddressProposal->Length() < KMusEngSipAddressMaxLength,
       
   624             User::Leave( KErrOverflow ) );
       
   625         resolvedRecipient->Des().Copy( *iRemoteSipAddressProposal );
       
   626         TPtr ptrRetryAddr( resolvedRecipient->Des() );
       
   627         InputRecipientL( ptrRetryAddr );
       
   628         iAddressQueried = ETrue;
       
   629         }
       
   630     
       
   631     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::ResolveRecipientLC()" )
       
   632     
       
   633     return resolvedRecipient;
       
   634     }
       
   635 
       
   636 // -----------------------------------------------------------------------------
       
   637 //
       
   638 // -----------------------------------------------------------------------------
       
   639 //
       
   640 TInt CMusEngMceOutSession::AsyncBrakeCompleted( TAny* aPtr )
       
   641     {
       
   642     if ( aPtr )
       
   643         {
       
   644         reinterpret_cast<CMusEngMceOutSession*>( aPtr )->HandleRecipientNotFound();
       
   645         }
       
   646     return KErrNone;
       
   647     }
       
   648 
       
   649 // -----------------------------------------------------------------------------
       
   650 //
       
   651 // -----------------------------------------------------------------------------
       
   652 //
       
   653 TInt CMusEngMceOutSession::RegistrationTimerExpired( TAny* aPtr )
       
   654     {
       
   655     if ( aPtr )
       
   656         {
       
   657         CMusEngMceOutSession* session = 
       
   658             reinterpret_cast< CMusEngMceOutSession* >( aPtr );
       
   659         session->InformObserverAboutSessionFailure( KErrGeneral );
       
   660         }
       
   661     return KErrNone;
       
   662     }
       
   663 
       
   664 // -----------------------------------------------------------------------------
       
   665 //
       
   666 // -----------------------------------------------------------------------------
       
   667 //
       
   668 TInt CMusEngMceOutSession::InvitationResponseTimerExpired( TAny* aPtr )
       
   669     {
       
   670     if ( aPtr )
       
   671         {
       
   672         CMusEngMceOutSession* session = 
       
   673             reinterpret_cast< CMusEngMceOutSession* >( aPtr );
       
   674         if ( !session->IgnoreErrorNote() )
       
   675             {
       
   676             session->InformObserverAboutSessionFailure( MLcSession::ENoAnswer );
       
   677             }
       
   678         }
       
   679     return KErrNone;
       
   680     }
       
   681 
       
   682 // -----------------------------------------------------------------------------
       
   683 //
       
   684 // -----------------------------------------------------------------------------
       
   685 //
       
   686 TBool CMusEngMceOutSession::IgnoreErrorNote()
       
   687     {
       
   688     TBool ignore = ETrue;
       
   689     if ( iSession && 
       
   690           ( iSession->State() == CMceSession::EOffering || 
       
   691          iSession->State() == CMceSession::EProceeding ) )
       
   692         {
       
   693         ignore = EFalse;
       
   694         }
       
   695      return ignore;   
       
   696     }
       
   697 
       
   698 // -----------------------------------------------------------------------------
       
   699 //
       
   700 // -----------------------------------------------------------------------------
       
   701 //
       
   702 void CMusEngMceOutSession::InitRecipientNotFoundHandling()
       
   703     {
       
   704     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::InitRecipientNotFoundHandling()" )
       
   705     
       
   706     iDeltaTimer->Remove( iAsyncBrakeEntry );
       
   707     const TUint KMusEngAsyncBrakeTimeout = 1;
       
   708     TTimeIntervalMicroSeconds32 interval( KMusEngAsyncBrakeTimeout );
       
   709     iDeltaTimer->Queue( interval, iAsyncBrakeEntry );
       
   710     
       
   711     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::InitRecipientNotFoundHandling()" )
       
   712     }
       
   713 
       
   714 // -----------------------------------------------------------------------------
       
   715 //
       
   716 // -----------------------------------------------------------------------------
       
   717 //
       
   718 void CMusEngMceOutSession::HandleRecipientNotFound()
       
   719     {
       
   720     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::HandleRecipientNotFound()" )
       
   721     
       
   722     TInt err( KErrNotFound );
       
   723     
       
   724     TBool retry( EFalse );
       
   725     TRAP( err, retry = DoSyncRetryL() );
       
   726     
       
   727     if ( err != KErrNone || !retry )
       
   728         {
       
   729         InformObserverAboutSessionFailure( MLcSession::ERecipientNotFound );
       
   730         }
       
   731     
       
   732     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::HandleRecipientNotFound()" )
       
   733     }
       
   734 
       
   735 // -----------------------------------------------------------------------------
       
   736 //
       
   737 // -----------------------------------------------------------------------------
       
   738 //
       
   739 TBool CMusEngMceOutSession::DoSyncRetryL()
       
   740     {
       
   741     __ASSERT_ALWAYS( iRemoteSipAddressProposal, User::Leave( KErrNotFound ) );
       
   742     __ASSERT_ALWAYS( 
       
   743         iRemoteSipAddressProposal->Length() < KMusEngSipAddressMaxLength,
       
   744         User::Leave( KErrOverflow ) );    
       
   745     
       
   746     TBool retry( EFalse );
       
   747     
       
   748     if ( ++iTriedInvitations < 2 )
       
   749         {        
       
   750         TBuf<KMusEngSipAddressMaxLength> retryAddress;
       
   751         retryAddress.Copy( *iRemoteSipAddressProposal );
       
   752         InputRecipientL( retryAddress );
       
   753         DoInviteL( retryAddress );
       
   754 
       
   755         retry = ETrue;
       
   756         iAddressQueried = ETrue;
       
   757         }
       
   758     return retry;
       
   759     }
       
   760 
       
   761 // -----------------------------------------------------------------------------
       
   762 //
       
   763 // -----------------------------------------------------------------------------
       
   764 //
       
   765 void CMusEngMceOutSession::SplitL( const TDesC& aDes,
       
   766                                    const TDesC& aChar,
       
   767                                    CDesCArray* aArray )
       
   768     {
       
   769     TInt charPos( 0 );
       
   770     TPtrC ptr( aDes );
       
   771     TBool found = EFalse;
       
   772     while( ( charPos = ptr.Find( aChar ) ) > 0 )
       
   773         {
       
   774         found = ETrue;
       
   775         TPtrC str = ptr.Left( charPos );
       
   776         aArray->AppendL( str );
       
   777         ptr.Set( ptr.Right( ptr.Length() - str.Length() - 1 ) );
       
   778         }
       
   779     if ( found && ptr.Length() > 0 )
       
   780         {
       
   781         aArray->AppendL( ptr );
       
   782         }
       
   783     }
       
   784 
       
   785 // -----------------------------------------------------------------------------
       
   786 //
       
   787 // -----------------------------------------------------------------------------
       
   788 //
       
   789 HBufC* CMusEngMceOutSession::ReadDescPropertyL( TUint aKey )
       
   790     {
       
   791     MUS_LOG1( "mus: [ENGINE]     -> CMusEngMceOutSession::ReadDescPropertyL: aKey: [%d]",
       
   792                             aKey );
       
   793 
       
   794     TBuf<RProperty::KMaxPropertySize> buffer;
       
   795 
       
   796     User::LeaveIfError( RProperty::Get( NMusSessionApi::KCategoryUid,
       
   797                                         aKey,
       
   798                                         buffer ) );
       
   799     HBufC* desc = buffer.AllocL();
       
   800     MUS_LOG_TDESC( "mus: [ENGINE]    <- CMusEngMceOutSession::ReadDescPropertyL: val: ",
       
   801                             (*desc) );
       
   802     return desc;
       
   803     }
       
   804 
       
   805 // -----------------------------------------------------------------------------
       
   806 //
       
   807 // -----------------------------------------------------------------------------
       
   808 //
       
   809 HBufC* CMusEngMceOutSession::RemoteAddressL() const
       
   810     {
       
   811     MUS_LOG( "mus: [ENGINE]  -> CMusEngMceOutSession::RemoteAddressL()" )
       
   812     
       
   813     __ASSERT_ALWAYS( iRecipient, User::Leave( KErrNotReady ) );
       
   814     
       
   815     HBufC* remoteAddr = HBufC::NewLC( iRecipient->Length() );
       
   816     TPtr ptrRemoteAddr( remoteAddr->Des() );
       
   817     User::LeaveIfError( 
       
   818         CnvUtfConverter::ConvertToUnicodeFromUtf8( 
       
   819             ptrRemoteAddr, *iRecipient ) );
       
   820     
       
   821     MUS_LOG( "mus: [ENGINE]  <- CMusEngMceOutSession::RemoteAddressL()" )
       
   822     
       
   823     CleanupStack::Pop( remoteAddr );
       
   824     return remoteAddr;
       
   825     }
       
   826 
       
   827 // -----------------------------------------------------------------------------
       
   828 // From MLcSession, Should return the displayname of the remote terminal
       
   829 // If found in phone book than contactname else user entered sip address
       
   830 // -----------------------------------------------------------------------------
       
   831 //
       
   832 const TDesC& CMusEngMceOutSession::RemoteDisplayName()
       
   833     {      
       
   834     if ( !iRemoteDisplayName )
       
   835         {
       
   836         return KNullDesC;
       
   837         }
       
   838     return *iRemoteDisplayName;
       
   839     }
       
   840 
       
   841 // -----------------------------------------------------------------------------
       
   842 // Query to the user for sip address of the remote party.
       
   843 // If the user entered a new sip address then reset the displayname 
       
   844 // to user entered sip address.
       
   845 // -----------------------------------------------------------------------------
       
   846 //
       
   847 void CMusEngMceOutSession::InputRecipientL( TDes& aRecipientAddress )
       
   848     {   
       
   849     if ( !LcUiProviderL().InputRecipient( aRecipientAddress ) )
       
   850        {
       
   851        User::Leave( KErrCancel );
       
   852        }    
       
   853     /* displayname is no longer valid since user entered a new sip address
       
   854      * and displayname will be set to sip address when invitation sent.
       
   855      */
       
   856     delete iRemoteDisplayName;
       
   857     iRemoteDisplayName = NULL;
       
   858     }
       
   859 
       
   860 // End of file