realtimenetprots/sipfw/SIP/Dialogs/src/Confirmed.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name          : Confirmed.cpp
       
    15 // Part of       : SIPDialogs
       
    16 // Version       : SIP/6.0 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include "Confirmed.h"
       
    22 #include "MDialogContext.h"
       
    23 #include "TransactionItemBase.h"
       
    24 #include "sipresponse.h"
       
    25 #include "CSigCompMgr.h"
       
    26 #include "sip.h"
       
    27 #include "TSIPTransportParams.h"
       
    28 
       
    29 _LIT8(KConfirmed, "Confirmed");
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // TConfirmed::TConfirmed
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 TConfirmed::TConfirmed (MDialogContext& aDialog,
       
    36                         TDialogStateBase& aStateTerminated)
       
    37  : TDialogStateBase(aDialog),
       
    38    iStateTerminated(aStateTerminated)
       
    39 	{
       
    40 	}
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // TConfirmed::Name
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 const TDesC8& TConfirmed::Name () const
       
    47 	{
       
    48 	return KConfirmed;
       
    49 	}
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // TConfirmed::SendL
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 void TConfirmed::SendL (TTransactionId& aTransactionId,
       
    56 						CSIPRequest* aRequest,
       
    57 						CTransactionItemBase& aTransactionItem,
       
    58 						CURIContainer& aRemoteTarget)
       
    59 
       
    60 	{
       
    61 	// When a dialog is in Confirmed state, its route must be fixed. Using any
       
    62 	// other registration id than KEmptyRegistrationId potentially causes
       
    63 	// the transaction layer to add an outbound proxy to the route. To prevent
       
    64 	// this, the registration id is forced to be KEmptyRegistrationId
       
    65 	TSIPTransportParams params(iDialog.TransportParams(KEmptyRegistrationId));
       
    66 	params.SetSkipNaptrAndSrv(iDialog.HasRouteSet());	
       
    67     aTransactionItem.SendL(params,aTransactionId,KEmptyRegistrationId,
       
    68                            aRequest,aRemoteTarget);
       
    69 	}
       
    70 
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // TConfirmed::SendL
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 void TConfirmed::SendL (CTransactionItemBase& aTransactionItem,
       
    77 						CSIPResponse* aResponse) 
       
    78 	{
       
    79 	TSIPTransportParams params(iDialog.TransportParams(KEmptyRegistrationId));
       
    80     aTransactionItem.SendL(params,aResponse,EFalse);
       
    81 	}
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // TConfirmed::ReceiveL
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 void TConfirmed::ReceiveL (TTransactionId aTransactionId, 
       
    88                            CSIPRequest* aRequest)
       
    89 	{
       
    90     PassToOwnerL (aTransactionId,aRequest);
       
    91 	}
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // TConfirmed::ReceiveL
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 void TConfirmed::ReceiveL (CTransactionItemBase& aTransactionItem, 
       
    98                            CSIPResponse* aResponse)
       
    99 	{
       
   100     if (aResponse->Type() != CSIPResponse::E1XX &&
       
   101         aTransactionItem.OverlappingRestricted())
       
   102         {
       
   103         aTransactionItem.SetOverlappingRestricted(EFalse);
       
   104         }
       
   105     if (aResponse->Type() == CSIPResponse::E2XX &&
       
   106         aTransactionItem.TargetRefresh())
       
   107         {
       
   108         iDialog.SetRemoteTargetWithMsgL(*aResponse);
       
   109         }
       
   110     PassToOwnerL(aTransactionItem,aResponse);
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // TConfirmed::EndTransaction
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void TConfirmed::EndTransaction (CTransactionItemBase& aTransactionItem, 
       
   118                                  TInt aReason)
       
   119 	{
       
   120 	if (aReason)
       
   121 		{
       
   122 		PassToOwner(aTransactionItem,aReason);
       
   123 		}
       
   124 	}
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // TConfirmed::GetState
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 void TConfirmed::GetState (CSIPInternalStates::TState& aState)
       
   131     {
       
   132     aState = CSIPInternalStates::EDialogConfirmed;
       
   133     }