22
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2010 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: Receives and stores VoIP settings.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <e32base.h>
|
|
21 |
#include <CWPAdapter.h>
|
|
22 |
#include <CWPCharacteristic.h>
|
|
23 |
#include <CWPParameter.h>
|
|
24 |
#include <wpvoipadapter.rsg>
|
|
25 |
#include <WPAdapterUtil.h> // Adapter utils
|
|
26 |
#include <s32mem.h> // RDesWriteStream
|
|
27 |
#include <s32strm.h>
|
|
28 |
#include <e32des8.h>
|
|
29 |
#include <utf.h> // Unicode conversion
|
|
30 |
#include <featmgr.h>
|
|
31 |
#include <cmmanagerext.h>
|
|
32 |
#include <cmdestinationext.h>
|
|
33 |
#include <cmconnectionmethoddef.h>
|
|
34 |
#include <crcseprofileentry.h>
|
|
35 |
#include <crcseprofileregistry.h>
|
|
36 |
#include <crcseaudiocodecentry.h>
|
|
37 |
#include <crcseaudiocodecregistry.h>
|
|
38 |
#include <mmf/common/mmfcontrollerpluginresolver.h>
|
|
39 |
|
|
40 |
#include "CWPVoIPAdapter.h"
|
|
41 |
#include "CWPVoIPItem.h"
|
|
42 |
|
|
43 |
// The following four includes are because of SIP User Agent Header.
|
|
44 |
#include "CSIPProfileRegistryObserver.h"
|
|
45 |
#include <sipmanagedprofile.h>
|
|
46 |
#include <sipprofileregistryobserver.h>
|
|
47 |
#include <sipmanagedprofileregistry.h>
|
|
48 |
|
|
49 |
// LOCAL CONSTANTS
|
|
50 |
// Application related constants
|
|
51 |
_LIT( KVoIPAdapterName, "WPVoIPAdapter");
|
|
52 |
_LIT( KVoIPAppID, "w9013" ); // OMA CP registration document for VoIP
|
|
53 |
_LIT8( KVoIPAppID8, "w9013" ); // OMA CP registration document for VoIP
|
|
54 |
_LIT8( KSIPAppID8, "w9010" ); // OMA CP registration document for SIP
|
|
55 |
_LIT8( KSCCPAppID8, "w9018" ); // OMA CP registration document for SCCP
|
|
56 |
_LIT8( KNATFWAppID8, "w902E" ); // OMA CP registration document for NATFW
|
|
57 |
_LIT8( KPresenceAppId8, "ap0002" ); // OMA CP registration document for
|
|
58 |
// SIMPLE Presence
|
|
59 |
_LIT8( KSNAPAppID8, "w904C" ); // OMA CP registration document for
|
|
60 |
// Destination Networks
|
|
61 |
// Characterictic clear text names.
|
|
62 |
_LIT( KCODEC16, "CODEC" );
|
|
63 |
_LIT( KVOIPURIS16, "VOIPURIS" );
|
|
64 |
|
|
65 |
// VoIP profile parameters.
|
|
66 |
// OMA CP registration document for VoIP, w9013.txt.
|
|
67 |
_LIT( KParmSMPORT, "SMPORT" );
|
|
68 |
_LIT( KParmEMPORT, "EMPORT" );
|
|
69 |
_LIT( KParmMEDIAQOS, "MEDIAQOS" );
|
|
70 |
_LIT( KParmNODTMFIB, "NODTMFIB" );
|
|
71 |
_LIT( KParmNODTMFOOB, "NODTMFOOB" );
|
|
72 |
_LIT( KParmSECURECALLPREF, "SECURECALLPREF" );
|
|
73 |
_LIT( KParmRTCP, "RTCP" );
|
|
74 |
_LIT( KParmUAHTERMINALTYPE, "UAHTERMINALTYPE" );
|
|
75 |
_LIT( KParmUAHWLANMAC, "UAHWLANMAC" );
|
|
76 |
_LIT( KParmUAHSTRING, "UAHSTRING" );
|
|
77 |
_LIT( KParmPROFILELOCKEDTOIAP, "PROFILELOCKEDTOIAP" );
|
|
78 |
_LIT( KParmVOIPPLUGINUID, "VOIPPLUGINUID" );
|
|
79 |
_LIT( KParmALLOWVOIPOVERWCDMA, "ALLOWVOIPOVERWCDMA" );
|
|
80 |
_LIT( KParmVOIPDIGITS, "VOIPDIGITS" );
|
|
81 |
_LIT( KParmIGNDOMPART, "IGNDOMPART" );
|
|
82 |
_LIT( KParmAABUDDYREQUEST, "AABUDDYREQUEST" );
|
|
83 |
_LIT( KParmADDUSERPHONE, "ADDUSERPHONE" );
|
|
84 |
_LIT( KParmSIPCONNTESTURI, "SIPCONNTESTURI" );
|
|
85 |
_LIT( KParmPROVIDERURI, "PROVIDERURI" );
|
|
86 |
_LIT( KParmMINSE, "MINSE" );
|
|
87 |
_LIT( KParmSESSIONEXP, "SESSIONEXP" );
|
|
88 |
_LIT( KParmBRANDINGURI, "BRANDINGURI" );
|
|
89 |
_LIT( KParmNATPROTOCOL, "NATPROTOCOL" );
|
|
90 |
_LIT( KParmAUTOENABLE, "AUTOENABLE" );
|
|
91 |
_LIT( KParmIMENABLED, "IMENABLED" );
|
|
92 |
|
|
93 |
// RESOURCE parameters.
|
|
94 |
// OMA CP registration document for VoIP, w9013.txt.
|
|
95 |
// RESOURCETYPE indicates if the following parameters are for a codec, SIP
|
|
96 |
// specific (URIs), Handover or VoIP Presence settings.
|
|
97 |
_LIT( KParmMEDIASUBTYPE, "MEDIASUBTYPE" );// Codec.
|
|
98 |
_LIT( KParmPRIORITYINDEX, "PRIORITYINDEX" );// Codec.
|
|
99 |
_LIT( KParmJITTERBUFFERSIZE, "JITTERBUFFERSIZE" );// Codec.
|
|
100 |
_LIT( KParmOCTETALIGN, "OCTET-ALIGN" );// Codec.
|
|
101 |
_LIT( KParmMODESET, "MODE-SET" );// Codec.
|
|
102 |
_LIT( KParmMODECHANGEPERIOD, "MODE-CHANGE-PERIOD" );// Codec.
|
|
103 |
_LIT( KParmMODECHANGENEIGHBOR, "MODE-CHANGE-NEIGHBOR" );// Codec.
|
|
104 |
_LIT( KParmPTIME, "PTIME" );// Codec.
|
|
105 |
_LIT( KParmMAXPTIME, "MAXPTIME" );// Codec.
|
|
106 |
_LIT( KParmVAD, "VAD" );// Codec.
|
|
107 |
_LIT( KParmANNEXB, "ANNEXB" );// Codec.
|
|
108 |
_LIT( KParmMAXRED, "MAXRED" );// Codec.
|
|
109 |
_LIT( KParmIPVOICEMAILBOXURI, "IPVOICEMAILBOXURI" );// VMBX.
|
|
110 |
_LIT( KParmVMBXLISTENURI, "VMBXLISTENURI" );// VMBX.
|
|
111 |
_LIT( KParmRESUBSCRIBE, "RESUBSCRIBE" );// VMBX.
|
|
112 |
|
|
113 |
// For other purposes.
|
|
114 |
_LIT8( KHexPrefix, "0x" ); // For parsing PLUGINUID.
|
|
115 |
const TUint KTempStringlength( 200 ); // For SIP User-Agent Header.
|
|
116 |
const TInt KMaxCharsInTUint32( 10 );
|
|
117 |
const TInt KTen( 10 );
|
|
118 |
|
|
119 |
static const TInt32 KNotSaved( -1 );
|
|
120 |
|
|
121 |
// Following lines are for enabling debug prints.
|
|
122 |
#ifdef _DEBUG
|
|
123 |
#define DBG_PRINT(p) RDebug::Print(_L(p))
|
|
124 |
#define DBG_PRINT2(p,a) RDebug::Print(_L(p),a)
|
|
125 |
#else
|
|
126 |
#define DBG_PRINT(p)
|
|
127 |
#define DBG_PRINT2(p,a)
|
|
128 |
#endif // _DEBUG
|
|
129 |
|
|
130 |
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
// CWPVoIPAdapter::CWPVoIPAdapter
|
|
133 |
// ---------------------------------------------------------------------------
|
|
134 |
//
|
|
135 |
CWPVoIPAdapter::CWPVoIPAdapter() : CWPAdapter()
|
|
136 |
{
|
|
137 |
}
|
|
138 |
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
// CWPVoIPAdapter::ConstructL
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
//
|
|
143 |
void CWPVoIPAdapter::ConstructL()
|
|
144 |
{
|
|
145 |
DBG_PRINT( "CWPVoIPAdapter::ConstructL - begin" );
|
|
146 |
TFileName fileName;
|
|
147 |
Dll::FileName( fileName );
|
|
148 |
iTitle = WPAdapterUtil::ReadHBufCL( fileName, KVoIPAdapterName,
|
|
149 |
R_QTN_SM_HEAD_VOIP );
|
|
150 |
iUids = HBufC8::NewL( 0 );
|
|
151 |
iCurrentVoIPItem = NULL;
|
|
152 |
|
|
153 |
FeatureManager::InitializeLibL();
|
|
154 |
iFeatMgrInitialized = ETrue;
|
|
155 |
|
|
156 |
DBG_PRINT( "CWVoIPAdapter::ConstructL - Checking VoIP support." );
|
|
157 |
if ( !FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
|
|
158 |
{
|
|
159 |
DBG_PRINT( "CWVoIPAdapter::ConstructL - VoIP not supported; leave." );
|
|
160 |
User::Leave( KErrNotSupported );
|
|
161 |
}
|
|
162 |
DBG_PRINT( "CWPVoIPAdapter::ConstructL - end" );
|
|
163 |
}
|
|
164 |
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
// CWPVoIPAdapter::NewL
|
|
167 |
// ---------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
CWPVoIPAdapter* CWPVoIPAdapter::NewL()
|
|
170 |
{
|
|
171 |
DBG_PRINT( "CWPVoIPAdapter::NewL - begin" );
|
|
172 |
CWPVoIPAdapter* self = new (ELeave) CWPVoIPAdapter;
|
|
173 |
CleanupStack::PushL( self );
|
|
174 |
self->ConstructL();
|
|
175 |
CleanupStack::Pop( self );
|
|
176 |
DBG_PRINT( "CWVoIPAdapter::NewL - end" );
|
|
177 |
return self;
|
|
178 |
}
|
|
179 |
|
|
180 |
// ---------------------------------------------------------------------------
|
|
181 |
// CWPVoIPAdapter::~CWPVoIPAdapter
|
|
182 |
// ---------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
CWPVoIPAdapter::~CWPVoIPAdapter()
|
|
185 |
{
|
|
186 |
DBG_PRINT( "CWVoIPAdapter::~CWPVoIPAdapter - begin" );
|
|
187 |
delete iTitle;
|
|
188 |
delete iUids;
|
|
189 |
iDatas.ResetAndDestroy();
|
|
190 |
iDatas.Close();
|
|
191 |
|
|
192 |
if ( iFeatMgrInitialized )
|
|
193 |
{
|
|
194 |
FeatureManager::UnInitializeLib();
|
|
195 |
}
|
|
196 |
|
|
197 |
DBG_PRINT( "CWVoIPAdapter::~CWPVoIPAdapter - end" );
|
|
198 |
//lint -e{1740} iCurrentCodec is deleted in another class
|
|
199 |
}
|
|
200 |
|
|
201 |
// ---------------------------------------------------------------------------
|
|
202 |
// CWPVoIPAdapter::ContextExtension
|
|
203 |
// ---------------------------------------------------------------------------
|
|
204 |
//
|
|
205 |
TInt CWPVoIPAdapter::ContextExtension( MWPContextExtension*& aExtension )
|
|
206 |
{
|
|
207 |
aExtension = this;
|
|
208 |
return KErrNone;
|
|
209 |
}
|
|
210 |
|
|
211 |
// ---------------------------------------------------------------------------
|
|
212 |
// CWPVoIPAdapter::SaveDataL
|
|
213 |
// ---------------------------------------------------------------------------
|
|
214 |
//
|
|
215 |
const TDesC8& CWPVoIPAdapter::SaveDataL( TInt aIndex ) const
|
|
216 |
{
|
|
217 |
return iDatas[aIndex]->SaveData();
|
|
218 |
}
|
|
219 |
|
|
220 |
// ---------------------------------------------------------------------------
|
|
221 |
// CWPVoIPAdapter::DeleteL
|
|
222 |
// ---------------------------------------------------------------------------
|
|
223 |
//
|
|
224 |
void CWPVoIPAdapter::DeleteL( const TDesC8& aSaveData )
|
|
225 |
{
|
|
226 |
DBG_PRINT( "CWVoIPAdapter::DeleteL - begin" );
|
|
227 |
TUint tId;
|
|
228 |
TLex8 lex( aSaveData );
|
|
229 |
TInt err( KErrNone );
|
|
230 |
err = lex.Val( tId );
|
|
231 |
if ( KErrNone == err )
|
|
232 |
{
|
|
233 |
CRCSEProfileRegistry* cRCSEProfileRegistry =
|
|
234 |
CRCSEProfileRegistry::NewLC();
|
|
235 |
cRCSEProfileRegistry->DeleteL( tId );
|
|
236 |
|
|
237 |
// set CS preferred if last VoIP profile deleted
|
|
238 |
RArray<TUint32> voipIds;
|
|
239 |
cRCSEProfileRegistry->GetAllIdsL( voipIds );
|
|
240 |
if ( KErrNone == voipIds.Count() )
|
|
241 |
{
|
|
242 |
CWPVoIPItem* cVoIPItem = CWPVoIPItem::NewL();
|
|
243 |
CleanupStack::PushL( cVoIPItem );
|
|
244 |
cVoIPItem->SetTelephonyPreferenceL( CWPVoIPItem::ECSPreferred );
|
|
245 |
CleanupStack::PopAndDestroy( cVoIPItem );
|
|
246 |
}
|
|
247 |
voipIds.Close();
|
|
248 |
CleanupStack::PopAndDestroy( cRCSEProfileRegistry );
|
|
249 |
}// if
|
|
250 |
DBG_PRINT( "CWVoIPAdapter::DeleteL - end" );
|
|
251 |
}
|
|
252 |
|
|
253 |
// ---------------------------------------------------------------------------
|
|
254 |
// CWPVoIPAdapter::Uid
|
|
255 |
// ---------------------------------------------------------------------------
|
|
256 |
//
|
|
257 |
TUint32 CWPVoIPAdapter::Uid() const
|
|
258 |
{
|
|
259 |
return iDtor_ID_Key.iUid;
|
|
260 |
}
|
|
261 |
|
|
262 |
// ---------------------------------------------------------------------------
|
|
263 |
// CWPVoIPAdapter::DetailsL
|
|
264 |
// ---------------------------------------------------------------------------
|
|
265 |
//
|
|
266 |
TInt CWPVoIPAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor */ )
|
|
267 |
{
|
|
268 |
return KErrNotSupported;
|
|
269 |
}
|
|
270 |
|
|
271 |
// ---------------------------------------------------------------------------
|
|
272 |
// CWPVoIPAdapter::SummaryCount
|
|
273 |
// ---------------------------------------------------------------------------
|
|
274 |
//
|
|
275 |
TInt CWPVoIPAdapter::ItemCount() const
|
|
276 |
{
|
|
277 |
return iDatas.Count();
|
|
278 |
}
|
|
279 |
|
|
280 |
// ---------------------------------------------------------------------------
|
|
281 |
// CWPVoIPAdapter::SummaryTitle
|
|
282 |
// ---------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
const TDesC16& CWPVoIPAdapter::SummaryTitle( TInt /*aIndex*/ ) const
|
|
285 |
{
|
|
286 |
return *iTitle;
|
|
287 |
}
|
|
288 |
|
|
289 |
// ---------------------------------------------------------------------------
|
|
290 |
// CWPVoIPAdapter::SummaryText
|
|
291 |
// ---------------------------------------------------------------------------
|
|
292 |
//
|
|
293 |
const TDesC16& CWPVoIPAdapter::SummaryText( TInt aIndex ) const
|
|
294 |
{
|
|
295 |
return iDatas[aIndex]->Name();
|
|
296 |
}
|
|
297 |
|
|
298 |
// ---------------------------------------------------------------------------
|
|
299 |
// CWPVoIPAdapter::SaveL
|
|
300 |
// ---------------------------------------------------------------------------
|
|
301 |
//
|
|
302 |
void CWPVoIPAdapter::SaveL( TInt aIndex )
|
|
303 |
{
|
|
304 |
DBG_PRINT( "CWVoIPAdapter::SaveL - begin" );
|
|
305 |
|
|
306 |
CWPVoIPItem* voipItem = iDatas[aIndex];
|
|
307 |
|
|
308 |
if ( voipItem->NapDef() && voipItem->NapDef()->Data().Length() <=
|
|
309 |
KMaxCharsInTUint32 )
|
|
310 |
{
|
|
311 |
// Get WAP ID.
|
|
312 |
TPckgBuf<TUint32> uid;
|
|
313 |
uid.Copy( voipItem->NapDef()->Data( 0 ) );
|
|
314 |
TUint32 wapId( uid() );
|
|
315 |
// Get corresponding IAP ID.
|
|
316 |
TUint32 iapId = IapIdFromWapIdL( wapId );
|
|
317 |
voipItem->SetIapId( iapId );
|
|
318 |
}
|
|
319 |
|
|
320 |
voipItem->StoreL();
|
|
321 |
voipItem = NULL;
|
|
322 |
DBG_PRINT( "CWVoIPAdapter::SaveL - end" );
|
|
323 |
}
|
|
324 |
|
|
325 |
// ---------------------------------------------------------------------------
|
|
326 |
// CWPVoIPAdapter::CanSetAsDefault
|
|
327 |
// ---------------------------------------------------------------------------
|
|
328 |
//
|
|
329 |
TBool CWPVoIPAdapter::CanSetAsDefault( TInt /*aIndex*/ ) const
|
|
330 |
{
|
|
331 |
return EFalse;
|
|
332 |
}
|
|
333 |
|
|
334 |
// ---------------------------------------------------------------------------
|
|
335 |
// CWPVoIPAdapter::SetAsDefaultL
|
|
336 |
// ---------------------------------------------------------------------------
|
|
337 |
//
|
|
338 |
void CWPVoIPAdapter::SetAsDefaultL( TInt /*aIndex*/ )
|
|
339 |
{
|
|
340 |
// From VoIP release 3.0 onwards VoIP profiles cannot be set as default
|
|
341 |
// => this mehod does nothing but is present because of inheritance.
|
|
342 |
}
|
|
343 |
|
|
344 |
// ---------------------------------------------------------------------------
|
|
345 |
// CWPVoIPAdapter::VisitL
|
|
346 |
// ---------------------------------------------------------------------------
|
|
347 |
//
|
|
348 |
void CWPVoIPAdapter::VisitL( CWPCharacteristic& aCharacteristic )
|
|
349 |
{
|
|
350 |
DBG_PRINT( "CWVoIPAdapter::VisitL( characteristic ) - begin" );
|
|
351 |
|
|
352 |
switch( aCharacteristic.Type() )
|
|
353 |
{
|
|
354 |
// Core VoIP settings.
|
|
355 |
case KWPApplication:
|
|
356 |
{
|
|
357 |
DBG_PRINT(
|
|
358 |
"CWVoIPAdapter::VisitL(characteristic) - case APPLICATION" );
|
|
359 |
iCurrentCharacteristic = KWPApplication;
|
|
360 |
iCurrentVoIPItem = CWPVoIPItem::NewL();
|
|
361 |
aCharacteristic.AcceptL( *this );
|
|
362 |
// If VoIP settings, append the item into iDatas array and leave
|
|
363 |
// iCurrentVoIPItem to point to it.
|
|
364 |
if ( iAppID == KVoIPAppID )
|
|
365 |
{
|
|
366 |
User::LeaveIfError( iDatas.Append( iCurrentVoIPItem ) );
|
|
367 |
}
|
|
368 |
else // else the settigs are no longer of type VoIP.
|
|
369 |
{
|
|
370 |
DBG_PRINT(
|
|
371 |
"CWVoIPAdapter::VisitL( characteristic ) - no VoIP." );
|
|
372 |
delete iCurrentVoIPItem;
|
|
373 |
iCurrentVoIPItem = NULL;
|
|
374 |
}
|
|
375 |
break;
|
|
376 |
}
|
|
377 |
// Codec and SIP profile specific settings.
|
|
378 |
case KWPNamedCharacteristic:
|
|
379 |
{
|
|
380 |
iCurrentCharacteristic = KWPNamedCharacteristic;
|
|
381 |
//lint -e{961} No need for else statement here
|
|
382 |
if ( aCharacteristic.Name().Compare( KCODEC16() ) == 0 )
|
|
383 |
{
|
|
384 |
DBG_PRINT(
|
|
385 |
"CWVoIPAdapter::VisitL( characteristic ) - case CODEC" );
|
|
386 |
iCurrentCodec = CWPVoIPCodec::NewL();
|
|
387 |
iSetCodec = ETrue;
|
|
388 |
aCharacteristic.AcceptL( *this );
|
|
389 |
iCurrentVoIPItem->AddCodecL( iCurrentCodec );
|
|
390 |
iSetCodec = EFalse;
|
|
391 |
}
|
|
392 |
else if ( aCharacteristic.Name().Compare( KVOIPURIS16() ) == 0 )
|
|
393 |
{
|
|
394 |
DBG_PRINT(
|
|
395 |
"CWVoIPAdapter::VisitL(characteristic) - case VOIPURIS" );
|
|
396 |
iSetVoipUris = ETrue;
|
|
397 |
aCharacteristic.AcceptL( *this );
|
|
398 |
iSetVoipUris = EFalse;
|
|
399 |
}
|
|
400 |
break;
|
|
401 |
}
|
|
402 |
default:
|
|
403 |
break;
|
|
404 |
}
|
|
405 |
DBG_PRINT( "CWVoIPAdapter::VisitL( characteristic ) - end" );
|
|
406 |
}
|
|
407 |
|
|
408 |
// ---------------------------------------------------------------------------
|
|
409 |
// CWPVoIPAdapter::GetSavingInfoL
|
|
410 |
// ---------------------------------------------------------------------------
|
|
411 |
//
|
|
412 |
void CWPVoIPAdapter::GetSavingInfoL( TInt aIndex,
|
|
413 |
RPointerArray<HBufC8>& aSavingInfo )
|
|
414 |
{
|
|
415 |
CleanupResetAndDestroyPushL( aSavingInfo );
|
|
416 |
|
|
417 |
// APPID into place [0].
|
|
418 |
HBufC8* temp = KVoIPAppID8().AllocLC();
|
|
419 |
aSavingInfo.AppendL( temp );
|
|
420 |
CleanupStack::Pop();
|
|
421 |
|
|
422 |
// APPREF into place [1].
|
|
423 |
temp = iDatas[aIndex]->AppRef()->AllocLC();
|
|
424 |
aSavingInfo.AppendL( temp );
|
|
425 |
CleanupStack::Pop();
|
|
426 |
|
|
427 |
// Profile id into place [2].
|
|
428 |
temp = iDatas[aIndex]->SaveData().AllocLC();
|
|
429 |
aSavingInfo.AppendL( temp );
|
|
430 |
CleanupStack::Pop();
|
|
431 |
|
|
432 |
CleanupStack::Pop( &aSavingInfo );
|
|
433 |
}
|
|
434 |
|
|
435 |
// ---------------------------------------------------------------------------
|
|
436 |
// CWPVoIPAdapter::VisitL
|
|
437 |
// ---------------------------------------------------------------------------
|
|
438 |
//
|
|
439 |
void CWPVoIPAdapter::VisitL( CWPParameter& aParameter )
|
|
440 |
{
|
|
441 |
DBG_PRINT( "CWVoIPAdapter::VisitL( parameter ) - begin" );
|
|
442 |
// tmpValue holds the value converted from Unicode to UTF8.
|
|
443 |
HBufC8* tmpValue = HBufC8::NewLC( aParameter.Value().Length() ); // CS:1
|
|
444 |
TPtr8 ptrTmpValue( tmpValue->Des() );
|
|
445 |
CnvUtfConverter::ConvertFromUnicodeToUtf8( ptrTmpValue,
|
|
446 |
aParameter.Value() );
|
|
447 |
TInt tIntParameterValue( 0 );
|
|
448 |
|
|
449 |
switch( aParameter.ID() )
|
|
450 |
{
|
|
451 |
case EWPParameterAppRef:
|
|
452 |
{
|
|
453 |
iCurrentVoIPItem->SetAppRefL( tmpValue->Des() );
|
|
454 |
break;
|
|
455 |
}
|
|
456 |
case EWPParameterAppID:
|
|
457 |
{
|
|
458 |
iAppID.Set( aParameter.Value() );
|
|
459 |
break;
|
|
460 |
}
|
|
461 |
// Here case 0 are handled the VoIP parameters that are extensions
|
|
462 |
// to OMA Client Provisioning parameter set.
|
|
463 |
case 0:
|
|
464 |
//lint -e{961} No need for else statement here
|
|
465 |
if ( aParameter.Name().Compare( KParmSMPORT ) == 0 )
|
|
466 |
{
|
|
467 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
468 |
{
|
|
469 |
iCurrentVoIPItem->SetStartMediaPort( tIntParameterValue );
|
|
470 |
}// if
|
|
471 |
}
|
|
472 |
else if ( aParameter.Name().Compare( KParmEMPORT ) == 0 )
|
|
473 |
{
|
|
474 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
475 |
{
|
|
476 |
iCurrentVoIPItem->SetEndMediaPort( tIntParameterValue );
|
|
477 |
}//if
|
|
478 |
}// else if
|
|
479 |
else if ( aParameter.Name().Compare( KParmMEDIAQOS ) == 0 )
|
|
480 |
{
|
|
481 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
482 |
{
|
|
483 |
iCurrentVoIPItem->SetMediaQoS( tIntParameterValue );
|
|
484 |
}// if
|
|
485 |
}// else if
|
|
486 |
else if ( aParameter.Name().Compare( KParmNODTMFIB ) == 0 )
|
|
487 |
{
|
|
488 |
iCurrentVoIPItem->SetDTMFInBand( 0 );
|
|
489 |
}// else if
|
|
490 |
else if ( aParameter.Name().Compare( KParmNODTMFOOB ) == 0 )
|
|
491 |
{
|
|
492 |
iCurrentVoIPItem->SetDTMFOutBand( 0 );
|
|
493 |
}
|
|
494 |
else if ( aParameter.Name().Compare( KParmSECURECALLPREF ) == 0 )
|
|
495 |
{
|
|
496 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
497 |
{
|
|
498 |
iCurrentVoIPItem->SetSecureCallPref( tIntParameterValue );
|
|
499 |
}// if
|
|
500 |
}// else if
|
|
501 |
|
|
502 |
else if ( aParameter.Name().Compare( KParmRTCP ) == 0 )
|
|
503 |
{
|
|
504 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
505 |
{
|
|
506 |
iCurrentVoIPItem->SetRTCP( tIntParameterValue );
|
|
507 |
}// if
|
|
508 |
}// else if
|
|
509 |
|
|
510 |
else if ( aParameter.Name().Compare(
|
|
511 |
KParmUAHTERMINALTYPE ) == 0 )
|
|
512 |
{
|
|
513 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
514 |
{
|
|
515 |
iCurrentVoIPItem->SetUAHTerminalType(
|
|
516 |
tIntParameterValue );
|
|
517 |
}// if
|
|
518 |
}// else if
|
|
519 |
|
|
520 |
else if ( aParameter.Name().Compare( KParmUAHWLANMAC ) == 0 )
|
|
521 |
{
|
|
522 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
523 |
{
|
|
524 |
iCurrentVoIPItem->SetUAHWLANMAC( tIntParameterValue );
|
|
525 |
}// if
|
|
526 |
}// else if
|
|
527 |
|
|
528 |
else if ( aParameter.Name().Compare( KParmUAHSTRING ) == 0 )
|
|
529 |
{
|
|
530 |
iCurrentVoIPItem->SetUAHStringL( aParameter.Value() );
|
|
531 |
}
|
|
532 |
|
|
533 |
else if ( aParameter.Name().Compare(
|
|
534 |
KParmPROFILELOCKEDTOIAP ) == 0 )
|
|
535 |
{
|
|
536 |
iCurrentVoIPItem->SetProfileLockedToIAP( 1 );
|
|
537 |
}
|
|
538 |
|
|
539 |
else if ( aParameter.Name().Compare( KParmVOIPPLUGINUID ) == 0 )
|
|
540 |
{
|
|
541 |
TInt hexStart ( tmpValue->Find( KHexPrefix() ) );
|
|
542 |
if ( hexStart == KErrNotFound )
|
|
543 |
{
|
|
544 |
hexStart = KErrNone;
|
|
545 |
}
|
|
546 |
else
|
|
547 |
{
|
|
548 |
hexStart = KHexPrefix().Length();
|
|
549 |
}
|
|
550 |
TUint32 paramValue;
|
|
551 |
TLex8 lex( tmpValue->Des().Mid( hexStart ));
|
|
552 |
TInt err( KErrNone );
|
|
553 |
err = lex.Val( paramValue, EHex );
|
|
554 |
if ( KErrNone == err && paramValue <= KMaxTInt )
|
|
555 |
{
|
|
556 |
iCurrentVoIPItem->SetVoIPPluginUid( paramValue );
|
|
557 |
}// if
|
|
558 |
}// else if
|
|
559 |
|
|
560 |
else if ( aParameter.Name().Compare(
|
|
561 |
KParmALLOWVOIPOVERWCDMA ) == 0 )
|
|
562 |
{
|
|
563 |
iCurrentVoIPItem->SetAllowVoIPOverWCDMA( 1 );
|
|
564 |
}
|
|
565 |
|
|
566 |
else if ( aParameter.Name().Compare( KParmVOIPDIGITS ) == 0 )
|
|
567 |
{
|
|
568 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
569 |
{
|
|
570 |
iCurrentVoIPItem->SetVoIPDigits( tIntParameterValue );
|
|
571 |
}
|
|
572 |
}
|
|
573 |
|
|
574 |
else if ( aParameter.Name().Compare( KParmIGNDOMPART ) == 0 )
|
|
575 |
{
|
|
576 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
577 |
{
|
|
578 |
iCurrentVoIPItem->SetDomainPartIgnoreRule(
|
|
579 |
tIntParameterValue );
|
|
580 |
}
|
|
581 |
}
|
|
582 |
|
|
583 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
584 |
KParmADDUSERPHONE ) )
|
|
585 |
{
|
|
586 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
587 |
{
|
|
588 |
iCurrentVoIPItem->SetAddUserPhone( tIntParameterValue );
|
|
589 |
}
|
|
590 |
}
|
|
591 |
|
|
592 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
593 |
KParmSIPCONNTESTURI ) )
|
|
594 |
{
|
|
595 |
iCurrentVoIPItem->SetSipConnTestAddressL(
|
|
596 |
aParameter.Value() );
|
|
597 |
}
|
|
598 |
|
|
599 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
600 |
KParmPROVIDERURI ) )
|
|
601 |
{
|
|
602 |
iCurrentVoIPItem->SetServiceProviderBookmarkL(
|
|
603 |
aParameter.Value() );
|
|
604 |
}
|
|
605 |
|
|
606 |
else if ( KErrNone == aParameter.Name().Compare( KParmMINSE ) )
|
|
607 |
{
|
|
608 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
609 |
{
|
|
610 |
iCurrentVoIPItem->SetSipMinSe( tIntParameterValue );
|
|
611 |
}
|
|
612 |
}
|
|
613 |
|
|
614 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
615 |
KParmSESSIONEXP ) )
|
|
616 |
{
|
|
617 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
618 |
{
|
|
619 |
iCurrentVoIPItem->SetSipSessionExpires(
|
|
620 |
tIntParameterValue );
|
|
621 |
}
|
|
622 |
}
|
|
623 |
|
|
624 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
625 |
KParmBRANDINGURI ) )
|
|
626 |
{
|
|
627 |
iCurrentVoIPItem->SetBrandingDataAddressL(
|
|
628 |
aParameter.Value() );
|
|
629 |
}
|
|
630 |
|
|
631 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
632 |
KParmAABUDDYREQUEST ) )
|
|
633 |
{
|
|
634 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
635 |
{
|
|
636 |
iCurrentVoIPItem->SetAutoAcceptBuddyRequest(
|
|
637 |
tIntParameterValue );
|
|
638 |
}
|
|
639 |
}
|
|
640 |
|
|
641 |
// VoiceMailBox parameter.
|
|
642 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
643 |
KParmIPVOICEMAILBOXURI ) )
|
|
644 |
{
|
|
645 |
iCurrentVoIPItem->SetIPVoiceMailBoxURIL(
|
|
646 |
aParameter.Value() );
|
|
647 |
}
|
|
648 |
|
|
649 |
// VoiceMailBox parameter.
|
|
650 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
651 |
KParmVMBXLISTENURI ) )
|
|
652 |
{
|
|
653 |
iCurrentVoIPItem->SetVoiceMailBoxListenURIL(
|
|
654 |
aParameter.Value() );
|
|
655 |
}
|
|
656 |
|
|
657 |
// VoiceMailBox parameter.
|
|
658 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
659 |
KParmRESUBSCRIBE ) )
|
|
660 |
{
|
|
661 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
662 |
{
|
|
663 |
iCurrentVoIPItem->SetReSubscribeInterval(
|
|
664 |
tIntParameterValue );
|
|
665 |
}
|
|
666 |
}
|
|
667 |
|
|
668 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
669 |
KParmNATPROTOCOL ) )
|
|
670 |
{
|
|
671 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
672 |
{
|
|
673 |
iCurrentVoIPItem->SetUsedNatProtocol(
|
|
674 |
tIntParameterValue );
|
|
675 |
}
|
|
676 |
}
|
|
677 |
|
|
678 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
679 |
KParmAUTOENABLE ) )
|
|
680 |
{
|
|
681 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
682 |
{
|
|
683 |
iCurrentVoIPItem->SetAutoEnableService(
|
|
684 |
tIntParameterValue );
|
|
685 |
}
|
|
686 |
}
|
|
687 |
else if ( KErrNone == aParameter.Name().Compare(
|
|
688 |
KParmIMENABLED ) )
|
|
689 |
{
|
|
690 |
iCurrentVoIPItem->EnableIm();
|
|
691 |
}
|
|
692 |
|
|
693 |
// Codec parameter.
|
|
694 |
else if ( aParameter.Name().Compare( KParmMEDIASUBTYPE ) == 0
|
|
695 |
&& iSetCodec )
|
|
696 |
{
|
|
697 |
typedef CWPVoIPCodec CMediaSubType;
|
|
698 |
// don't need to check value because of switch-default:
|
|
699 |
// coverity[check_return] coverity[unchecked_value]
|
|
700 |
DescToInt( tmpValue, tIntParameterValue );
|
|
701 |
|
|
702 |
switch ( tIntParameterValue )
|
|
703 |
{
|
|
704 |
case CMediaSubType::EAMR:
|
|
705 |
{
|
|
706 |
iCurrentCodec->SetMediaSubtypeNameL(
|
|
707 |
KAudioCodecAMR() );
|
|
708 |
}
|
|
709 |
break;
|
|
710 |
|
|
711 |
case CMediaSubType::EiLBC:
|
|
712 |
{
|
|
713 |
iCurrentCodec->SetMediaSubtypeNameL(
|
|
714 |
KAudioCodeciLBC() );
|
|
715 |
}
|
|
716 |
break;
|
|
717 |
|
|
718 |
case CMediaSubType::EPCMA:
|
|
719 |
{
|
|
720 |
iCurrentCodec->SetMediaSubtypeNameL(
|
|
721 |
KAudioCodecPCMA() );
|
|
722 |
}
|
|
723 |
break;
|
|
724 |
|
|
725 |
case CMediaSubType::EPCMU:
|
|
726 |
{
|
|
727 |
iCurrentCodec->SetMediaSubtypeNameL(
|
|
728 |
KAudioCodecPCMU() );
|
|
729 |
}
|
|
730 |
break;
|
|
731 |
|
|
732 |
case CMediaSubType::ECN:
|
|
733 |
{
|
|
734 |
iCurrentCodec->SetMediaSubtypeNameL(
|
|
735 |
KAudioCodecCN() );
|
|
736 |
}
|
|
737 |
break;
|
|
738 |
|
|
739 |
case CMediaSubType::EG729:
|
|
740 |
{
|
|
741 |
iCurrentCodec->SetMediaSubtypeNameL(
|
|
742 |
KAudioCodecG729() );
|
|
743 |
}
|
|
744 |
break;
|
|
745 |
|
|
746 |
case CMediaSubType::EAMRWB:
|
|
747 |
{
|
|
748 |
iCurrentCodec->SetMediaSubtypeNameL(
|
|
749 |
KAudioCodecAMRWB() );
|
|
750 |
}
|
|
751 |
break;
|
|
752 |
|
|
753 |
case CMediaSubType::EVMRWB:
|
|
754 |
case CMediaSubType::EEVRC:
|
|
755 |
case CMediaSubType::EEVRC0:
|
|
756 |
case CMediaSubType::ESMV:
|
|
757 |
case CMediaSubType::ESMV0:
|
|
758 |
case CMediaSubType::EG726_40:
|
|
759 |
case CMediaSubType::EG726_32:
|
|
760 |
case CMediaSubType::EG726_24:
|
|
761 |
case CMediaSubType::EG726_16:
|
|
762 |
case CMediaSubType::EGSMEFR:
|
|
763 |
case CMediaSubType::EGSMFR:
|
|
764 |
default:
|
|
765 |
{
|
|
766 |
// Error or not supported => Codec deleted later.
|
|
767 |
iCurrentCodec->SetMediaSubtypeNameL(
|
|
768 |
KNullDesC() );
|
|
769 |
}
|
|
770 |
}// switch
|
|
771 |
}
|
|
772 |
// Codec parameter.
|
|
773 |
else if ( aParameter.Name().Compare( KParmPRIORITYINDEX ) == 0
|
|
774 |
&& iSetCodec )
|
|
775 |
{
|
|
776 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
777 |
{
|
|
778 |
iCurrentCodec->iPriorityIndex = tIntParameterValue;
|
|
779 |
}
|
|
780 |
}
|
|
781 |
// Codec parameter.
|
|
782 |
else if ( aParameter.Name().Compare( KParmJITTERBUFFERSIZE ) == 0
|
|
783 |
&& iSetCodec )
|
|
784 |
{
|
|
785 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
786 |
{
|
|
787 |
iCurrentCodec->iJitterBufferSize = tIntParameterValue;
|
|
788 |
}
|
|
789 |
}
|
|
790 |
// Codec parameter.
|
|
791 |
else if ( aParameter.Name().Compare( KParmOCTETALIGN ) == 0
|
|
792 |
&& iSetCodec )
|
|
793 |
{
|
|
794 |
iCurrentCodec->iOctetAlign = 1;
|
|
795 |
}
|
|
796 |
// Codec parameter.
|
|
797 |
else if ( aParameter.Name().Compare( KParmMODESET ) == 0
|
|
798 |
&& iSetCodec )
|
|
799 |
{
|
|
800 |
TLex8 lexModeSet( tmpValue->Des() );
|
|
801 |
TChar tmpChar;
|
|
802 |
|
|
803 |
while ( lexModeSet.Peek() != 0 )
|
|
804 |
{
|
|
805 |
TInt32 tmpModeSetValue ( 0 );
|
|
806 |
TBool cycle ( ETrue );
|
|
807 |
TBool stateDigit ( ETrue );
|
|
808 |
TBool numberExists ( EFalse );
|
|
809 |
|
|
810 |
while ( cycle )
|
|
811 |
{
|
|
812 |
switch( stateDigit )
|
|
813 |
{
|
|
814 |
case ETrue:
|
|
815 |
{
|
|
816 |
if ( lexModeSet.Peek() != 0 )
|
|
817 |
{
|
|
818 |
tmpChar = lexModeSet.Get();
|
|
819 |
if ( tmpChar.IsDigit() )
|
|
820 |
{
|
|
821 |
// for example: 25 = 2 * 10 + 5
|
|
822 |
// 257 = 25 * 10 + 7
|
|
823 |
tmpModeSetValue = tmpModeSetValue * KTen
|
|
824 |
+ tmpChar.GetNumericValue();
|
|
825 |
numberExists = ETrue;
|
|
826 |
}
|
|
827 |
else
|
|
828 |
{
|
|
829 |
stateDigit = EFalse;
|
|
830 |
}
|
|
831 |
}
|
|
832 |
else
|
|
833 |
{
|
|
834 |
stateDigit = EFalse;
|
|
835 |
}
|
|
836 |
break;
|
|
837 |
}
|
|
838 |
|
|
839 |
case EFalse:
|
|
840 |
{
|
|
841 |
cycle = EFalse;
|
|
842 |
break;
|
|
843 |
}
|
|
844 |
}
|
|
845 |
}
|
|
846 |
if ( numberExists )
|
|
847 |
{
|
|
848 |
iCurrentCodec->iModeSet.Append( tmpModeSetValue );
|
|
849 |
}
|
|
850 |
}
|
|
851 |
}
|
|
852 |
|
|
853 |
// Codec parameter.
|
|
854 |
else if ( aParameter.Name().Compare( KParmMODECHANGEPERIOD ) == 0
|
|
855 |
&& iSetCodec )
|
|
856 |
{
|
|
857 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
858 |
{
|
|
859 |
iCurrentCodec->iModeChangePeriod = tIntParameterValue;
|
|
860 |
}
|
|
861 |
}
|
|
862 |
// Codec parameter.
|
|
863 |
else if (
|
|
864 |
aParameter.Name().Compare( KParmMODECHANGENEIGHBOR ) == 0
|
|
865 |
&& iSetCodec )
|
|
866 |
{
|
|
867 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
868 |
{
|
|
869 |
iCurrentCodec->iModeChangeNeighbor = tIntParameterValue;
|
|
870 |
}
|
|
871 |
}
|
|
872 |
// Codec parameter.
|
|
873 |
else if ( aParameter.Name().Compare( KParmPTIME ) == 0
|
|
874 |
&& iSetCodec )
|
|
875 |
{
|
|
876 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
877 |
{
|
|
878 |
iCurrentCodec->iPTime = tIntParameterValue;
|
|
879 |
}
|
|
880 |
}
|
|
881 |
// Codec parameter.
|
|
882 |
else if ( aParameter.Name().Compare( KParmMAXPTIME ) == 0
|
|
883 |
&& iSetCodec )
|
|
884 |
{
|
|
885 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
886 |
{
|
|
887 |
iCurrentCodec->iMaxPTime = tIntParameterValue;
|
|
888 |
}
|
|
889 |
}
|
|
890 |
|
|
891 |
// Codec parameter.
|
|
892 |
else if ( aParameter.Name().Compare( KParmVAD ) == 0
|
|
893 |
&& iSetCodec )
|
|
894 |
{
|
|
895 |
iCurrentCodec->iVAD = 1;
|
|
896 |
}
|
|
897 |
|
|
898 |
// Codec parameter.
|
|
899 |
else if ( aParameter.Name().Compare( KParmANNEXB ) == 0
|
|
900 |
&& iSetCodec )
|
|
901 |
{
|
|
902 |
iCurrentCodec->iAnnexB = 1;
|
|
903 |
}
|
|
904 |
// Codec parameter.
|
|
905 |
else if ( aParameter.Name().Compare( KParmMAXRED ) == 0
|
|
906 |
&& iSetCodec )
|
|
907 |
{
|
|
908 |
if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
|
|
909 |
{
|
|
910 |
iCurrentCodec->iMaxRed = tIntParameterValue;
|
|
911 |
}
|
|
912 |
}
|
|
913 |
break; // case 0:
|
|
914 |
|
|
915 |
case EWPParameterProviderID: // APPLICATION/PROVIDER-ID
|
|
916 |
iCurrentVoIPItem->SetProviderIdL( aParameter.Value() );
|
|
917 |
break;
|
|
918 |
|
|
919 |
case EWPParameterName: // APPLICATION/NAME
|
|
920 |
iCurrentVoIPItem->SetNameL( aParameter.Value() );
|
|
921 |
break;
|
|
922 |
|
|
923 |
case EWPParameterToAppRef: // TO-APPREF
|
|
924 |
{
|
|
925 |
// APPLICATION/TO-APPREF
|
|
926 |
if ( !iSetVoipUris )
|
|
927 |
{
|
|
928 |
iCurrentVoIPItem->AddToAppRefL( tmpValue->Des() );
|
|
929 |
}
|
|
930 |
else
|
|
931 |
{
|
|
932 |
if ( iCurrentVoIPItem &&
|
|
933 |
iCurrentVoIPItem->VoipUrisToAppRef().Length() == 0 )
|
|
934 |
{
|
|
935 |
iCurrentVoIPItem->SetVoipUrisToAppRefL( tmpValue->Des() );
|
|
936 |
}
|
|
937 |
}// else if
|
|
938 |
} //case
|
|
939 |
break;
|
|
940 |
|
|
941 |
// VOIPURIS/TO-NAPID
|
|
942 |
case EWPParameterToNapID:
|
|
943 |
{
|
|
944 |
if ( iCurrentVoIPItem && iSetVoipUris
|
|
945 |
&& iCurrentVoIPItem->ToNapId().Length() == 0 )
|
|
946 |
{
|
|
947 |
iCurrentVoIPItem->SetToNapIdL( tmpValue->Des() );
|
|
948 |
}
|
|
949 |
break;
|
|
950 |
}
|
|
951 |
|
|
952 |
default:
|
|
953 |
break;
|
|
954 |
}// switch
|
|
955 |
CleanupStack::PopAndDestroy( tmpValue );
|
|
956 |
DBG_PRINT( "CWVoIPAdapter::VisitL( parameter ) - end" );
|
|
957 |
}
|
|
958 |
|
|
959 |
// ---------------------------------------------------------------------------
|
|
960 |
// CWPVoIPAdapter::VisitLinkL
|
|
961 |
// ---------------------------------------------------------------------------
|
|
962 |
//
|
|
963 |
void CWPVoIPAdapter::VisitLinkL( CWPCharacteristic& aLink )
|
|
964 |
{
|
|
965 |
DBG_PRINT( "CWVoIPAdapter::VisitLinkL - begin" );
|
|
966 |
switch( aLink.Type() )
|
|
967 |
{
|
|
968 |
case KWPNapDef:
|
|
969 |
{
|
|
970 |
if ( !iCurrentVoIPItem->NapDef() )
|
|
971 |
{
|
|
972 |
iCurrentVoIPItem->SetNapDef( &aLink );
|
|
973 |
}
|
|
974 |
break;
|
|
975 |
}
|
|
976 |
default:
|
|
977 |
break;
|
|
978 |
}
|
|
979 |
DBG_PRINT( "CWVoIPAdapter::VisitLinkL - end" );
|
|
980 |
}
|
|
981 |
// ---------------------------------------------------------------------------
|
|
982 |
// CWPVoIPAdapter::SettingsSavedL
|
|
983 |
// ---------------------------------------------------------------------------
|
|
984 |
//
|
|
985 |
void CWPVoIPAdapter::SettingsSavedL ( const TDesC8& aAppIdOfSavingItem,
|
|
986 |
const TDesC8& aAppRef, const TDesC8& aStorageIdValue )
|
|
987 |
{
|
|
988 |
DBG_PRINT( "CWVoIPAdapter::SettingsSavedL - begin" );
|
|
989 |
|
|
990 |
if ( !aAppIdOfSavingItem.Length() || !aAppRef.Length() ||
|
|
991 |
!aStorageIdValue.Length() )
|
|
992 |
{
|
|
993 |
DBG_PRINT( "CWVoIPAdapter::SettingsSavedL - end" );
|
|
994 |
return;
|
|
995 |
}
|
|
996 |
|
|
997 |
HBufC8* tmpAppId = aAppIdOfSavingItem.AllocLC(); // CS:1
|
|
998 |
|
|
999 |
TUint32 storageId( 0 );
|
|
1000 |
TLex8 lex( aStorageIdValue );
|
|
1001 |
User::LeaveIfError( lex.Val( storageId, EDecimal ) );
|
|
1002 |
|
|
1003 |
const TInt itemCount = iDatas.Count();
|
|
1004 |
|
|
1005 |
//lint -e{961} No need for else statement here
|
|
1006 |
if ( KErrNone == KSIPAppID8().CompareF( tmpAppId->Des() ) )
|
|
1007 |
{
|
|
1008 |
for ( TInt itemIndex = 0; itemIndex < itemCount; itemIndex++ )
|
|
1009 |
{
|
|
1010 |
TBool setOk = iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESIP,
|
|
1011 |
storageId, aAppRef );
|
|
1012 |
|
|
1013 |
TBuf8<KTempStringlength> userAgentHeader;
|
|
1014 |
iDatas[itemIndex]->GetUserAgentHeaderL( userAgentHeader );
|
|
1015 |
if ( setOk && storageId > 0 )
|
|
1016 |
{
|
|
1017 |
TUint32 itemId = iDatas[itemIndex]->ItemId();
|
|
1018 |
if ( TUint( KNotSaved ) != itemId )
|
|
1019 |
{
|
|
1020 |
// First update RCSE so that service will be created.
|
|
1021 |
DBG_PRINT( "CWVoIPAdapter::SettingsSavedL - update RCSE..." );
|
|
1022 |
CRCSEProfileRegistry* rcseReg =
|
|
1023 |
CRCSEProfileRegistry::NewLC();
|
|
1024 |
CRCSEProfileEntry* rcseProf = CRCSEProfileEntry::NewLC();
|
|
1025 |
rcseReg->FindL( itemId, *rcseProf );
|
|
1026 |
TSettingIds referredIds;
|
|
1027 |
referredIds.iProfileType = 0; // SIP.
|
|
1028 |
referredIds.iProfileId = TInt( storageId );
|
|
1029 |
// Never reference to profile specific settings.
|
|
1030 |
referredIds.iProfileSpecificSettingId = KNotSet;
|
|
1031 |
rcseProf->iIds.Append( referredIds );
|
|
1032 |
rcseReg->UpdateL( itemId, *rcseProf );
|
|
1033 |
CleanupStack::PopAndDestroy( 2, rcseReg );
|
|
1034 |
}
|
|
1035 |
|
|
1036 |
// Then set SIP user-agent header
|
|
1037 |
DBG_PRINT(
|
|
1038 |
"CWVoIPAdapter::SettingsSavedL - \
|
|
1039 |
create SIP User-Agent Header..." );
|
|
1040 |
CSIPProfileRegistryObserver* cSIPProfRegObserver =
|
|
1041 |
CSIPProfileRegistryObserver::NewLC(); // CS:2
|
|
1042 |
CSIPManagedProfileRegistry* cSIPManagedProfileRegistry =
|
|
1043 |
CSIPManagedProfileRegistry::NewLC(
|
|
1044 |
*cSIPProfRegObserver ); // CS:3
|
|
1045 |
CSIPProfile* cSIPProfile = NULL;
|
|
1046 |
cSIPProfile = cSIPManagedProfileRegistry->ProfileL(
|
|
1047 |
storageId );
|
|
1048 |
CleanupStack::PushL( cSIPProfile ); // CS:4
|
|
1049 |
CSIPManagedProfile* cSIPManagedProfile =
|
|
1050 |
static_cast<CSIPManagedProfile*>( cSIPProfile );
|
|
1051 |
CleanupStack::PushL( cSIPManagedProfile ); // CS:5
|
|
1052 |
// Create an array for setting the user agent header.
|
|
1053 |
// Granularity is 1 since only one item is appended into
|
|
1054 |
// the array.
|
|
1055 |
CDesC8ArrayFlat* uahArray =
|
|
1056 |
new ( ELeave ) CDesC8ArrayFlat( 1 );
|
|
1057 |
CleanupStack::PushL( uahArray ); // CS:6
|
|
1058 |
uahArray->AppendL( userAgentHeader );
|
|
1059 |
if ( userAgentHeader.Length() > 0 )
|
|
1060 |
{
|
|
1061 |
User::LeaveIfError( cSIPManagedProfile->SetParameter(
|
|
1062 |
KSIPHeaders, *uahArray ) );
|
|
1063 |
}
|
|
1064 |
|
|
1065 |
cSIPManagedProfileRegistry->SaveL( *cSIPManagedProfile );
|
|
1066 |
uahArray->Reset();
|
|
1067 |
CleanupStack::PopAndDestroy( uahArray ); // CS:5
|
|
1068 |
CleanupStack::PopAndDestroy( cSIPManagedProfile ); // CS:4
|
|
1069 |
CleanupStack::Pop( cSIPProfile ); // CS:3
|
|
1070 |
cSIPProfile = NULL;
|
|
1071 |
CleanupStack::PopAndDestroy(
|
|
1072 |
cSIPManagedProfileRegistry );// CS:2
|
|
1073 |
CleanupStack::PopAndDestroy( cSIPProfRegObserver );// CS:1
|
|
1074 |
DBG_PRINT(
|
|
1075 |
"CWVoIPAdapter::SettingsSavedL - \
|
|
1076 |
SIP User-Agent Header created and set." );
|
|
1077 |
} // if ( matches ... )
|
|
1078 |
} // for
|
|
1079 |
}
|
|
1080 |
else if ( KErrNone == KSCCPAppID8().CompareF( tmpAppId->Des() ) )
|
|
1081 |
{
|
|
1082 |
for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
|
|
1083 |
{
|
|
1084 |
iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESCCP, storageId,
|
|
1085 |
aAppRef );
|
|
1086 |
}
|
|
1087 |
}
|
|
1088 |
else if ( KErrNone == KNATFWAppID8().CompareF( tmpAppId->Des() ) )
|
|
1089 |
{
|
|
1090 |
for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
|
|
1091 |
{
|
|
1092 |
iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ENATFW, storageId,
|
|
1093 |
aAppRef );
|
|
1094 |
}
|
|
1095 |
}
|
|
1096 |
else if ( KErrNone == KPresenceAppId8().CompareF( tmpAppId->Des() ) )
|
|
1097 |
{
|
|
1098 |
for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
|
|
1099 |
{
|
|
1100 |
iDatas[itemIndex]->SetStorageId( CWPVoIPItem::EPresence,
|
|
1101 |
storageId, aAppRef );
|
|
1102 |
}
|
|
1103 |
}
|
|
1104 |
else if ( KErrNone == KSNAPAppID8().CompareF( tmpAppId->Des() ) )
|
|
1105 |
{
|
|
1106 |
for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
|
|
1107 |
{
|
|
1108 |
iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESNAP, storageId,
|
|
1109 |
aAppRef );
|
|
1110 |
}
|
|
1111 |
}
|
|
1112 |
|
|
1113 |
CleanupStack::PopAndDestroy( tmpAppId ); // CS:0
|
|
1114 |
DBG_PRINT( "CWVoIPAdapter::SettingsSavedL - end" );
|
|
1115 |
}
|
|
1116 |
|
|
1117 |
|
|
1118 |
// ---------------------------------------------------------------------------
|
|
1119 |
// CWPVoIPAdapter::SavingFinalizedL()
|
|
1120 |
// ---------------------------------------------------------------------------
|
|
1121 |
//
|
|
1122 |
void CWPVoIPAdapter::SavingFinalizedL()
|
|
1123 |
{
|
|
1124 |
DBG_PRINT( "CWVoIPAdapter::SavingFinalizedL - begin" );
|
|
1125 |
// Prerequisites: All data received and is stored at least transiently in
|
|
1126 |
// the data structures in VoIP items. Call SavingFinalized for everyone to
|
|
1127 |
// make them update the APPREF/TO-APPREF linkage data.
|
|
1128 |
for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
|
|
1129 |
{
|
|
1130 |
iDatas[itemIndex]->SavingFinalizedL();
|
|
1131 |
}// for
|
|
1132 |
DBG_PRINT( "CWVoIPAdapter::SavingFinalizedL - end" );
|
|
1133 |
}
|
|
1134 |
|
|
1135 |
// ---------------------------------------------------------------------------
|
|
1136 |
// CWPVoIPAdapter::DescToInt()
|
|
1137 |
// ---------------------------------------------------------------------------
|
|
1138 |
//
|
|
1139 |
TInt CWPVoIPAdapter::DescToInt( HBufC8* aDescValue, TInt& aIntValue ) const
|
|
1140 |
{
|
|
1141 |
TInt err( KErrNotFound );
|
|
1142 |
if ( aDescValue )
|
|
1143 |
{
|
|
1144 |
TLex8 lex( aDescValue->Des() );
|
|
1145 |
err = lex.Val( aIntValue );
|
|
1146 |
}
|
|
1147 |
return err;
|
|
1148 |
}
|
|
1149 |
|
|
1150 |
// ---------------------------------------------------------------------------
|
|
1151 |
// CWPVoIPAdapter::IapIdFromWapIdL
|
|
1152 |
// Returns IAP ID from WAP ID.
|
|
1153 |
// ---------------------------------------------------------------------------
|
|
1154 |
//
|
|
1155 |
TUint32 CWPVoIPAdapter::IapIdFromWapIdL( TUint32 aWapId )
|
|
1156 |
{
|
|
1157 |
DBG_PRINT( "CWPVoIPAdapter::IapIdFromWapIdL - begin" );
|
|
1158 |
RCmManagerExt cmManager;
|
|
1159 |
cmManager.OpenLC(); // CS:1
|
|
1160 |
RArray<TUint32> iapIds;
|
|
1161 |
TUint32 iapId( 0 );
|
|
1162 |
|
|
1163 |
// First get all free IAP ID's.
|
|
1164 |
cmManager.ConnectionMethodL( iapIds );
|
|
1165 |
CleanupClosePushL( iapIds ); // CS:2
|
|
1166 |
|
|
1167 |
// Then get IAP ID's from all destinations.
|
|
1168 |
RArray<TUint32> destIds;
|
|
1169 |
cmManager.AllDestinationsL( destIds );
|
|
1170 |
CleanupClosePushL( destIds ); // CS:3
|
|
1171 |
|
|
1172 |
TInt destCount = destIds.Count();
|
|
1173 |
|
|
1174 |
for ( TInt destIndex = 0; destIndex < destCount; destIndex++ )
|
|
1175 |
{
|
|
1176 |
RCmDestinationExt dest = cmManager.DestinationL(
|
|
1177 |
destIds[destIndex] );
|
|
1178 |
CleanupClosePushL( dest ); // CS:4
|
|
1179 |
TInt cmCount = dest.ConnectionMethodCount();
|
|
1180 |
for ( TInt cmIndex = 0; cmIndex < cmCount; cmIndex++ )
|
|
1181 |
{
|
|
1182 |
TUint32 apId = dest.ConnectionMethodL(
|
|
1183 |
cmIndex ).GetIntAttributeL( CMManager::ECmIapId );
|
|
1184 |
iapIds.AppendL( apId );
|
|
1185 |
}
|
|
1186 |
CleanupStack::PopAndDestroy( &dest ); // CS:3
|
|
1187 |
}
|
|
1188 |
// Finally, go through all connection methods and find correct IAP ID.
|
|
1189 |
const TInt cmCount = iapIds.Count();
|
|
1190 |
for ( TInt counter = 0; counter < cmCount; counter++ )
|
|
1191 |
{
|
|
1192 |
TUint32 id = cmManager.GetConnectionMethodInfoIntL(
|
|
1193 |
iapIds[counter], CMManager::ECmWapId );
|
|
1194 |
|
|
1195 |
if ( id == aWapId )
|
|
1196 |
{
|
|
1197 |
iapId = iapIds[counter];
|
|
1198 |
// No need to go through rest of IAPs.
|
|
1199 |
break;
|
|
1200 |
}
|
|
1201 |
}
|
|
1202 |
|
|
1203 |
// PopAndDestroy destIds, iapIds, cmManager.
|
|
1204 |
CleanupStack::PopAndDestroy( 3, &cmManager ); // CS:0
|
|
1205 |
|
|
1206 |
DBG_PRINT( "CWPVoIPAdapter::IapIdFromWapIdL - end" );
|
|
1207 |
return iapId;
|
|
1208 |
}
|
|
1209 |
|
|
1210 |
// End of File
|