28
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-2008 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: Class representing the SVP MO session
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef SVPMOSESSION_H
|
|
21 |
#define SVPMOSESSION_H
|
|
22 |
|
|
23 |
#include <sipprofileregistryobserver.h>
|
|
24 |
#include <sipconnectionobserver.h>
|
|
25 |
#include <sipobserver.h>
|
|
26 |
|
|
27 |
#include <sip.h>
|
|
28 |
#include <sipprofile.h>
|
|
29 |
#include <sipprofileregistry.h>
|
|
30 |
|
|
31 |
#include <mcemanager.h>
|
|
32 |
|
|
33 |
#include "svpsessionbase.h"
|
|
34 |
#include "svpconsts.h"
|
|
35 |
#include "svputdefs.h"
|
|
36 |
|
|
37 |
|
|
38 |
class CRCSEProfileEntry;
|
|
39 |
class CSVPForwardProvider;
|
|
40 |
class CDesC8Array;
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Representation of SVP Mo session
|
|
44 |
*
|
|
45 |
* Inlcudes all the methods needed to establish SVP MO session.
|
|
46 |
*
|
|
47 |
* @lib svpcontroller.lib
|
|
48 |
* @since S60 3.2
|
|
49 |
*/
|
|
50 |
class CSVPMoSession : public CSVPSessionBase,
|
|
51 |
public MSIPObserver,
|
|
52 |
public MSIPProfileRegistryObserver
|
|
53 |
{
|
|
54 |
|
|
55 |
public:
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Two-phased constructor.
|
|
59 |
*/
|
|
60 |
static CSVPMoSession* NewL(
|
|
61 |
CMceManager& aMceManager,
|
|
62 |
const TDesC8& aRecipient,
|
|
63 |
CRCSEProfileEntry& aVoipProfile,
|
|
64 |
const CCCPCallParameters& aParameters,
|
|
65 |
TMceTransactionDataContainer& aContainer,
|
|
66 |
MSVPSessionObserver& aObserver,
|
|
67 |
CSVPUtility& aSVPUtility,
|
|
68 |
CSVPRtpObserver& aRtpObserver,
|
|
69 |
TUint32& aSecurityStatus,
|
|
70 |
CDesC8Array* aUserHeaders = 0 );
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Destructor.
|
|
74 |
*/
|
|
75 |
virtual ~CSVPMoSession();
|
|
76 |
|
|
77 |
|
|
78 |
public: // methdos from MCCPCall
|
|
79 |
|
|
80 |
/**
|
|
81 |
* From MCCPMoSession. Starts dialing to recipient
|
|
82 |
* @since Series 60 3.2
|
|
83 |
* @return
|
|
84 |
*/
|
|
85 |
TInt Dial();
|
|
86 |
|
|
87 |
/**
|
|
88 |
* From MCCPMoSession. Cancels (dial) request
|
|
89 |
* @since Series 60 3.2
|
|
90 |
* @return
|
|
91 |
*/
|
|
92 |
TInt Cancel();
|
|
93 |
|
|
94 |
/**
|
|
95 |
* From MCCPCall Ends an ongoing call.
|
|
96 |
* @since Series 60 3.2
|
|
97 |
* @return
|
|
98 |
*/
|
|
99 |
TInt HangUp();
|
|
100 |
|
|
101 |
/**
|
|
102 |
* From MCCPMoSession. Destructs session
|
|
103 |
* @since Series 60 3.2
|
|
104 |
* @return
|
|
105 |
*/
|
|
106 |
TInt Release();
|
|
107 |
|
|
108 |
/**
|
|
109 |
* From MCCPCall Get Forward provider
|
|
110 |
* @since Series 60 3.2
|
|
111 |
* @return Pointer to MCCPForwardProvider if succesfull, NULL if not available
|
|
112 |
*/
|
|
113 |
MCCPForwardProvider* ForwardProviderL( const MCCPForwardObserver& aObserver );
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Puts the specified session on hold.
|
|
117 |
* @since Series60 3.2
|
|
118 |
* @return
|
|
119 |
*/
|
|
120 |
TInt Hold();
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Resumes held session.
|
|
124 |
* @since Series60 3.2
|
|
125 |
* @return
|
|
126 |
*/
|
|
127 |
TInt Resume();
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Handles remote action after session is established.
|
|
131 |
* @since Series60 3.2
|
|
132 |
* @param None
|
|
133 |
* @return
|
|
134 |
*/
|
|
135 |
TInt IncomingRequest( CMceInSession* aUpdatedSession );
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Returns boolean value, is the session mobile originated.
|
|
139 |
* @since Series60 3.2
|
|
140 |
* @param None
|
|
141 |
* @return TBool ETrue if mobile originated, otherwise EFalse
|
|
142 |
*/
|
|
143 |
TBool IsMobileOriginated() const;
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
public: // methods from MSIPObserver
|
|
148 |
|
|
149 |
/**
|
|
150 |
* From MSIPObserver A SIP request has been received from the network.
|
|
151 |
* @since Series 60 3.0
|
|
152 |
* @param aIapId The IapId from which the SIP request was received.
|
|
153 |
* @param aTransaction Contains local address, remote address of a sip
|
|
154 |
* message, as well as optional SIP message method, headers and
|
|
155 |
* body. The ownership is transferred.
|
|
156 |
* @return None
|
|
157 |
*/
|
|
158 |
void IncomingRequest( TUint32 aIapId,
|
|
159 |
CSIPServerTransaction* aTransaction );
|
|
160 |
|
|
161 |
/**
|
|
162 |
* From MSIPObserver The received SIP request time-outed and it has been
|
|
163 |
* destroyed.
|
|
164 |
* @since Series 60 3.0
|
|
165 |
* @param aSIPServerTransaction The time-outed transaction. Ownership is
|
|
166 |
* not transferred.
|
|
167 |
* @return None
|
|
168 |
*/
|
|
169 |
void TimedOut( CSIPServerTransaction& aSIPServerTransaction );
|
|
170 |
|
|
171 |
public: // methods from MSIPProfileRegistryObserver
|
|
172 |
|
|
173 |
/**
|
|
174 |
* From MSIPProfileRegistryObserver An asynchronous error has occurred
|
|
175 |
* related to SIP profile Event is send to those observers, who have the
|
|
176 |
* corresponding profile instantiated.
|
|
177 |
* @since Series 60 3.0
|
|
178 |
* @param aSIPProfileId SIP Profile ID.
|
|
179 |
* @param aError Error code.
|
|
180 |
* @return None
|
|
181 |
*/
|
|
182 |
void ProfileRegistryErrorOccurred( TUint32 aSIPProfileId,
|
|
183 |
TInt aError );
|
|
184 |
|
|
185 |
/**
|
|
186 |
* From MSIPProfileRegistryObserver An event related to SIP Profile has
|
|
187 |
* occurred.
|
|
188 |
* @since Series 60 3.0
|
|
189 |
* @param aProfileId SIP Profile ID.
|
|
190 |
* @param aEvent An occurred event.
|
|
191 |
* @return None
|
|
192 |
*/
|
|
193 |
void ProfileRegistryEventOccurred( TUint32 aProfileId,
|
|
194 |
TEvent aEvent );
|
|
195 |
|
|
196 |
public: // new public methods
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Method for creating normal Mo session if secure sessio
|
|
200 |
* creation has failed
|
|
201 |
* @since Series 60 3.2
|
|
202 |
* @param aMceManager Mce Manager.
|
|
203 |
*/
|
|
204 |
void CreateNonSecureSessionL( CMceManager& aMceManager );
|
|
205 |
|
|
206 |
/**
|
|
207 |
* Returns pointer to array containing addresses to forward the call to.
|
|
208 |
* Index zero contains the first address. If there are no addresses available
|
|
209 |
* returns an empty array.
|
|
210 |
* @since Series 60 3.2
|
|
211 |
* @param none
|
|
212 |
* @return Reference to array containing addresses
|
|
213 |
* @leave KErrNotReady call is not in forwarding state
|
|
214 |
* @leave KErrNotAllowed if call is not mobile originated
|
|
215 |
* @leave system error code
|
|
216 |
* @pre Call state is MCCPCallObserver::ECCPStateForwarding and call type is MO
|
|
217 |
* @pre Call MCCPForwardObserver::ECCPMultipleChoices event is received
|
|
218 |
*/
|
|
219 |
const CDesC8Array& GetForwardAddressChoicesL();
|
|
220 |
|
|
221 |
/**
|
|
222 |
* Forward call to address at given index.
|
|
223 |
* @since Series 60 3.2
|
|
224 |
* @param aIndex Index of address where the call is to be forwarded. Address is
|
|
225 |
* found in the array received from GetForwardAddressChoicesL. Index starts from zero.
|
|
226 |
* @return none
|
|
227 |
* @leave KErrArgument Index is not in array
|
|
228 |
* @leave KErrNotReady Call is not in forwarding state
|
|
229 |
* @leave KErrNotAllowed If call is not mobile originated
|
|
230 |
* @pre Call state is MCCPCallObserver::ECCPStateForwarding and call type is MO
|
|
231 |
* @pre Call MCCPForwardObserver::ECCPMultipleChoices event is received
|
|
232 |
*/
|
|
233 |
void ForwardToAddressL( const TInt aIndex );
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Add an observer for forward related events.
|
|
237 |
* Currently CCE will set only one observer.
|
|
238 |
* @since S60 v3.2
|
|
239 |
* @param aObserver Observer
|
|
240 |
* @return none
|
|
241 |
* @leave system error if observer adding fails
|
|
242 |
*/
|
|
243 |
void AddForwardObserverL( const MCCPForwardObserver& aObserver );
|
|
244 |
|
|
245 |
/**
|
|
246 |
* Remove an observer.
|
|
247 |
* @since S60 v3.2
|
|
248 |
* @param none
|
|
249 |
* @param aObserver Observer
|
|
250 |
* @return KErrNone if removed succesfully.
|
|
251 |
* @return KErrNotFound if observer was not found.
|
|
252 |
*/
|
|
253 |
TInt RemoveForwardObserver( const MCCPForwardObserver& aObserver );
|
|
254 |
|
|
255 |
/**
|
|
256 |
* Notify forwardobserver about forward event.
|
|
257 |
* @since S60 3.2
|
|
258 |
* @param aEventCode eventcode
|
|
259 |
* @return none
|
|
260 |
*/
|
|
261 |
void NotifyForwardEvent( TInt aEventCode );
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Add forward address for this session
|
|
265 |
* @since S60 3.2
|
|
266 |
* @param aFwdAddress
|
|
267 |
* @return Count of addresses, otherwise system wide error code
|
|
268 |
* @leave system error if address adding fails
|
|
269 |
*/
|
|
270 |
TInt AddForwardAddressL( const TDesC8& aFwdAddress );
|
|
271 |
|
|
272 |
/**
|
|
273 |
* Reset address list
|
|
274 |
* @since S60 3.2
|
|
275 |
* @return None
|
|
276 |
*/
|
|
277 |
void ResetForwardAddressChoices();
|
|
278 |
|
|
279 |
private: // new private methods
|
|
280 |
|
|
281 |
/**
|
|
282 |
* Method for completing sip uri
|
|
283 |
* @since Series 60 3.2
|
|
284 |
* @param aRecipient Recipient received from application
|
|
285 |
* @param aRecipient SIP profile which is making the call
|
|
286 |
* @param aSecurityStatus security preference
|
|
287 |
* @param aUserEqualsPhoneRequired defines user=phone parameter
|
|
288 |
* @return HBufC8* constructed uri
|
|
289 |
*/
|
|
290 |
HBufC8* CompleteUriL( const TDesC8& aRecipient,
|
|
291 |
const CSIPProfile& aSipProfile,
|
|
292 |
const TUint32& aSecurityStatus,
|
|
293 |
TBool aUserEqualsPhoneRequired );
|
|
294 |
|
|
295 |
/**
|
|
296 |
* Dial method that leave
|
|
297 |
* @since Series 60 3.2
|
|
298 |
*/
|
|
299 |
void DialL();
|
|
300 |
|
|
301 |
|
|
302 |
protected:
|
|
303 |
|
|
304 |
/**
|
|
305 |
* C++ default constructor.
|
|
306 |
*/
|
|
307 |
CSVPMoSession( TUint32 aSessionExpires,
|
|
308 |
TMceTransactionDataContainer& aContainer,
|
|
309 |
MSVPSessionObserver& aObserver,
|
|
310 |
CSVPUtility& aSVPUtility,
|
|
311 |
CSVPRtpObserver& aRtpObserver );
|
|
312 |
|
|
313 |
/**
|
|
314 |
* Worker function for session state change, called from
|
|
315 |
* SessionStateChanged().
|
|
316 |
* @since S60 v3.2
|
|
317 |
* @param aOrigStatus Original status code
|
|
318 |
* @param aError Mapped TCCPError
|
|
319 |
* @param aModStatus Modified status code
|
|
320 |
* @return void
|
|
321 |
*/
|
|
322 |
virtual void SessionStateChangedL( TInt aOrigCode, TCCPError aError,
|
|
323 |
TInt aModStatus );
|
|
324 |
|
|
325 |
|
|
326 |
private:
|
|
327 |
|
|
328 |
/**
|
|
329 |
* second-phase constructor
|
|
330 |
*/
|
|
331 |
void ConstructL( CMceManager& aMceManager,
|
|
332 |
CRCSEProfileEntry& aVoipProfile,
|
|
333 |
const CCCPCallParameters& aParameters,
|
|
334 |
const TDesC8& aRecipient,
|
|
335 |
TUint32& aSecurityStatus,
|
|
336 |
CDesC8Array* aUserHeaders );
|
|
337 |
|
|
338 |
private: // data
|
|
339 |
|
|
340 |
/**
|
|
341 |
* Session Expires value
|
|
342 |
*/
|
|
343 |
TUint32 iSessionExpires;
|
|
344 |
|
|
345 |
/**
|
|
346 |
* User header array
|
|
347 |
*/
|
|
348 |
CDesC8Array* iUserHeaders;
|
|
349 |
|
|
350 |
/**
|
|
351 |
* Forward observer
|
|
352 |
* Not own.
|
|
353 |
*/
|
|
354 |
MCCPForwardObserver* iForwardObserver;
|
|
355 |
|
|
356 |
/**
|
|
357 |
* Forward provider
|
|
358 |
* Own.
|
|
359 |
*/
|
|
360 |
CSVPForwardProvider* iForwardProvider;
|
|
361 |
|
|
362 |
/**
|
|
363 |
* Recipient address, needed for secure preferred -secure call setting
|
|
364 |
*/
|
|
365 |
TBuf8< KSVPMaxUriLength > iSecondCallRecipient;
|
|
366 |
|
|
367 |
/**
|
|
368 |
* List for forward addresses
|
|
369 |
*/
|
|
370 |
CDesC8Array* iForwardAddressList;
|
|
371 |
|
|
372 |
/**
|
|
373 |
* Pointer to Mce manager
|
|
374 |
* Not own
|
|
375 |
*/
|
|
376 |
CMceManager* iMceManager;
|
|
377 |
|
|
378 |
private:
|
|
379 |
|
|
380 |
// For testing
|
|
381 |
SVP_UT_DEFS
|
|
382 |
|
|
383 |
};
|
|
384 |
|
|
385 |
#endif // SVPMOSESSION_H
|