|
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 <sipinvitedialogassoc.h> |
|
20 #include <sipmessageelements.h> |
|
21 #include <sipsubscribedialogassoc.h> |
|
22 |
|
23 #include "TCmdSendInviteWithinDialog.h" |
|
24 #include "SIPConstants.h" |
|
25 |
|
26 /** |
|
27 * INPUT: |
|
28 * Headers: Contact*, Content-Type*, Content-Encoding*, Route* |
|
29 * Parameters: Content* |
|
30 * IDs: InviteDialogId*, SubscribeDialogId* |
|
31 * |
|
32 * OUTPUT: |
|
33 * Parameters: - |
|
34 * IDs: TransactionId, InviteDialogId |
|
35 */ |
|
36 void TCmdSendInviteWithinDialog::ExecuteL() |
|
37 { |
|
38 // -- Setup --------------------------------------------------------------- |
|
39 |
|
40 // Get SIP objects from registry |
|
41 CSIPSubscribeDialogAssoc* subscribeDialogAssoc = |
|
42 GetSubscribeDialogAssocL( EFalse ); |
|
43 |
|
44 // If there was a SubscribeDialogId, use it to create a new InviteDialogAssoc |
|
45 // If not, try to use a InviteDialogId for an existing InviteDialogAssoc |
|
46 CSIPInviteDialogAssoc* inviteDialogAssoc; |
|
47 if( subscribeDialogAssoc ) |
|
48 { |
|
49 // Create a new dialog association |
|
50 inviteDialogAssoc = |
|
51 CSIPInviteDialogAssoc::NewLC( subscribeDialogAssoc->Dialog() ); |
|
52 } |
|
53 else |
|
54 { |
|
55 inviteDialogAssoc = GetInviteDialogAssocL(); |
|
56 } |
|
57 |
|
58 // Extract both headers (that are still left) and content. |
|
59 CSIPMessageElements* elements = ExtractHeadersAndContentLC(); |
|
60 |
|
61 // -- Execution ----------------------------------------------------------- |
|
62 |
|
63 // Start SIP Invite transaction. |
|
64 CSIPClientTransaction* transaction = inviteDialogAssoc->SendInviteL( elements ); |
|
65 CleanupStack::Pop( elements ); |
|
66 |
|
67 // -- Response creation --------------------------------------------------- |
|
68 |
|
69 AddIdResponseL( KTransactionId, transaction ); |
|
70 // If subscribeDialogAssoc is valid, inviteDialogAssoc ptr is in CleanupStack |
|
71 if( subscribeDialogAssoc ) |
|
72 { |
|
73 CleanupStack::Pop( inviteDialogAssoc ); |
|
74 } |
|
75 AddIdResponseL( KInviteDialogId, inviteDialogAssoc ); |
|
76 } |
|
77 |
|
78 TBool TCmdSendInviteWithinDialog::Match( const TTcIdentifier& aId ) |
|
79 { |
|
80 return TTcSIPCommandBase::Match( aId, _L8("SendInviteWithinDialog") ); |
|
81 } |
|
82 |
|
83 TTcCommandBase* TCmdSendInviteWithinDialog::CreateL( MTcTestContext& aContext ) |
|
84 { |
|
85 return new( ELeave ) TCmdSendInviteWithinDialog( aContext ); |
|
86 } |
|
87 |