multimediacommsengine/tsrc/testdriver/siptester/src/TCmdSendReferWithinDialog.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004 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:  Implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include <sipclienttransaction.h>
       
    19 #include <sipmessageelements.h>
       
    20 
       
    21 #include <sipclienttransaction.h>
       
    22 #include <sipreferdialogassoc.h>
       
    23 #include <sipnotifydialogassoc.h>
       
    24 
       
    25 #include "TCmdSendReferWithinDialog.h"
       
    26 #include "SIPConstants.h"
       
    27 
       
    28 /**
       
    29  * INPUT:
       
    30  *   Headers:		Contact*, Content-Type*, Content-Encoding*, Route*
       
    31  *   Parameters:	Content*
       
    32  *   IDs:			NotifyDialogId*, ReferDialogId*
       
    33  *
       
    34  * OUTPUT:
       
    35  *   Parameters:	-
       
    36  *   IDs:			TransactionId, ReferDialogId
       
    37  */
       
    38 void TCmdSendReferWithinDialog::ExecuteL()
       
    39 	{
       
    40 	// -- Setup ---------------------------------------------------------------
       
    41 
       
    42 	// Get SIP objects from registry
       
    43 	CSIPDialogAssocBase* dialogAssoc = GetAnyDialogAssocL();
       
    44 
       
    45 	// Extract required headers
       
    46     CSIPReferToHeader* referToHeader = ExtractReferToHeaderLC();
       
    47     
       
    48 	// Create a new dialog association
       
    49 	CSIPReferDialogAssoc* newdialogAssoc =
       
    50 						CSIPReferDialogAssoc::NewL( dialogAssoc->Dialog(),
       
    51 													referToHeader );
       
    52 	CleanupStack::Pop( referToHeader );
       
    53 	CleanupStack::PushL( newdialogAssoc );
       
    54 
       
    55 	// Extract both headers (that are still left) and content.
       
    56 	CSIPMessageElements* elements = ExtractHeadersAndContentLC();
       
    57 
       
    58 	// -- Execution -----------------------------------------------------------
       
    59 
       
    60 	// Start SIP refer transaction.
       
    61 	CSIPClientTransaction* transaction =
       
    62 							newdialogAssoc->SendReferL( elements );
       
    63 	CleanupStack::Pop( elements );
       
    64 
       
    65 	// -- Response creation ---------------------------------------------------
       
    66 
       
    67 	AddIdResponseL( KTransactionId, transaction );
       
    68 	CleanupStack::Pop( newdialogAssoc );
       
    69 	AddIdResponseL( KReferDialogId, newdialogAssoc );
       
    70 	}
       
    71 
       
    72 TBool TCmdSendReferWithinDialog::Match( const TTcIdentifier& aId )
       
    73 	{
       
    74 	return TTcSIPCommandBase::Match( aId, _L8("SendReferWithinDialog") );
       
    75 	}
       
    76 
       
    77 TTcCommandBase* TCmdSendReferWithinDialog::CreateL( MTcTestContext& aContext )
       
    78 	{
       
    79 	return new( ELeave ) TCmdSendReferWithinDialog( aContext );
       
    80 	}
       
    81