mmsharing/mmshavailability/src/musavaregisteravailability.cpp
changeset 22 496ad160a278
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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 "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:   Provide interface for the client requestin availability class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "musavaregisteravailability.h"
       
    21 #include "musavaavailabilityobserver.h"
       
    22 #include "musunittesting.h"
       
    23 #include "musavaobserver.h"
       
    24 #include "musavaavailability.h"
       
    25 #include "musavasharedobject.h"
       
    26 #include "muslogger.h"
       
    27 #include "musavasettingsimp.h"
       
    28 #include "musavasip.h"
       
    29 #include "musavaconnectionmonitor.h"
       
    30 #include "mussettings.h"
       
    31 #include "musavaclientresolverutil.h"
       
    32 
       
    33 #include <e32base.h>
       
    34 #include <sipprofile.h>
       
    35 #include <sipprofileregistry.h>
       
    36 #include <sipprofileregistryobserver.h>
       
    37 #include <escapeutils.h>
       
    38 
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // Symbian two-phase constructor
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CMusAvaRegisterAvailability* CMusAvaRegisterAvailability::NewL(
       
    45     MMusAvaAvailabilityObserver& aObserver,
       
    46     CMusAvaSettingsImp& aSettings )
       
    47     {
       
    48     CMusAvaRegisterAvailability* self =
       
    49         CMusAvaRegisterAvailability::NewLC(
       
    50             aObserver,
       
    51             aSettings );
       
    52     CleanupStack::Pop( self );
       
    53     return self;
       
    54     }
       
    55 
       
    56 
       
    57 // ----------------------------------------------------------------------------
       
    58 //  Two-phased constructor.
       
    59 // ----------------------------------------------------------------------------
       
    60 //
       
    61 CMusAvaRegisterAvailability* CMusAvaRegisterAvailability::NewLC(
       
    62     MMusAvaAvailabilityObserver& aObserver,
       
    63     CMusAvaSettingsImp& aSettings )
       
    64     {
       
    65     CMusAvaRegisterAvailability* self =
       
    66         new (ELeave) CMusAvaRegisterAvailability(
       
    67             aObserver,
       
    68             aSettings );
       
    69     CleanupStack::PushL (self);
       
    70     self->ConstructL();
       
    71     return self;
       
    72     }
       
    73 
       
    74 
       
    75 // ------------------------------------------------------------------------------
       
    76 //  Destructor.
       
    77 // ------------------------------------------------------------------------------
       
    78 //
       
    79 CMusAvaRegisterAvailability::~CMusAvaRegisterAvailability()
       
    80     {
       
    81     if ( iSharedObj )
       
    82         {
       
    83         iSharedObj->MusAvaSip().RemoveAdapter( *this );
       
    84         iSharedObj->DeleteSingleton();
       
    85         }
       
    86     }
       
    87 
       
    88 
       
    89 // ------------------------------------------------------------------------------
       
    90 // Symbian 2nd phase constructor can leave.
       
    91 // ------------------------------------------------------------------------------
       
    92 //
       
    93 void CMusAvaRegisterAvailability::ConstructL()
       
    94     {
       
    95     iSharedObj = CMusAvaSharedObject::GetSingletonL();
       
    96     iSharedObj->MusAvaSip().AddAdapterL( *this );
       
    97     }
       
    98 
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 //  Constructor.
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 CMusAvaRegisterAvailability::CMusAvaRegisterAvailability(
       
   105     MMusAvaAvailabilityObserver& aObserver,
       
   106     CMusAvaSettingsImp& aSettings )
       
   107     :CMusAvaAvailability( aObserver ),
       
   108     iSettings( aSettings )
       
   109     {
       
   110     }
       
   111 
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // Executes for the master - salve pattern.
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CMusAvaRegisterAvailability::DoExecuteL()
       
   118     {
       
   119     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::DoExecuteL " )
       
   120     SetState( MMusAvaObserver::EMusAvaStatusInProgress );
       
   121     RegisterL();
       
   122     // TBD: SetState( MMusAvaObserver::EMusAvaNameRegistration );
       
   123 
       
   124     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::DoExecuteL " )
       
   125     }
       
   126 
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // Stop the execution.
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 void CMusAvaRegisterAvailability::Stop()
       
   133     {
       
   134     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::Stop" )
       
   135     CSIPProfile* profile = iSharedObj->MusAvaSip().Profile();
       
   136     if ( profile )
       
   137         {
       
   138         CSIPProfileRegistry* registry = NULL; // not own, so not deleted
       
   139         TRAPD( error_register, registry = 
       
   140         	&iSharedObj->MusAvaSip().ProfileRegistryL() );
       
   141         if ( error_register == KErrNone )
       
   142             {
       
   143             MUS_LOG( "mus: [MUSAVA]    Sip profile registry found" )
       
   144             TInt error = registry->Disable( *profile );
       
   145             MUS_LOG1( "mus: [MUSAVA]	Disable Sip profile ( %d )", error )
       
   146             }
       
   147         }
       
   148     
       
   149     SetState( MMusAvaObserver::EMusAvaStatusNotExecuted );
       
   150     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::Stop" )
       
   151     }
       
   152 
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // CMusAvaRegisterAvailability::Name
       
   156 //
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 MMusAvaObserver::TAvailabilityName CMusAvaRegisterAvailability::Name()
       
   160     {
       
   161     return MMusAvaObserver::EMusAvaNameRegistration;
       
   162     }
       
   163 
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // An event related to SIP Profile has accorred
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 void CMusAvaRegisterAvailability::ProfileRegistryEventOccurred(
       
   170                         TUint32 aProfileId,
       
   171                         MSIPProfileRegistryObserver::TEvent aEvent)
       
   172     {
       
   173     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::\
       
   174              ProfileRegistryEventOccurred " )
       
   175 
       
   176     CSIPProfile* profile = iSharedObj->MusAvaSip().Profile();
       
   177     if ( !profile )
       
   178         {
       
   179         MUS_LOG( "mus: [MUSAVA]    no sip profile found, returning!" )
       
   180         return;
       
   181         }
       
   182 
       
   183 
       
   184     TUint32 profileId = 0;
       
   185     TUint connectionId = 0;
       
   186 
       
   187     profile->GetParameter( KSIPProfileId, profileId );
       
   188 
       
   189     if ( aProfileId == profileId )
       
   190         {
       
   191         switch (aEvent)
       
   192             {
       
   193             case MSIPProfileRegistryObserver::EProfileCreated:
       
   194                 {
       
   195                 MUS_LOG( "mus: [MUSAVA]     Profile is created" )
       
   196                 MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability\
       
   197                         ::ProfileRegistryEventOccurred" )
       
   198                 }
       
   199                 break;
       
   200 
       
   201             case MSIPProfileRegistryObserver::EProfileUpdated:
       
   202                 {
       
   203                 MUS_LOG( "mus: [MUSAVA]     Profile is updated" )
       
   204                 }
       
   205                 break;
       
   206 
       
   207             case MSIPProfileRegistryObserver::EProfileRegistered:
       
   208                 {
       
   209                 MUS_LOG( "mus: [MUSAVA]     Profile is registred" )
       
   210                 
       
   211                 // Make sure that valid connection exists when registered
       
   212                 CSIPConnection* sipConnection = NULL;
       
   213                 TRAPD( err, sipConnection = iSharedObj->MusAvaSip().ConnectionL() );
       
   214                 if ( err != KErrNone || 
       
   215                     !sipConnection || 
       
   216                      sipConnection->State() == CSIPConnection::EUnavailable ||
       
   217                      sipConnection->State() == CSIPConnection::ESuspended ||
       
   218                      sipConnection->State() == CSIPConnection::EInactive )
       
   219                     {
       
   220                     MUS_LOG1( "mus: [MUSAVA]    CreateSIPConnectionL \
       
   221                             leave #%d", err )
       
   222                     SetState( MMusAvaObserver::MMusAvaObserver::EMusAvaConnectionErr );
       
   223                     }
       
   224                 else
       
   225                     {
       
   226     				TRAP( err, connectionId =
       
   227     					iSharedObj->ConnectionMonitor().ConnectionIDL() );
       
   228     	            if ( err == KErrNotFound )
       
   229     	            	{
       
   230     	            	SetState( MMusAvaObserver::EMusAvaConnectionErr );
       
   231     	            	}
       
   232     	           	else
       
   233     	           		{
       
   234     	           		iSharedObj->ConnectionMonitor().SetConnectionID(
       
   235     	           										connectionId );
       
   236     	           		if( err != KErrNone )
       
   237                             {
       
   238                             MUS_LOG1( "mus: [MUSAVA]     ConnectionIdL \
       
   239                             leave #%d", err )
       
   240                             }
       
   241                         }
       
   242                     }
       
   243                 
       
   244                 MUS_LOG( "mus: [MUSAVA]     Enable profile." )
       
   245                 TRAP( err, EnableRegisterL() );
       
   246                 if( err != KErrNone )
       
   247                     {
       
   248                     MUS_LOG1( "mus: [MUSAVA]     EnableRegisterL leave #%d",
       
   249                     err )
       
   250                     }
       
   251                                 
       
   252                 TRAP( err, CreateSipAddressProposalL(); );
       
   253                 if( err != KErrNone )
       
   254                     {
       
   255                     MUS_LOG1( "mus: [MUSAVA]     CreateSipAddressProposalL \
       
   256                     err #%d", err )
       
   257                     }
       
   258                 
       
   259                 SetState( MMusAvaObserver::EMusAvaStatusAvailable );
       
   260 
       
   261                 // update sipprofile in settings
       
   262                 if ( profileId != iSettings.SipProfileId() )
       
   263                     {
       
   264                     MUS_LOG1( "mus: [MUSAVA]     Profile id in settings before\
       
   265                     update:%d", iSettings.SipProfileId() )
       
   266                     iSettings.SetSipProfileId( profileId );
       
   267                     MUS_LOG1( "mus: [MUSAVA]     Profile id in settings after\
       
   268                     update:%d", iSettings.SipProfileId() )
       
   269                     }
       
   270                 else
       
   271                     {
       
   272                     MUS_LOG( "Profile is not needed to update!!!!!" )
       
   273                     }
       
   274                 }
       
   275                 break;
       
   276 
       
   277             case MSIPProfileRegistryObserver::EProfileDeregistered:
       
   278                 {
       
   279                 MUS_LOG( "mus: [MUSAVA]     Profile is deregistered" )
       
   280                 SetState( MMusAvaObserver::EMusAvaStatusNotRegistered );
       
   281                 }
       
   282                 break;
       
   283 
       
   284             case MSIPProfileRegistryObserver::EProfileDestroyed:
       
   285                 {
       
   286                 MUS_LOG( "mus: [MUSAVA]     Profile is destroyed " )
       
   287                 SetState( MMusAvaObserver::EMusAvaStatusNotRegistered );
       
   288                 }
       
   289                 break;
       
   290 
       
   291             default:
       
   292                 MUS_LOG( "mus: [MUSAVA]     Unknown Profile Id" )
       
   293                 break;
       
   294             }
       
   295         }
       
   296     else
       
   297         {
       
   298         MUS_LOG( "mus: [MUSAVA]    aProfileId != profileId" )
       
   299         }
       
   300 
       
   301     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::\
       
   302              ProfileRegistryEventOccurred" )
       
   303     }
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 // An asynchronous error has occurred related to SIP profile
       
   307 // Event is send to those observers, who have the
       
   308 // corresponding profile instantiated.
       
   309 // -----------------------------------------------------------------------------
       
   310 //
       
   311 void CMusAvaRegisterAvailability::ProfileRegistryErrorOccurred(
       
   312     TUint32 aProfileId,
       
   313     TInt /* aError */ )
       
   314     {
       
   315     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::\
       
   316              ProfileRegistryErrorOccurred" )
       
   317 
       
   318     CSIPProfile* profile = iSharedObj->MusAvaSip().Profile();
       
   319     if ( !profile )
       
   320         {
       
   321         return;
       
   322         }
       
   323 
       
   324     TUint32 profileId;
       
   325 
       
   326     profile->GetParameter( KSIPProfileId, profileId );
       
   327 
       
   328     if( profileId == aProfileId )
       
   329         {
       
   330         SetState( MMusAvaObserver::EMusAvaStatusNotRegistered );
       
   331         }
       
   332 
       
   333     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::\
       
   334              ProfileRegistryErrorOccurred" )
       
   335     }
       
   336 
       
   337 
       
   338 // -----------------------------------------------------------------------------
       
   339 //
       
   340 // -----------------------------------------------------------------------------
       
   341 //
       
   342 void CMusAvaRegisterAvailability::CreateSipAddressProposalL()
       
   343     {
       
   344     MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::\
       
   345         CreateSipAddressProposalL() " )
       
   346 
       
   347     HBufC* domain = iSharedObj->MusAvaSip().OwnDomainLC();
       
   348 
       
   349     const TDesC& telNumber = iSettings.TelNumber();
       
   350 
       
   351     iSettings.SetSipAddressProposalL( telNumber, *domain );
       
   352 
       
   353     CleanupStack::PopAndDestroy( domain );
       
   354 
       
   355     MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::\
       
   356         CreateSipAddressProposalL() " )
       
   357     }
       
   358 
       
   359 
       
   360 // -----------------------------------------------------------------------------
       
   361 // Connection state has changed.
       
   362 // iSipConnection has to be instantiated for us to get these callbacks.
       
   363 // from base class MSIPConnectionObserver
       
   364 // -----------------------------------------------------------------------------
       
   365 //
       
   366 TInt CMusAvaRegisterAvailability::ConnectionStateChanged(
       
   367     CSIPConnection::TState aState )
       
   368     {
       
   369     MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::\
       
   370     ConnectionStateChanged" )
       
   371     TInt err = 0;
       
   372     switch ( aState )
       
   373         {
       
   374         case CSIPConnection::EInit:
       
   375             {
       
   376             MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::EInit" )
       
   377             break;
       
   378             }
       
   379         case CSIPConnection::EActive:
       
   380             {
       
   381             MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::EActive" )
       
   382             break;
       
   383             }
       
   384         case CSIPConnection::ESuspended:
       
   385             {
       
   386             MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::ESuspended" )
       
   387             SetState( MMusAvaObserver::EMusAvaConnectionErr );
       
   388             break;
       
   389             }
       
   390         case CSIPConnection::EInactive:
       
   391             {
       
   392             MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::EInactive" )
       
   393             // If we get here, then PDP context is probably
       
   394             // unavailable => close an existing PDP context.
       
   395             MUS_LOG( "mus: [MUSAVA] now calling CloseExistingConnectionL" )
       
   396             iSharedObj->ConnectionMonitor().KillPdpContext();
       
   397             TRAPD( leaveCode, err = RegisterL() )
       
   398             if ( !leaveCode || err )
       
   399                 {
       
   400                 SetState( MMusAvaObserver::EMusAvaConnectionErr );
       
   401                 }
       
   402             else
       
   403                 {
       
   404                 SetState( MMusAvaObserver::EMusAvaStatusAvailable );
       
   405                 }
       
   406             break;
       
   407             }
       
   408         case CSIPConnection::EUnavailable:
       
   409             {
       
   410             MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::EUnavailable" )
       
   411             SetState( MMusAvaObserver::EMusAvaConnectionErr );
       
   412             break;
       
   413             }
       
   414         default:
       
   415             {
       
   416             MUS_LOG( "mus: [MUSAVA] in default branch => ESipConnUnknown" )
       
   417             break;
       
   418             }
       
   419         }
       
   420 
       
   421     MUS_LOG( "mus: [MUSAVA]: <- CMusAvaRegisterAvailability::ConnectionStateChanged" )
       
   422 
       
   423     return ETrue;
       
   424     }
       
   425 
       
   426 // -----------------------------------------------------------------------------
       
   427 // Initialize SIP Registration.
       
   428 // -----------------------------------------------------------------------------
       
   429 //
       
   430 TBool CMusAvaRegisterAvailability::InitializeRegister()
       
   431     {
       
   432     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::\
       
   433               InitializeRegister " )
       
   434 
       
   435     MUS_LOG( "mus: [MUSAVA] Create SIP Profile " )
       
   436     TBool profileCreated = EFalse;
       
   437     TRAPD( err, profileCreated = iSharedObj->MusAvaSip().CreateProfileL() );
       
   438     if ( err || !profileCreated )
       
   439         {
       
   440         MUS_LOG( "mus: [MUSAVA] Profile is not created " )
       
   441         MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::\
       
   442                   InitializeRegister " )
       
   443         SetState( MMusAvaObserver::EMusAvaStatusNoSipProfile );
       
   444         return EFalse;
       
   445         }
       
   446         
       
   447     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::\
       
   448               InitializeRegister " )
       
   449 
       
   450     return ETrue;
       
   451     }
       
   452 
       
   453 
       
   454 // -----------------------------------------------------------------------------
       
   455 // SIP Registration.
       
   456 // -----------------------------------------------------------------------------
       
   457 //
       
   458 TBool CMusAvaRegisterAvailability::RegisterL()
       
   459     {
       
   460     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::RegisterL " )
       
   461 
       
   462     MUS_LOG( "mus: [MUSAVA]     Checks if the profile is not enabled - \
       
   463                  Enable" )
       
   464     if ( !InitializeRegister())
       
   465         {
       
   466         MUS_LOG( "mus: [MUSAVA]  SIP register initilisation fails " )
       
   467         MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::\
       
   468         Register " )
       
   469         return EFalse;
       
   470         }
       
   471         
       
   472     EnableRegisterL();
       
   473    	if ( !UpdateSIPProfile()  )
       
   474    		{
       
   475    		return EFalse;	
       
   476    		}
       
   477     return RegistrationStatusL();
       
   478     }
       
   479 
       
   480 // -----------------------------------------------------------------------------
       
   481 // Enable SIP Registration.
       
   482 // -----------------------------------------------------------------------------
       
   483 //
       
   484 void CMusAvaRegisterAvailability::EnableRegisterL()
       
   485     {
       
   486     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::EnableRegisterL " )		
       
   487  	MUS_LOG( "mus: [MUSAVA]   Fetch SIP ProfileRegistry" )
       
   488  	
       
   489     CSIPProfileRegistry& registry = iSharedObj->MusAvaSip().ProfileRegistryL();
       
   490     MUS_LOG( "mus: [MUSAVA]   Profile status" )
       
   491     if ( !registry.IsEnabled( *iSharedObj->MusAvaSip().Profile() ) )
       
   492         {
       
   493         MUS_LOG("mus: [MUSAVA]     Calling EnableL()" )
       
   494         registry.EnableL( *iSharedObj->MusAvaSip().Profile(), 
       
   495                         iSharedObj->MusAvaSip().ConnectionObserver() );
       
   496         }
       
   497        
       
   498     // Try to write client information to CenRep of client resolver.
       
   499     // This functionality is needed in __VOIP enabled terminals.
       
   500     // In __VOIP disabled builds this will fail because of a lack of needed 
       
   501     // CenRep UID. To avoid branching, we just try to do this and let it fail 
       
   502     // in normal build.
       
   503     CMusAvaClientResolverUtil* resolver = 
       
   504                                 iSharedObj->MusAvaSip().ClientResolverUtil();
       
   505     if ( resolver )
       
   506         {
       
   507         TRAP_IGNORE( resolver->RegisterClientWithUserL( 
       
   508                 *iSharedObj->MusAvaSip().Profile() ) )
       
   509         }
       
   510                     
       
   511     MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::EnableRegisterL " )		
       
   512     }
       
   513 
       
   514 
       
   515 // -----------------------------------------------------------------------------
       
   516 // Update SIP Registration.
       
   517 // -----------------------------------------------------------------------------
       
   518 //
       
   519 TBool CMusAvaRegisterAvailability::UpdateSIPProfile()
       
   520     {
       
   521     MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::UpdateSIPProfile " )
       
   522     TUint32 profileId = 0; // Initial value doesn't matter. 
       
   523                            // but better to set it to default profile
       
   524     TInt err = iSharedObj->MusAvaSip().Profile()->GetParameter( 
       
   525         KSIPProfileId, profileId );
       
   526     if( err == KErrNone)
       
   527         {
       
   528         MUS_LOG1("mus: [MUSAVA]    Set SIP Profile ID in Central Repositary \
       
   529             to %d",profileId )
       
   530         iSettings.SetSipProfileId( profileId );
       
   531         MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::UpdateSIPProfile " )
       
   532         return ETrue;
       
   533         }
       
   534     else
       
   535     	{
       
   536     	MUS_LOG1("mus: [MUSAVA]   SIP Profile ID is not found. \
       
   537     	remove Id away from Central Repositary %d",err )
       
   538     	iSettings.SetSipProfileId( err );
       
   539     	MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::UpdateSIPProfile " )
       
   540     	return EFalse;	
       
   541     	}
       
   542     }
       
   543     
       
   544 // -----------------------------------------------------------------------------
       
   545 // SIP profile Registration status.
       
   546 // -----------------------------------------------------------------------------
       
   547 //
       
   548 TBool CMusAvaRegisterAvailability::RegistrationStatusL()
       
   549 	{
       
   550 	MUS_LOG( "mus: [MUSAVA]  -> CMusAvaRegisterAvailability::RegistrationStatusL " )	
       
   551 	MUS_LOG("mus: [MUSAVA]     Checking profile registration" )
       
   552 	
       
   553 	TBool registered;
       
   554 
       
   555     TInt err = iSharedObj->MusAvaSip().Profile()->GetParameter( 
       
   556         KSIPProfileRegistered, registered );
       
   557 
       
   558     if( err != KErrNone || !registered )
       
   559         {
       
   560         MUS_LOG2( "mus: [MUSAVA]     Profile not registered, get error=%d, \
       
   561             register value=%d", err, registered )
       
   562 
       
   563         SetState( MMusAvaObserver::EMusAvaStatusInProgress );
       
   564         MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::RegistrationStatusL " )
       
   565         return EFalse;
       
   566         }
       
   567     else
       
   568         {
       
   569         MUS_LOG("mus: [MUSAVA]     profile is registred " )
       
   570         
       
   571         iSharedObj->MusAvaSip().ConnectionL();
       
   572         
       
   573         MUS_LOG("mus: [MUSAVA]     connection created " )
       
   574 
       
   575         HBufC* domain = iSharedObj->MusAvaSip().OwnDomainLC();
       
   576         const TDesC& telNumber = iSettings.TelNumber();
       
   577 
       
   578         iSettings.SetSipAddressProposalL( telNumber, *domain );
       
   579 
       
   580         CleanupStack::PopAndDestroy( domain );
       
   581         SetState( MMusAvaObserver::EMusAvaStatusAvailable );
       
   582         MUS_LOG( "mus: [MUSAVA]  <- CMusAvaRegisterAvailability::RegistrationStatusL " )	
       
   583         return ETrue;
       
   584         }
       
   585     }
       
   586   
       
   587