|
1 /* |
|
2 * Copyright (c) 2006 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: Transfer controller class for blind and attended transfers |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef SVPTRANSFERCONTROLLER_H |
|
21 #define SVPTRANSFERCONTROLLER_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <mccpcall.h> // MCCPCall |
|
25 #include <mccptransferprovider.h> // MCCPTransferProvider |
|
26 #include <mccptransferobserver.h> // MCCPTransferObserver |
|
27 #include "svputdefs.h" |
|
28 |
|
29 class CSVPController; |
|
30 class CSVPSessionBase; |
|
31 class CMceSession; |
|
32 class TMceTransactionDataContainer; |
|
33 class CMceRefer; |
|
34 class CMceInRefer; |
|
35 class CMceEvent; |
|
36 class CSVPTransferStateContext; |
|
37 class MSVPTransferObserver; |
|
38 |
|
39 /** |
|
40 * Transfer controller |
|
41 * |
|
42 * Handles blind and attended transfers |
|
43 * |
|
44 * @lib svp.dll |
|
45 * @since S60 3.2 |
|
46 */ |
|
47 class CSVPTransferController : public CBase, |
|
48 public MCCPTransferProvider |
|
49 { |
|
50 |
|
51 public: // New methods |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 */ |
|
56 static CSVPTransferController* NewL( |
|
57 CMceSession* aMceSession, |
|
58 CSVPSessionBase* aSVPSession, |
|
59 TMceTransactionDataContainer& aContainer, |
|
60 MSVPTransferObserver& aObserver ); |
|
61 |
|
62 static CSVPTransferController* NewLC( |
|
63 CMceSession* aMceSession, |
|
64 CSVPSessionBase* aSVPSession, |
|
65 TMceTransactionDataContainer& aContainer, |
|
66 MSVPTransferObserver& aObserver ); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 virtual ~CSVPTransferController(); |
|
72 |
|
73 /** |
|
74 * Handle mce event state changes. |
|
75 * The state of the event has changed. |
|
76 * @since S60 3.2 |
|
77 * @param aEvent, event which state changed. |
|
78 * @param aStatusCode, status code. |
|
79 */ |
|
80 void HandleEventStateChangedL( CMceEvent& aEvent, |
|
81 TInt aStatusCode ); |
|
82 |
|
83 /** |
|
84 * Handle mce event observer notify events. |
|
85 * The state of the event has changed. |
|
86 * @since S60 3.2 |
|
87 * @param aEvent, event received notification. |
|
88 * @param aContainer, if present, holds details of |
|
89 * transaction causing state change. |
|
90 */ |
|
91 void NotifyReceivedL( CMceEvent& aEvent, |
|
92 TMceTransactionDataContainer* aContainer ); |
|
93 |
|
94 /** |
|
95 * Handle the refer state change events. |
|
96 * @since S60 3.2 |
|
97 * @param aRefer, the refer that has changed. |
|
98 * @param aStatusCode, status code |
|
99 */ |
|
100 void HandleReferStateChangeL( CMceRefer& aRefer, |
|
101 TInt aStatusCode ); |
|
102 |
|
103 /** |
|
104 * New incoming refer received. |
|
105 * @since S60 3.2 |
|
106 * @param aRefer, the new inbound refer. Ownership is |
|
107 * transferred. |
|
108 * @param aReferTo SIP specific Refer-to header |
|
109 */ |
|
110 void IncomingReferL( CMceInRefer* aRefer, |
|
111 const TDesC8& aReferTo, |
|
112 TMceTransactionDataContainer* aContainer ); |
|
113 |
|
114 |
|
115 /** |
|
116 * Checks the MCE refer object. |
|
117 * @since S60 3.2 |
|
118 * @param aRefer - refer to check |
|
119 * @return TBool true if same MCE refer object |
|
120 */ |
|
121 TBool IsMceRefer( CMceRefer& aRefer ); |
|
122 |
|
123 /** |
|
124 * Checks if transfer is attended or unattended. |
|
125 * @since S60 3.2 |
|
126 * @return TBool true if attended case |
|
127 */ |
|
128 TBool IsAttended( ); |
|
129 |
|
130 /** |
|
131 * Set transfer data. Add Replaces and Referred-By headers. |
|
132 * Update transfer target url to sips: if secure status 1 or 2, |
|
133 * otherwise url updated to sip: |
|
134 * @since S60 3.2 |
|
135 * @param aUserAgentHeaders On completion contains collected transfer headers. |
|
136 * @param aSecureStatus secure status |
|
137 */ |
|
138 void SetTransferDataL( CDesC8Array* aUserAgentHeaders, TInt aSecureStatus ); |
|
139 |
|
140 /** |
|
141 * Sets the reference to the sip (mce) session object |
|
142 * @since S60 3.2 |
|
143 * @param aSession The session object |
|
144 * @return None |
|
145 */ |
|
146 void SetMceSessionObject( CMceSession* aSession ); |
|
147 |
|
148 /** |
|
149 * Send notify using the MCE event object |
|
150 * @since S60 3.2 |
|
151 * @param aStatusCode code came from mce |
|
152 */ |
|
153 void SendNotifyL( TInt aStatusCode ); |
|
154 |
|
155 /** |
|
156 * Check if ingoming transfer is ongoing |
|
157 * @since S60 3.2 |
|
158 * @return TBool true if incoming transfer case |
|
159 */ |
|
160 TBool IsIncomingTransfer(); |
|
161 |
|
162 /** |
|
163 * Terminate transfer due refer timer timeout |
|
164 * @since S60 3.2 |
|
165 */ |
|
166 void TerminateTransfer(); |
|
167 |
|
168 /** |
|
169 * The Leaving version of TerminateTransfer |
|
170 * @since S60 3.2 |
|
171 */ |
|
172 void TerminateTransferL(); |
|
173 |
|
174 public: // From MCCPTransferProvider |
|
175 |
|
176 /** |
|
177 * Attended transfer to given call recipient. |
|
178 * There exist a call between A-B and A-C. A wants to transfer the call to B-C. |
|
179 * A itself will not be inline in case the transfer is made succesfully. |
|
180 * In above case C will be the aTransferTargetCall. B is the recipient of the |
|
181 * current call between A-B - called on A's call object transfer provider. |
|
182 * The A-B call is on hold. |
|
183 * @since S60 3.2 |
|
184 * @param aTransferTargetCall - target receiver of the transferred call. |
|
185 * In this case there exist a call |
|
186 * @return In case of an immediate error returns system error code, |
|
187 * if request has been started returns KErrNone. |
|
188 */ |
|
189 TInt AttendedTransfer( MCCPCall& aTransferTargetCall ); |
|
190 |
|
191 /** |
|
192 * Attended transfer to given address. There does not need to be |
|
193 * a current call between the given transfer target. |
|
194 * @since S60 3.2 |
|
195 * @param aTransferTarget - transfer target address |
|
196 * @return In case of an immediate error returns system error code, |
|
197 * if request has been started returns KErrNone. |
|
198 */ |
|
199 TInt AttendedTransfer( const TDesC& aTransferTarget ); |
|
200 |
|
201 /** |
|
202 * Unattended transfer. Call is requested to be transferred to given address. |
|
203 * @since S60 3.2 |
|
204 * @param aTarget Address of the target |
|
205 * @return In case of an immediate error returns system error code, |
|
206 * if request has been started returns KErrNone. |
|
207 */ |
|
208 TInt UnattendedTransfer( const TDesC& aTransferTarget ); |
|
209 |
|
210 /** |
|
211 * Notifies call about transfer status. |
|
212 * @since S60 3.2 |
|
213 * @param aAccept Boolean value is transfer accepted or not. |
|
214 * @return In case of an immediate error returns system error code, |
|
215 * if request has been started returns KErrNone. |
|
216 */ |
|
217 TInt AcceptTransfer( const TBool aAccept ); |
|
218 |
|
219 /** |
|
220 * When the other end of the call has requested call transfer to third party it is notified to |
|
221 * CCPCallCall::EventOccurred(ECCPRemoteTransferring). |
|
222 * The new recipient of the call can be fetched via this method. |
|
223 * @since S60 3.2 |
|
224 * @param none |
|
225 * @return New recipient for the call after transfer |
|
226 */ |
|
227 const TDesC& TransferTarget() const; |
|
228 |
|
229 /** |
|
230 * Add an observer for transfer related events. |
|
231 * Plug-in dependent feature if duplicates or more than one observers |
|
232 * are allowed or not. Currently CCE will set only one observer. |
|
233 * @since S60 v3.2 |
|
234 * @param aObserver Observer |
|
235 * @return none |
|
236 * @leave system error if observer adding fails |
|
237 */ |
|
238 void AddObserverL( const MCCPTransferObserver& aObserver ); |
|
239 |
|
240 /** |
|
241 * Remove an observer. |
|
242 * @since S60 v3.2 |
|
243 * @param aObserver Observer |
|
244 * @return KErrNone if removed succesfully. KErrNotFound if observer was not found. |
|
245 */ |
|
246 TInt RemoveObserver( const MCCPTransferObserver& aObserver ); |
|
247 |
|
248 |
|
249 private: |
|
250 |
|
251 /** |
|
252 * C++ default constructor. |
|
253 */ |
|
254 CSVPTransferController(); |
|
255 |
|
256 /** |
|
257 * Second-phase constructor. |
|
258 */ |
|
259 void ConstructL( CMceSession* aMceSession, |
|
260 CSVPSessionBase* aSVPSession, |
|
261 TMceTransactionDataContainer& aContainer, |
|
262 MSVPTransferObserver& aObserver ); |
|
263 |
|
264 /** |
|
265 * Private transfer functionality. |
|
266 * @since S60 3.2 |
|
267 * @param aAccept Boolean value is transfer accepted or not. |
|
268 */ |
|
269 void TransferL( MCCPCall* aCall, |
|
270 const TDesC& aTarget, |
|
271 const TBool aAttendedTransfer ); |
|
272 |
|
273 |
|
274 private: // data |
|
275 |
|
276 /** |
|
277 * Transfer state context. |
|
278 * Own. |
|
279 */ |
|
280 CSVPTransferStateContext* iTransferContext; |
|
281 |
|
282 /** |
|
283 * Transfer observer |
|
284 */ |
|
285 MCCPTransferObserver* iCCPTransferObserver; |
|
286 |
|
287 /** |
|
288 * 202 Accepted to the refer received, waiting still the notify |
|
289 */ |
|
290 TBool iAccepted; |
|
291 |
|
292 |
|
293 private: |
|
294 |
|
295 // For testing |
|
296 SVP_UT_DEFS |
|
297 |
|
298 }; |
|
299 |
|
300 #endif // CSVPTRANSFERCONTROLLER_H |