multimediacommsengine/mmcesrv/mmceserver/src/mcesipextensions.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <badesca.h>
       
    21 #include <sipservertransaction.h>
       
    22 #include <sipclienttransaction.h>
       
    23 #include <sipstrings.h>
       
    24 #include <sipstrconsts.h>
       
    25 #include <sipmessageelements.h>
       
    26 #include <siprequireheader.h>
       
    27 #include "mcesipextensions.h"
       
    28 #include "mcedictionary.h"
       
    29 #include "mcesip.h"
       
    30 #include "mcecomsession.h"
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CMceSipExtensions::CMceSipExtensions
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CMceSipExtensions* CMceSipExtensions::NewL()
       
    37     {
       
    38     CMceSipExtensions* self = new( ELeave ) CMceSipExtensions();
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     CleanupStack::Pop( self );
       
    42     return self;
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CMceSipExtensions::CMceSipExtensions
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 CMceSipExtensions::CMceSipExtensions()
       
    50     {
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CMceSipExtensions::ConstructL
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 void CMceSipExtensions::ConstructL()
       
    58     {
       
    59     iLocal = new( ELeave ) CMceDictionary();
       
    60     AddDefaultsL( *iLocal );
       
    61     iRemote = new( ELeave ) CMceDictionary();
       
    62     AddDefaultsL( *iRemote );
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CMceSipExtensions::~CMceSipExtensions
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CMceSipExtensions::~CMceSipExtensions()
       
    70  	{
       
    71  	delete iLocal;
       
    72  	delete iRemote;
       
    73  	}
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CMceSipExtensions::Local
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 CMceSipExtensions::TLevel CMceSipExtensions::Local( TExtension aExtension )
       
    80     {
       
    81     return Level( *iLocal, aExtension );
       
    82     }
       
    83     
       
    84 // -----------------------------------------------------------------------------
       
    85 // CMceSipExtensions::Remote
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 CMceSipExtensions::TLevel CMceSipExtensions::Remote( TExtension aExtension )
       
    89     {
       
    90     return Level( *iRemote, aExtension );
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CMceSipExtensions::SetLocal
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 void CMceSipExtensions::SetLocal( TExtension aExtension, TLevel aLevel )
       
    98     {
       
    99     SetLevel( *iLocal, aExtension, aLevel );
       
   100     }
       
   101     
       
   102 // -----------------------------------------------------------------------------
       
   103 // CMceSipExtensions::SetRemote
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 void CMceSipExtensions::SetRemote( TExtension aExtension, TLevel aLevel )
       
   107     {
       
   108     SetLevel( *iRemote, aExtension, aLevel );
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CMceSipExtensions::AddDefaultsL
       
   113 // -----------------------------------------------------------------------------
       
   114 //
       
   115 void CMceSipExtensions::AddDefaultsL( CMceDictionary& aDictionary )
       
   116     {
       
   117     // Addin all the MCE extension headers Update, Subscribe, Prack, Refer, Notify
       
   118     RArray< TExtension > extMethods;
       
   119     CleanupClosePushL( extMethods );
       
   120     LocalSipExtensionsL( extMethods );
       
   121     
       
   122     for (TInt index=0; index < extMethods.Count(); index++ )
       
   123     	{
       
   124     	CMceDictionaryItem* extObj = 
       
   125 	        new( ELeave ) CMceKeyTValuePair<TLevel>( 
       
   126 	        	static_cast<TInt>(extMethods[ index ]), ESupported );
       
   127 	    CleanupStack::PushL( extObj );
       
   128 	    aDictionary.AddL( extObj );
       
   129 	    CleanupStack::Pop( extObj );
       
   130     	}
       
   131     CleanupStack::PopAndDestroy( &extMethods );
       
   132     
       
   133     // 100rel
       
   134     CMceDictionaryItem* item100rel = 
       
   135         new( ELeave ) CMceKeyTValuePair<TLevel>( E100rel, ESupported );
       
   136     CleanupStack::PushL( item100rel );
       
   137     aDictionary.AddL( item100rel );
       
   138     CleanupStack::Pop( item100rel );
       
   139     
       
   140     // QOS preconditions
       
   141     CMceDictionaryItem* itemQosPreconds = 
       
   142         new( ELeave ) CMceKeyTValuePair<TLevel>( EQosPreconds, ESupported );
       
   143     CleanupStack::PushL( itemQosPreconds );
       
   144     aDictionary.AddL( itemQosPreconds );
       
   145     CleanupStack::Pop( itemQosPreconds );
       
   146     
       
   147     //SEC precondition
       
   148     CMceDictionaryItem* itemSecPreconds = 
       
   149         new( ELeave ) CMceKeyTValuePair<TLevel>( ESecPreconds, ESupported );
       
   150     CleanupStack::PushL( itemSecPreconds );
       
   151     aDictionary.AddL( itemSecPreconds );
       
   152     CleanupStack::Pop( itemSecPreconds );
       
   153     
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CMceSipExtensions::Level
       
   158 // -----------------------------------------------------------------------------
       
   159 //
       
   160 CMceSipExtensions::TLevel CMceSipExtensions::Level( 
       
   161                                         const CMceDictionary& aDictionary,
       
   162                                         TExtension aExtension ) const
       
   163     {
       
   164     TLevel ret = ENotSupported;
       
   165     CMceKeyTValuePair<TLevel>* pair = static_cast<CMceKeyTValuePair<TLevel>*>
       
   166         ( aDictionary.Pair( aExtension ) );
       
   167     if ( pair )
       
   168         {
       
   169         ret = pair->Value();
       
   170         }
       
   171     return ret;
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CMceSipExtensions::SetLevel
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 void CMceSipExtensions::SetLevel( CMceDictionary& aDictionary, 
       
   179                                   TExtension aExtension, 
       
   180                                   TLevel aLevel )
       
   181     {
       
   182     CMceKeyTValuePair<TLevel>* pair = static_cast<CMceKeyTValuePair<TLevel>*>
       
   183         ( aDictionary.Pair( aExtension ) );
       
   184     if ( pair )
       
   185         {
       
   186         pair->SetValue( aLevel );
       
   187         }
       
   188     }
       
   189 
       
   190 // -----------------------------------------------------------------------------
       
   191 // CMceSipExtensions::LevelL
       
   192 // -----------------------------------------------------------------------------
       
   193 //
       
   194 CMceSipExtensions::TLevel CMceSipExtensions::LevelL( 
       
   195                                     CSIPTransactionBase& aTransaction,
       
   196                                     CMceSipExtensions::TExtension aExtension )
       
   197     {
       
   198     CMceSipExtensions::TLevel level = CMceSipExtensions::ENotSupported;
       
   199     TInt reqInd = SipStrConsts::ERequireHeader;
       
   200     TInt suppInd = SipStrConsts::ESupportedHeader;
       
   201     TInt allowInd = SipStrConsts::EAllowHeader;
       
   202     
       
   203     const CSIPMessageElements* elements = MceSip::ToMessageElements( aTransaction );
       
   204     if ( elements )
       
   205         {
       
   206         switch ( aExtension )
       
   207             {
       
   208             case CMceSipExtensions::E100rel:
       
   209                 {
       
   210                 if ( MceSip::HasHeaderValueL( *elements, reqInd, KMceSip100Rel ) )
       
   211                     {
       
   212                     level = CMceSipExtensions::ERequired;
       
   213                     }
       
   214                 else if ( MceSip::HasHeaderValueL( *elements, 
       
   215                                                   suppInd, 
       
   216                                                   KMceSip100Rel ) )
       
   217                     {
       
   218                     level = CMceSipExtensions::ESupported;
       
   219                     }
       
   220                 else
       
   221                     {
       
   222                     // NOP
       
   223                     }
       
   224                 break;
       
   225                 }
       
   226             case CMceSipExtensions::EQosPreconds:
       
   227             case CMceSipExtensions::ESecPreconds:
       
   228                 {
       
   229                 if ( MceSip::HasHeaderValueL( *elements, reqInd, KMceSipPrecondition ) )
       
   230                     {
       
   231                     level = CMceSipExtensions::ERequired;
       
   232                     }
       
   233                 else if ( MceSip::HasHeaderValueL( *elements, 
       
   234                                                   suppInd, 
       
   235                                                   KMceSipPrecondition ) )
       
   236                     {
       
   237                     level = CMceSipExtensions::ESupported;
       
   238                     }
       
   239                 else
       
   240                     {
       
   241                     // NOP
       
   242                     }
       
   243                 break;
       
   244                 }
       
   245             case CMceSipExtensions::EUpdate:
       
   246                 {
       
   247                 if ( MceSip::HasHeaderValueL( *elements, allowInd,
       
   248                     SIPStrings::StringF( SipStrConsts::EUpdate ).DesC() ) )
       
   249                     {
       
   250                     level = CMceSipExtensions::ESupported;
       
   251                     }
       
   252                 break;
       
   253                 }
       
   254             case CMceSipExtensions::ESubscribe:
       
   255                 {
       
   256                 if ( MceSip::HasHeaderValueL( *elements, allowInd,
       
   257                     SIPStrings::StringF( SipStrConsts::ESubscribe ).DesC() ) )
       
   258                     {
       
   259                     level = CMceSipExtensions::ESupported;
       
   260                     }
       
   261                 break;
       
   262                 } 
       
   263              case CMceSipExtensions::ERefer:
       
   264                 {
       
   265                 if ( MceSip::HasHeaderValueL( *elements, allowInd,
       
   266                     SIPStrings::StringF( SipStrConsts::ERefer ).DesC() ) )
       
   267                     {
       
   268                     level = CMceSipExtensions::ESupported;
       
   269                     }
       
   270                 break;
       
   271                 }  
       
   272              case CMceSipExtensions::ENotify:
       
   273                 {
       
   274                 if ( MceSip::HasHeaderValueL( *elements, allowInd,
       
   275                     SIPStrings::StringF( SipStrConsts::ENotify ).DesC() ) )
       
   276                     {
       
   277                     level = CMceSipExtensions::ESupported;
       
   278                     }
       
   279                 break;
       
   280                 }
       
   281              case CMceSipExtensions::EPrack:
       
   282                 {
       
   283                 if ( MceSip::HasHeaderValueL( *elements, allowInd,
       
   284                     SIPStrings::StringF( SipStrConsts::EPrack ).DesC() ) )
       
   285                     {
       
   286                     level = CMceSipExtensions::ESupported;
       
   287                     }
       
   288                 break;
       
   289                 }                  
       
   290             default:
       
   291                 {
       
   292                 // NOP
       
   293                 break;
       
   294                 }
       
   295             }
       
   296         }
       
   297     return level;
       
   298     }
       
   299 
       
   300 // -----------------------------------------------------------------------------
       
   301 // CMceSipExtensions::UpdateL
       
   302 // -----------------------------------------------------------------------------
       
   303 //
       
   304 void CMceSipExtensions::UpdateL( CSIPServerTransaction& aTransaction )
       
   305     {
       
   306     const CSIPMessageElements* msg = MceSip::ToMessageElements( aTransaction );
       
   307     User::LeaveIfError( msg ? KErrNone : KErrArgument );
       
   308     
       
   309     // Get the values before updating anything. If a leave happens, the
       
   310     // values remain not modified.
       
   311     TLevel remote100rel = LevelL( aTransaction, CMceSipExtensions::E100rel );
       
   312     
       
   313     TLevel remoteQosPrecond = LevelL( aTransaction, 
       
   314                                      CMceSipExtensions::EQosPreconds );
       
   315     TLevel remoteSecPrecond = LevelL( aTransaction, 
       
   316                                      CMceSipExtensions::ESecPreconds );                                 
       
   317     
       
   318     // Check if the local valus will be modified
       
   319     TLevel local100rel = Local( CMceSipExtensions::E100rel );
       
   320     if ( remote100rel == CMceSipExtensions::ERequired )
       
   321         {
       
   322         if ( local100rel == CMceSipExtensions::ENotSupported )
       
   323             {
       
   324             User::Leave( KErrNotSupported );
       
   325             }
       
   326         else
       
   327             {
       
   328             local100rel = remote100rel;
       
   329             }
       
   330         }
       
   331     
       
   332     TLevel localQosPrecond = Local( CMceSipExtensions::EQosPreconds );
       
   333     if ( remoteQosPrecond == CMceSipExtensions::ERequired )
       
   334         {
       
   335         if ( localQosPrecond == CMceSipExtensions::ENotSupported )
       
   336             {
       
   337             User::Leave( KErrNotSupported );
       
   338             }
       
   339         else
       
   340             {
       
   341             localQosPrecond = remoteQosPrecond;
       
   342             }
       
   343         }
       
   344     
       
   345     TLevel localSecPrecond = Local( CMceSipExtensions::ESecPreconds );
       
   346     if ( remoteSecPrecond == CMceSipExtensions::ERequired )
       
   347         {
       
   348         if ( localSecPrecond == CMceSipExtensions::ENotSupported &&
       
   349         	localQosPrecond == CMceSipExtensions::ENotSupported )
       
   350             {
       
   351             User::Leave( KErrNotSupported );
       
   352             }
       
   353         else
       
   354             {
       
   355             localSecPrecond = remoteSecPrecond;
       
   356             }
       
   357         }
       
   358         
       
   359     // Finally set the values, first local
       
   360     // 100rel
       
   361     SetLocal( CMceSipExtensions::E100rel, local100rel );
       
   362             
       
   363     // precond
       
   364     SetLocal( CMceSipExtensions::EQosPreconds, localQosPrecond );
       
   365     
       
   366     // sec precond
       
   367     SetLocal( CMceSipExtensions::ESecPreconds, localSecPrecond );
       
   368     
       
   369     // then remote
       
   370     // 100rel
       
   371     SetRemote( CMceSipExtensions::E100rel, remote100rel );
       
   372             
       
   373     // precond
       
   374     SetRemote( CMceSipExtensions::EQosPreconds, remoteQosPrecond );
       
   375     
       
   376     //sec precond
       
   377     SetRemote( CMceSipExtensions::ESecPreconds, remoteSecPrecond );
       
   378         
       
   379     // MCE sipextension allow header : UPDATE, PRACk, Subscribe, REfer, Notify
       
   380     
       
   381     SetExtensionAllowHeadersL( msg );
       
   382     }
       
   383 
       
   384 // -----------------------------------------------------------------------------
       
   385 // CMceSipExtensions::UpdateL
       
   386 // -----------------------------------------------------------------------------
       
   387 //
       
   388 void CMceSipExtensions::UpdateL( CSIPClientTransaction& aTransaction )
       
   389     {
       
   390     const CSIPMessageElements* msg = MceSip::ToMessageElements( aTransaction );
       
   391     User::LeaveIfError( msg ? KErrNone : KErrArgument );
       
   392     
       
   393     if ( MceSip::ResponseCode( aTransaction ) == KMceSipExtensionRequired )
       
   394         {
       
   395         TBool reqPreconds = MceSip::HasHeaderValueL( 
       
   396                                         *msg, 
       
   397                                         SipStrConsts::ERequireHeader,
       
   398                                         KMceSipPrecondition );
       
   399         if ( reqPreconds )
       
   400             {
       
   401             // needs to require preconditions locally, if possible
       
   402             if ( Local( CMceSipExtensions::EQosPreconds ) != 
       
   403                 CMceSipExtensions::ENotSupported )
       
   404                 {
       
   405                 SetLocal( CMceSipExtensions::EQosPreconds, 
       
   406                 CMceSipExtensions::ERequired );
       
   407                 }
       
   408             else if (Local( CMceSipExtensions::ESecPreconds ) != 
       
   409                 CMceSipExtensions::ENotSupported && 
       
   410                 Local( CMceSipExtensions::EQosPreconds ) == 
       
   411                 CMceSipExtensions::ENotSupported ) 
       
   412             	{
       
   413             	SetLocal( CMceSipExtensions::ESecPreconds, 
       
   414                 CMceSipExtensions::ERequired );
       
   415             	}
       
   416             else
       
   417                 {
       
   418                 User::Leave( KErrNotSupported );
       
   419                 }        
       
   420             }
       
   421         else
       
   422         	{
       
   423         	// "Require: precondition" is the only extension required in 421 response 
       
   424         	// that may lead to a retried INVITE. 
       
   425         	// All the other required extensions to the initial INVITE terminate the 
       
   426         	// session.
       
   427         	User::Leave( KErrNotSupported );
       
   428         	}
       
   429         }
       
   430     else if ( MceSip::ResponseType( aTransaction ) == E1XX ||
       
   431               MceSip::ResponseType( aTransaction ) == E2XX ) 
       
   432         {
       
   433         if ( MceSip::ResponseType( aTransaction ) == E1XX  &&
       
   434              Local( CMceSipExtensions::E100rel ) == 
       
   435                     CMceSipExtensions::ERequired )
       
   436             {
       
   437             // use of 100rel extension is required locally,
       
   438             // check, that provisional response is sent reliably
       
   439             TBool req100Rel = MceSip::HasHeaderValueL( 
       
   440                                         *msg, 
       
   441                                         SipStrConsts::ERequireHeader,
       
   442                                         KMceSip100Rel );
       
   443             User::LeaveIfError( req100Rel ? KErrNone : KErrNotSupported );
       
   444             }
       
   445        
       
   446         SetExtensionAllowHeadersL( msg );
       
   447         }
       
   448     else
       
   449         {
       
   450         // NOP
       
   451         }
       
   452     }
       
   453 
       
   454 // -----------------------------------------------------------------------------
       
   455 // CMceSipExtensions::Update
       
   456 // -----------------------------------------------------------------------------
       
   457 //
       
   458 void CMceSipExtensions::Update( CMceComSession& aBody )
       
   459     {
       
   460     for ( TInt i = 0; i< aBody.iSessionModifiers.Count(); i++ )
       
   461         {
       
   462         Update( i, aBody.Modifier( i ) );
       
   463         }
       
   464     }
       
   465 
       
   466 // -----------------------------------------------------------------------------
       
   467 // CMceSipExtensions::Update
       
   468 // -----------------------------------------------------------------------------
       
   469 //
       
   470 void CMceSipExtensions::Update( TMceSessionModifier aModifier, TUint aValue )
       
   471     {
       
   472     TInt extension = KErrNotFound;
       
   473     TInt level = KErrNotFound;    
       
   474      
       
   475     switch ( aModifier )
       
   476         {
       
   477         case KMcePreconditions:
       
   478             {
       
   479             extension = CMceSipExtensions::EQosPreconds;
       
   480             if ( aValue == KMcePreconditionsNotUsed )
       
   481                 {
       
   482                 level = CMceSipExtensions::ENotSupported;
       
   483                 }
       
   484             else if ( aValue == KMcePreconditionsSupported )
       
   485                 {
       
   486                 level = CMceSipExtensions::ESupported;
       
   487                 }
       
   488             else
       
   489                 {
       
   490                 // NOP
       
   491                 }
       
   492             break;
       
   493             }
       
   494         case KMceSecPreconditions:
       
   495             {
       
   496             extension = CMceSipExtensions::ESecPreconds;
       
   497             if ( aValue == KMcePreconditionsNotUsed )
       
   498                 {
       
   499                 level = CMceSipExtensions::ENotSupported;
       
   500                 }
       
   501             else if ( aValue == KMcePreconditionsE2ESupported )
       
   502                 {
       
   503                 level = CMceSipExtensions::ESupported;
       
   504                 }
       
   505             else
       
   506                 {
       
   507                 // NOP
       
   508                 }
       
   509             break;
       
   510             }    
       
   511         case KMce100Rel:
       
   512             {
       
   513             extension = CMceSipExtensions::E100rel;
       
   514             if ( aValue == KMce100RelNotUsed )
       
   515                 {
       
   516                 level = CMceSipExtensions::ENotSupported;
       
   517                 }
       
   518             else if ( aValue == KMce100RelSupported )
       
   519                 {
       
   520                 level = CMceSipExtensions::ESupported;
       
   521                 }
       
   522             else if ( aValue == KMce100RelRequired )
       
   523                 {
       
   524                 level = CMceSipExtensions::ERequired;
       
   525                 }
       
   526             else
       
   527                 {
       
   528                 // NOP
       
   529                 }
       
   530             break;
       
   531             }
       
   532         default:
       
   533             {
       
   534             // NOP
       
   535             break;
       
   536             }
       
   537         }
       
   538     if ( extension != KErrNotFound && level != KErrNotFound )
       
   539         {
       
   540         SetLocal( ( CMceSipExtensions::TExtension ) ( extension ),
       
   541                   ( CMceSipExtensions::TLevel ) ( level ) );
       
   542         }
       
   543     }
       
   544 // -----------------------------------------------------------------------------
       
   545 // CMceSipExtensions::RemoteIMSRel5
       
   546 // -----------------------------------------------------------------------------
       
   547 //
       
   548 TBool CMceSipExtensions::RemoteIMSRel5()
       
   549     {
       
   550     CMceSipExtensions::TLevel localQos = 
       
   551         Local( CMceSipExtensions::EQosPreconds );
       
   552     
       
   553     return  ( localQos == CMceSipExtensions::ERequired );
       
   554     }
       
   555 
       
   556  // -----------------------------------------------------------------------------
       
   557 // CMceSipExtensions::ExtensionAllowMethods
       
   558 // -----------------------------------------------------------------------------
       
   559 //    
       
   560 void CMceSipExtensions::ExtensionAllowMethodsL( RArray<TInt>& aArray )
       
   561 	{
       
   562 	User::LeaveIfError( aArray.Append( SipStrConsts::EUpdate ));
       
   563 	User::LeaveIfError( aArray.Append( SipStrConsts::EPrack ));
       
   564 	User::LeaveIfError( aArray.Append( SipStrConsts::ESubscribe ));
       
   565 	User::LeaveIfError( aArray.Append( SipStrConsts::ERefer ));
       
   566 	User::LeaveIfError( aArray.Append( SipStrConsts::ENotify ));	
       
   567 	}	
       
   568 	
       
   569  // -----------------------------------------------------------------------------
       
   570 // CMceSipExtensions::LocalSipExtensions
       
   571 // -----------------------------------------------------------------------------
       
   572 //    
       
   573 void CMceSipExtensions::LocalSipExtensionsL( RArray<TExtension>& aArray )
       
   574 	{
       
   575 	User::LeaveIfError( aArray.Append( CMceSipExtensions::EUpdate ));
       
   576 	User::LeaveIfError( aArray.Append( CMceSipExtensions::EPrack ));
       
   577 	User::LeaveIfError( aArray.Append( CMceSipExtensions::ESubscribe ));
       
   578 	User::LeaveIfError( aArray.Append( CMceSipExtensions::ERefer ));
       
   579 	User::LeaveIfError( aArray.Append( CMceSipExtensions::ENotify ));	
       
   580 	}
       
   581 	
       
   582  // -----------------------------------------------------------------------------
       
   583 // CMceSipExtensions::SetExtensionAllowHeaders
       
   584 // -----------------------------------------------------------------------------
       
   585 //    
       
   586 void CMceSipExtensions::SetExtensionAllowHeadersL( const CSIPMessageElements* aMessage )
       
   587 	{
       
   588 	RArray< TExtension > localExts;
       
   589 	CleanupClosePushL( localExts );
       
   590     RArray< TInt>  extMethods; 
       
   591     CleanupClosePushL( extMethods );
       
   592     TInt index = 0;
       
   593     LocalSipExtensionsL( localExts );
       
   594     ExtensionAllowMethodsL( extMethods );
       
   595     
       
   596     for ( index=0; index < extMethods.Count(); index++ )
       
   597     	{
       
   598     	
       
   599     	TBool extMethod = MceSip::HasHeaderValueL( 
       
   600 	                        *aMessage, 
       
   601 	                        SipStrConsts::EAllowHeader,
       
   602 	                        SIPStrings::StringF( extMethods[index] ).DesC() );
       
   603     	
       
   604     	SetRemote( localExts[ index ], extMethod ? 
       
   605     						ESupported : ENotSupported );
       
   606     	}
       
   607     CleanupStack::PopAndDestroy( &extMethods );
       
   608     CleanupStack::PopAndDestroy( &localExts );	
       
   609 	}
       
   610 // End of file