1 /* |
|
2 * Copyright (c) 2009-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: VoIP settings handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <crcseaudiocodecregistry.h> |
|
20 #include <crcseprofileregistry.h> |
|
21 #include <spsettings.h> |
|
22 #include <spproperty.h> |
|
23 #include <spdefinitions.h> |
|
24 #include <sipmanagedprofile.h> |
|
25 #include <sipmanagedprofileregistry.h> |
|
26 #include <cipappphoneutils.h> // SIP User-Agent header info. |
|
27 #include <cipapputilsaddressresolver.h> // SIP User-Agent header info. |
|
28 #include <pathinfo.h> // For getting phone rom root path. |
|
29 #include <cvimpstsettingsstore.h> // For IM tone path |
|
30 #include <settingsinternalcrkeys.h> // For default service. |
|
31 #include <centralrepository.h> // For default service. |
|
32 |
|
33 #include "voipxmlvoiphandler.h" |
|
34 #include "voipxmlprocessorlogger.h" |
|
35 #include "voipxmlprocessordefaults.h" |
|
36 #include "voipxmlutils.h" |
|
37 |
|
38 const TInt32 KCCHPresenceSubServicePlugId = 0x1027545A; |
|
39 // IM related constants. |
|
40 const TUint32 KIMSubServicePluginId = 0x1027545A; |
|
41 const TUint32 KIMLaunchUid = 0x200255D0; |
|
42 const TInt KIMSettingsId = 1; |
|
43 // Default IM message tone |
|
44 _LIT( KDefaultTone, "Message 2.aac" ); |
|
45 // Brand related constants. |
|
46 const TInt KBrandVersion = 1; |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // Default constructor. |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CVoipXmlVoipHandler::CVoipXmlVoipHandler() |
|
53 { |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // ConstructL |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 void CVoipXmlVoipHandler::ConstructL() |
|
61 { |
|
62 DBG_PRINT( "CVoipXmlVoipHandler::ConstructL begin" ); |
|
63 iRegistry = CRCSEProfileRegistry::NewL(); |
|
64 iCodecRegistry = CRCSEAudioCodecRegistry::NewL(); |
|
65 iEntry = CRCSEProfileEntry::NewL(); |
|
66 ResetTempCodec(); |
|
67 ResetTempSpSettings(); |
|
68 iSettingsSet = EFalse; |
|
69 DBG_PRINT( "CVoipXmlVoipHandler::ConstructL end" ); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // NewL |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 CVoipXmlVoipHandler* CVoipXmlVoipHandler::NewL() |
|
77 { |
|
78 DBG_PRINT( "CVoipXmlVoipHandler::NewL begin" ); |
|
79 CVoipXmlVoipHandler* self = new ( ELeave ) CVoipXmlVoipHandler; |
|
80 CleanupStack::PushL( self ); |
|
81 self->ConstructL(); |
|
82 CleanupStack::Pop( self ); |
|
83 DBG_PRINT( "CVoipXmlVoipHandler::NewL end" ); |
|
84 return self; |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // Destructor |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 CVoipXmlVoipHandler::~CVoipXmlVoipHandler() |
|
92 { |
|
93 DBG_PRINT( "CVoipXmlVoipHandler::~CVoipXmlVoipHandler begin" ); |
|
94 delete iRegistry; |
|
95 delete iCodecRegistry; |
|
96 delete iEntry; |
|
97 ResetTempCodec( ETrue ); |
|
98 ResetTempSpSettings(); |
|
99 DBG_PRINT( "CVoipXmlVoipHandler::~CVoipXmlVoipHandler end" ); |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // Sets VoIP setting. |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 void CVoipXmlVoipHandler::SetSetting( TInt aType, TInt aParam, |
|
107 const TDesC& aValue ) |
|
108 { |
|
109 // Ignore too long descriptors. |
|
110 if ( KMaxNodeValueLength < aValue.Length() ) |
|
111 { |
|
112 return; |
|
113 } |
|
114 |
|
115 switch ( aType ) |
|
116 { |
|
117 case EVoip: |
|
118 TRAP_IGNORE( SetCoreSettingL( aParam, aValue ) ); |
|
119 break; |
|
120 case ECodec: |
|
121 TRAP_IGNORE( SetCodecSettingL( aParam, aValue ) ); |
|
122 break; |
|
123 case EVmbx: |
|
124 TRAP_IGNORE( SetVmbxSettingL( aParam, aValue ) ); |
|
125 break; |
|
126 default: |
|
127 break; |
|
128 } |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // Stores settings to RCSE. |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 TInt CVoipXmlVoipHandler::StoreSettings() |
|
136 { |
|
137 TInt err( KErrNone ); |
|
138 TBool ok( ETrue ); |
|
139 |
|
140 if ( !iSettingsSet ) |
|
141 { |
|
142 // No settings to be stored => method not supported. |
|
143 err = KErrNotSupported; |
|
144 ok = EFalse; |
|
145 } |
|
146 else |
|
147 { |
|
148 TUint32 profileId( KErrNone ); |
|
149 // Add default codec set if no codecs defined. |
|
150 if ( 0 == iEntry->iPreferredCodecs.Count() ) |
|
151 { |
|
152 TRAP_IGNORE( AddDefaultCodecsL() ); |
|
153 } |
|
154 TRAP( err, profileId = iRegistry->AddL( *iEntry ) ); |
|
155 if ( KErrNone == err ) |
|
156 { |
|
157 // Adding profile entry to registry OK. Let's load the profile |
|
158 // from registry so that we'll get all the values registry has |
|
159 // added to the entry (AddL takes entry as const reference). |
|
160 TRAP_IGNORE( iRegistry->FindL( profileId, *iEntry ) ); |
|
161 iServiceId = iEntry->iServiceProviderId; |
|
162 } |
|
163 else |
|
164 { |
|
165 err = KErrCompletion; |
|
166 ok = EFalse; |
|
167 } |
|
168 } |
|
169 if ( !ok ) |
|
170 { |
|
171 const TInt count = iEntry->iPreferredCodecs.Count(); |
|
172 for ( TInt counter = 0; counter < count; counter++ ) |
|
173 { |
|
174 TRAP_IGNORE( iCodecRegistry->DeleteL( |
|
175 iEntry->iPreferredCodecs[counter] ) ); |
|
176 } |
|
177 } |
|
178 return err; |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------------------------- |
|
182 // Returns the service ID. |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 TUint32 CVoipXmlVoipHandler::SettingsId() |
|
186 { |
|
187 return iServiceId; |
|
188 } |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // Sets a codec to RCSE and resets the temp codec. |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 void CVoipXmlVoipHandler::SettingsEnd( TInt aType ) |
|
195 { |
|
196 if ( ECodec == aType ) |
|
197 { |
|
198 TRAP_IGNORE( SetCodecToRcseL() ); |
|
199 } |
|
200 } |
|
201 |
|
202 // --------------------------------------------------------------------------- |
|
203 // Saves linkage information. |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 void CVoipXmlVoipHandler::LinkSettings( TInt aType, TUint32 aSettingsId ) |
|
207 { |
|
208 switch ( aType ) |
|
209 { |
|
210 case ESip: |
|
211 { |
|
212 TRAP_IGNORE( SetSipInfoL( aSettingsId ) ); |
|
213 break; |
|
214 } |
|
215 case EPresence: |
|
216 { |
|
217 iPresenceId = aSettingsId; |
|
218 break; |
|
219 } |
|
220 case EDestination: |
|
221 { |
|
222 iDestinationId = aSettingsId; |
|
223 break; |
|
224 } |
|
225 default: |
|
226 break; |
|
227 } |
|
228 } |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // Finalizes settings saving. |
|
232 // --------------------------------------------------------------------------- |
|
233 // |
|
234 TInt CVoipXmlVoipHandler::FinalizeSettings() |
|
235 { |
|
236 TInt err( KErrNone ); |
|
237 TRAP( err, SetSpSettingsL() ); |
|
238 if ( KErrNone != err ) |
|
239 { |
|
240 // ParamHandler is only intrested in KErrNone and KErrCompletion. |
|
241 err = KErrCompletion; |
|
242 } |
|
243 if ( iDefault ) |
|
244 { |
|
245 TRAP_IGNORE( SetAsDefaultL() ); |
|
246 } |
|
247 return err; |
|
248 } |
|
249 |
|
250 // --------------------------------------------------------------------------- |
|
251 // Returns the service tab ID of this VoIP service. |
|
252 // --------------------------------------------------------------------------- |
|
253 // |
|
254 TUint32 CVoipXmlVoipHandler::ServiceTabIdL() |
|
255 { |
|
256 DBG_PRINT( "CVoipXmlVoipHandler::ServiceTabIdL begin" ); |
|
257 TInt tabId( KErrNone ); |
|
258 CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1 |
|
259 CSPProperty* property = CSPProperty::NewLC(); // CS:2 |
|
260 TInt err = spSettings->FindPropertyL( |
|
261 iServiceId, EPropertyContactViewId, *property ); |
|
262 User::LeaveIfError( property->GetValue( tabId ) ); |
|
263 CleanupStack::PopAndDestroy( 2, spSettings ); // CS:0 |
|
264 DBG_PRINT2( "CVoipXmlVoipHandler::ServiceTabIdL end (return %d)", tabId ); |
|
265 return (TUint32)tabId; |
|
266 } |
|
267 |
|
268 // --------------------------------------------------------------------------- |
|
269 // From class MSIPProfileRegistryObserver. |
|
270 // --------------------------------------------------------------------------- |
|
271 // |
|
272 void CVoipXmlVoipHandler::ProfileRegistryEventOccurred( |
|
273 TUint32 /*aSIPProfileId*/, TEvent /*aEvent*/ ) |
|
274 { |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // From class MSIPProfileRegistryObserver. |
|
279 // --------------------------------------------------------------------------- |
|
280 // |
|
281 void CVoipXmlVoipHandler::ProfileRegistryErrorOccurred( |
|
282 TUint32 /*aSIPProfileId*/, TInt /*aError*/ ) |
|
283 { |
|
284 } |
|
285 |
|
286 // --------------------------------------------------------------------------- |
|
287 // Sets VoIP core setting to temporary storage. |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 void CVoipXmlVoipHandler::SetCoreSettingL( TInt aParam, const TDesC& aValue ) |
|
291 { |
|
292 TInt intValue( KErrNotFound ); |
|
293 switch ( aParam ) |
|
294 { |
|
295 case EName: |
|
296 { |
|
297 TBuf<KMaxNodeValueLength> name( KNullDesC ); |
|
298 name.Copy( aValue ); |
|
299 TRAP_IGNORE( ValidateProfileNameL( name ) ); |
|
300 iEntry->iProviderName.Copy( name ); |
|
301 iEntry->iSettingsName.Copy( name ); |
|
302 iSettingsSet = ETrue; |
|
303 break; |
|
304 } |
|
305 case EStartPort: |
|
306 { |
|
307 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
308 { |
|
309 iEntry->iStartMediaPort = intValue; |
|
310 iSettingsSet = ETrue; |
|
311 } |
|
312 break; |
|
313 } |
|
314 case EEndPort: |
|
315 { |
|
316 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
317 { |
|
318 iEntry->iEndMediaPort = intValue; |
|
319 iSettingsSet = ETrue; |
|
320 } |
|
321 break; |
|
322 } |
|
323 case EMediaQos: |
|
324 { |
|
325 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
326 { |
|
327 iEntry->iMediaQOS = intValue; |
|
328 iSettingsSet = ETrue; |
|
329 } |
|
330 break; |
|
331 } |
|
332 case EDtmfInband: |
|
333 { |
|
334 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
335 { |
|
336 TEntryOnOff value; |
|
337 if ( !intValue ) |
|
338 { |
|
339 value = CRCSEProfileEntry::EOff; |
|
340 } |
|
341 else if ( KNotSet == intValue ) |
|
342 { |
|
343 value = CRCSEProfileEntry::EOONotSet; |
|
344 } |
|
345 else |
|
346 { |
|
347 value = CRCSEProfileEntry::EOn; |
|
348 } |
|
349 iEntry->iInbandDTMF = value; |
|
350 iSettingsSet = ETrue; |
|
351 } |
|
352 break; |
|
353 } |
|
354 case EDtmfOutband: |
|
355 { |
|
356 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
357 { |
|
358 TEntryOnOff value; |
|
359 if ( !intValue ) |
|
360 { |
|
361 value = CRCSEProfileEntry::EOff; |
|
362 } |
|
363 else if ( KErrNotFound == intValue ) |
|
364 { |
|
365 value = CRCSEProfileEntry::EOONotSet; |
|
366 } |
|
367 else |
|
368 { |
|
369 value = CRCSEProfileEntry::EOn; |
|
370 } |
|
371 iEntry->iOutbandDTMF = value; |
|
372 iSettingsSet = ETrue; |
|
373 } |
|
374 break; |
|
375 } |
|
376 case ESecureCallPreference: |
|
377 { |
|
378 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
379 { |
|
380 iEntry->iSecureCallPreference = intValue; |
|
381 iSettingsSet = ETrue; |
|
382 } |
|
383 break; |
|
384 } |
|
385 case EAllowVoipOverWcdma: |
|
386 { |
|
387 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
388 { |
|
389 TEntryOnOff value; |
|
390 if ( !intValue ) |
|
391 { |
|
392 value = CRCSEProfileEntry::EOff; |
|
393 } |
|
394 else if ( KErrNotFound == intValue ) |
|
395 { |
|
396 value = CRCSEProfileEntry::EOONotSet; |
|
397 } |
|
398 else |
|
399 { |
|
400 value = CRCSEProfileEntry::EOn; |
|
401 } |
|
402 iEntry->iAllowVoIPoverWCDMA = value; |
|
403 iSettingsSet = ETrue; |
|
404 } |
|
405 break; |
|
406 } |
|
407 case ERtcp: |
|
408 { |
|
409 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
410 { |
|
411 iEntry->iRTCP = intValue; |
|
412 iSettingsSet = ETrue; |
|
413 } |
|
414 break; |
|
415 } |
|
416 case EUserAgentHeaderTerminalType: |
|
417 { |
|
418 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
419 { |
|
420 iEntry->iSIPVoIPUAHTerminalType = intValue; |
|
421 iSettingsSet = ETrue; |
|
422 } |
|
423 break; |
|
424 } |
|
425 case EUserAgentHeaderWlanMac: |
|
426 { |
|
427 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
428 { |
|
429 iEntry->iSIPVoIPUAHeaderWLANMAC = intValue; |
|
430 iSettingsSet = ETrue; |
|
431 } |
|
432 break; |
|
433 } |
|
434 case EUserAgentHeaderFreeString: |
|
435 { |
|
436 if ( KMaxSettingsLength32 >= aValue.Length() ) |
|
437 { |
|
438 iEntry->iSIPVoIPUAHeaderString.Copy( aValue ); |
|
439 iSettingsSet = ETrue; |
|
440 } |
|
441 break; |
|
442 } |
|
443 case ECallerIdDigits: |
|
444 { |
|
445 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
446 { |
|
447 iEntry->iMeanCountOfVoIPDigits = intValue; |
|
448 iSettingsSet = ETrue; |
|
449 } |
|
450 break; |
|
451 } |
|
452 case EIgnoreDomainPart: |
|
453 { |
|
454 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
455 { |
|
456 iEntry->iIgnoreAddrDomainPart = intValue; |
|
457 iSettingsSet = ETrue; |
|
458 } |
|
459 break; |
|
460 } |
|
461 case EAutoAcceptBuddyRequests: |
|
462 { |
|
463 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
464 { |
|
465 iSpSettings.iAutoAcceptBuddies = (TBool)intValue; |
|
466 iSettingsSet = ETrue; |
|
467 } |
|
468 break; |
|
469 } |
|
470 case EAddUserPhone: |
|
471 { |
|
472 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
473 { |
|
474 TEntryOnOff value; |
|
475 if ( !intValue ) |
|
476 { |
|
477 value = CRCSEProfileEntry::EOff; |
|
478 } |
|
479 else if ( KErrNotFound == intValue ) |
|
480 { |
|
481 value = CRCSEProfileEntry::EOONotSet; |
|
482 } |
|
483 else |
|
484 { |
|
485 value = CRCSEProfileEntry::EOn; |
|
486 } |
|
487 iEntry->iUserPhoneUriParameter = value; |
|
488 iSettingsSet = ETrue; |
|
489 } |
|
490 break; |
|
491 } |
|
492 case EProviderUrl: |
|
493 { |
|
494 if ( !iSpSettings.iProviderUrl ) |
|
495 { |
|
496 iSpSettings.iProviderUrl = aValue.AllocL(); |
|
497 iSettingsSet = ETrue; |
|
498 } |
|
499 break; |
|
500 } |
|
501 case EMinSessionInterval: |
|
502 { |
|
503 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
504 { |
|
505 iEntry->iSIPMinSE = intValue; |
|
506 iSettingsSet = ETrue; |
|
507 } |
|
508 break; |
|
509 } |
|
510 case ESessionInterval: |
|
511 { |
|
512 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
513 { |
|
514 iEntry->iSIPSessionExpires = intValue; |
|
515 iSettingsSet = ETrue; |
|
516 } |
|
517 break; |
|
518 } |
|
519 case EBrandingUri: |
|
520 { |
|
521 if ( !iSpSettings.iBrandingUri ) |
|
522 { |
|
523 iSpSettings.iBrandingUri = aValue.AllocL(); |
|
524 iSettingsSet = ETrue; |
|
525 } |
|
526 break; |
|
527 } |
|
528 case EAutoEnable: |
|
529 { |
|
530 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
531 { |
|
532 iSpSettings.iAutoEnable = (TBool)intValue; |
|
533 iSettingsSet = ETrue; |
|
534 } |
|
535 break; |
|
536 } |
|
537 case EEnableSipIm: |
|
538 { |
|
539 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
540 { |
|
541 iSpSettings.iEnableSipIm = (TBool)intValue; |
|
542 iSettingsSet = ETrue; |
|
543 } |
|
544 break; |
|
545 } |
|
546 case EBrandId: |
|
547 { |
|
548 if ( !iSpSettings.iBrandId ) |
|
549 { |
|
550 iSpSettings.iBrandId = aValue.AllocL(); |
|
551 iSettingsSet = ETrue; |
|
552 } |
|
553 break; |
|
554 } |
|
555 case EDefault: |
|
556 { |
|
557 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
558 { |
|
559 iDefault = (TBool)intValue; |
|
560 iSettingsSet = ETrue; |
|
561 } |
|
562 break; |
|
563 } |
|
564 default: |
|
565 break; |
|
566 } |
|
567 } |
|
568 |
|
569 // --------------------------------------------------------------------------- |
|
570 // Sets codec setting to temporary storage. |
|
571 // --------------------------------------------------------------------------- |
|
572 // |
|
573 void CVoipXmlVoipHandler::SetCodecSettingL( TInt aParam, const TDesC& aValue ) |
|
574 { |
|
575 TInt intValue; |
|
576 switch ( aParam ) |
|
577 { |
|
578 // Codec parameters |
|
579 case EName: |
|
580 { |
|
581 if ( iCurrentCodec.iName ) |
|
582 { |
|
583 break; |
|
584 } |
|
585 TBuf<KMaxNodeValueLength> value; |
|
586 value.Copy( aValue ); |
|
587 value.UpperCase(); |
|
588 if ( 0 == value.Compare( KILbc ) ) |
|
589 { |
|
590 value.Copy( KAudioCodeciLBC ); |
|
591 } |
|
592 iCurrentCodec.iName = value.AllocL(); |
|
593 break; |
|
594 } |
|
595 case EJitterBuffer: |
|
596 { |
|
597 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
598 { |
|
599 iCurrentCodec.iJitterBuffer = intValue; |
|
600 } |
|
601 break; |
|
602 } |
|
603 case EOctetAlign: |
|
604 { |
|
605 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
606 { |
|
607 if ( !intValue ) |
|
608 { |
|
609 iCurrentCodec.iOctetAlign = CRCSEAudioCodecEntry::EOff; |
|
610 } |
|
611 else if ( KErrNotFound == intValue ) |
|
612 { |
|
613 iCurrentCodec.iOctetAlign = |
|
614 CRCSEAudioCodecEntry::EOONotSet; |
|
615 } |
|
616 else |
|
617 { |
|
618 iCurrentCodec.iOctetAlign = CRCSEAudioCodecEntry::EOn; |
|
619 } |
|
620 } |
|
621 break; |
|
622 } |
|
623 case EPTime: |
|
624 { |
|
625 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
626 { |
|
627 iCurrentCodec.iPtime = intValue; |
|
628 } |
|
629 break; |
|
630 } |
|
631 case EMaxPTime: |
|
632 { |
|
633 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
634 { |
|
635 iCurrentCodec.iMaxPtime = intValue; |
|
636 } |
|
637 break; |
|
638 } |
|
639 case EModeSet: |
|
640 { |
|
641 TBuf<KMaxNodeNameLength> string; |
|
642 string.Copy( aValue ); |
|
643 while ( string.Length() ) |
|
644 { |
|
645 TInt offset = string.Locate( KComma ); |
|
646 TBuf<KMaxNodeNameLength> helpString( KNullDesC ); |
|
647 if ( KErrNotFound == offset ) |
|
648 { |
|
649 if ( KErrNone == VoipXmlUtils::DesToInt( |
|
650 string, intValue ) ) |
|
651 { |
|
652 iCurrentCodec.iModeSet.AppendL( intValue ); |
|
653 } |
|
654 string.Zero(); |
|
655 } |
|
656 else if ( !offset ) |
|
657 { |
|
658 string.Delete( 0, 1 ); |
|
659 } |
|
660 else |
|
661 { |
|
662 helpString.Copy( string.Left( offset ) ); |
|
663 if ( KErrNone == VoipXmlUtils::DesToInt( helpString, |
|
664 intValue ) ) |
|
665 { |
|
666 iCurrentCodec.iModeSet.AppendL( intValue ); |
|
667 } |
|
668 offset++; |
|
669 string.Delete( 0, offset ); |
|
670 } |
|
671 } |
|
672 break; |
|
673 } |
|
674 case EModeChangePeriod: |
|
675 { |
|
676 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
677 { |
|
678 iCurrentCodec.iModeChangePeriod = intValue; |
|
679 } |
|
680 break; |
|
681 } |
|
682 case EModeChangeNeighbor: |
|
683 { |
|
684 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
685 { |
|
686 if ( !intValue ) |
|
687 { |
|
688 iCurrentCodec.iModeChangeNeighbor = |
|
689 CRCSEAudioCodecEntry::EOff; |
|
690 } |
|
691 else if ( KErrNotFound == intValue ) |
|
692 { |
|
693 iCurrentCodec.iModeChangeNeighbor = |
|
694 CRCSEAudioCodecEntry::EOONotSet; |
|
695 } |
|
696 else |
|
697 { |
|
698 iCurrentCodec.iModeChangeNeighbor = |
|
699 CRCSEAudioCodecEntry::EOn; |
|
700 } |
|
701 } |
|
702 break; |
|
703 } |
|
704 case EMaxRed: |
|
705 { |
|
706 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
707 { |
|
708 iCurrentCodec.iMaxRed = intValue; |
|
709 } |
|
710 break; |
|
711 } |
|
712 case EVad: |
|
713 { |
|
714 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
715 { |
|
716 if ( !intValue ) |
|
717 { |
|
718 iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOff; |
|
719 } |
|
720 else if ( KErrNotFound == intValue ) |
|
721 { |
|
722 iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOONotSet; |
|
723 } |
|
724 else |
|
725 { |
|
726 iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOn; |
|
727 } |
|
728 } |
|
729 break; |
|
730 } |
|
731 case EAnnexb: |
|
732 { |
|
733 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
734 { |
|
735 if ( !intValue ) |
|
736 { |
|
737 iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOff; |
|
738 } |
|
739 else if ( KErrNotFound == intValue ) |
|
740 { |
|
741 iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOONotSet; |
|
742 } |
|
743 else |
|
744 { |
|
745 iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOn; |
|
746 } |
|
747 } |
|
748 break; |
|
749 } |
|
750 default: |
|
751 break; |
|
752 } |
|
753 } |
|
754 |
|
755 // --------------------------------------------------------------------------- |
|
756 // Sets voice mailbox setting to temporary storage. |
|
757 // --------------------------------------------------------------------------- |
|
758 // |
|
759 void CVoipXmlVoipHandler::SetVmbxSettingL( TInt aParam, const TDesC& aValue ) |
|
760 { |
|
761 switch ( aParam ) |
|
762 { |
|
763 case EMwiUri: |
|
764 { |
|
765 if ( !iSpSettings.iMwiUri ) |
|
766 { |
|
767 iSpSettings.iMwiUri = aValue.AllocL(); |
|
768 } |
|
769 break; |
|
770 } |
|
771 case EListeningUri: |
|
772 { |
|
773 if ( !iSpSettings.iListeningUri ) |
|
774 { |
|
775 iSpSettings.iListeningUri = aValue.AllocL(); |
|
776 } |
|
777 break; |
|
778 } |
|
779 case EReSubscribeInterval: |
|
780 { |
|
781 TInt intValue; |
|
782 if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) ) |
|
783 { |
|
784 iSpSettings.iResubrcribe = intValue; |
|
785 } |
|
786 break; |
|
787 } |
|
788 default: |
|
789 break; |
|
790 } |
|
791 } |
|
792 |
|
793 // --------------------------------------------------------------------------- |
|
794 // Checks if name is unique and modifies if needed. |
|
795 // --------------------------------------------------------------------------- |
|
796 // |
|
797 void CVoipXmlVoipHandler::ValidateProfileNameL( TDes& aName ) |
|
798 { |
|
799 const TInt maxModifyLength = |
|
800 KMaxSettingsNameLength - KMaxProfileNameAppendLength; |
|
801 |
|
802 RArray<TUint32> voipIds; |
|
803 CleanupClosePushL( voipIds ); // CS:1 |
|
804 iRegistry->GetAllIdsL( voipIds ); |
|
805 |
|
806 const TInt count( voipIds.Count() ); |
|
807 |
|
808 HBufC* newName = HBufC::NewLC( KMaxSettingsNameLength ); // CS:2 |
|
809 newName->Des().Copy( aName.Left( maxModifyLength ) ); |
|
810 |
|
811 TUint i( 1 ); // Add number to the name if name already in use. |
|
812 |
|
813 // Go through each profile and see if the name of the new profile |
|
814 // matches one of the existing names. If it does change it and |
|
815 // check the new name again. |
|
816 for ( TInt index = 0; index < count; index++ ) |
|
817 { |
|
818 CRCSEProfileEntry* profile = CRCSEProfileEntry::NewLC(); // CS:3 |
|
819 TBuf<KMaxSettingsNameLength> loadedName; |
|
820 iRegistry->FindL( voipIds[index], *profile ); |
|
821 loadedName.Copy( profile->iSettingsName ); |
|
822 if ( 0 == newName->Des().Compare( loadedName ) ) |
|
823 { |
|
824 // If the name is changed we need to begin the comparison |
|
825 // again from the first profile. |
|
826 newName->Des().Copy( aName.Left( maxModifyLength ) ); |
|
827 newName->Des().Append( KOpenParenthesis() ); |
|
828 newName->Des().AppendNum( i ); |
|
829 newName->Des().Append( KClosedParenthesis() ); |
|
830 index = 0; |
|
831 i++; |
|
832 if ( KMaxProfileNames < i ) |
|
833 { |
|
834 User::Leave( KErrBadName ); |
|
835 } |
|
836 } |
|
837 CleanupStack::PopAndDestroy( profile ); // CS:2 |
|
838 } |
|
839 |
|
840 aName.Copy( *newName ); |
|
841 |
|
842 // newName, &voipIds |
|
843 CleanupStack::PopAndDestroy( 2, &voipIds ); // CS:0 |
|
844 } |
|
845 |
|
846 // --------------------------------------------------------------------------- |
|
847 // Sets temporary codec to RCSE. |
|
848 // --------------------------------------------------------------------------- |
|
849 // |
|
850 void CVoipXmlVoipHandler::SetCodecToRcseL() |
|
851 { |
|
852 // Nameless codecs are not supported. |
|
853 if ( !iCurrentCodec.iName ) |
|
854 { |
|
855 ResetTempCodec(); |
|
856 return; |
|
857 } |
|
858 |
|
859 CRCSEAudioCodecEntry* entry = CRCSEAudioCodecEntry::NewLC(); |
|
860 // First set default values... |
|
861 entry->SetDefaultCodecValueSet( iCurrentCodec.iName->Des() ); |
|
862 // ...and then replace them with the ones defined in settings XML. |
|
863 if ( KErrNotFound != iCurrentCodec.iJitterBuffer ) |
|
864 { |
|
865 entry->iJitterBufferSize = iCurrentCodec.iJitterBuffer; |
|
866 } |
|
867 if ( KErrNotFound != iCurrentCodec.iPtime ) |
|
868 { |
|
869 entry->iPtime = iCurrentCodec.iPtime; |
|
870 } |
|
871 if ( KErrNotFound != iCurrentCodec.iMaxPtime ) |
|
872 { |
|
873 entry->iMaxptime = iCurrentCodec.iMaxPtime; |
|
874 } |
|
875 if ( CRCSEAudioCodecEntry::EOONotSet != iCurrentCodec.iOctetAlign ) |
|
876 { |
|
877 entry->iOctetAlign = iCurrentCodec.iOctetAlign; |
|
878 } |
|
879 if ( CRCSEAudioCodecEntry::EOONotSet != |
|
880 iCurrentCodec.iModeChangeNeighbor ) |
|
881 { |
|
882 entry->iModeChangeNeighbor = iCurrentCodec.iModeChangeNeighbor; |
|
883 } |
|
884 if ( KErrNotFound != iCurrentCodec.iModeChangePeriod ) |
|
885 { |
|
886 entry->iModeChangePeriod = iCurrentCodec.iModeChangePeriod; |
|
887 } |
|
888 if ( KErrNotFound != iCurrentCodec.iMaxRed ) |
|
889 { |
|
890 entry->iMaxRed = iCurrentCodec.iMaxRed; |
|
891 } |
|
892 if ( CRCSEAudioCodecEntry::EOONotSet != iCurrentCodec.iVad ) |
|
893 { |
|
894 entry->iVAD = iCurrentCodec.iVad; |
|
895 } |
|
896 if ( CRCSEAudioCodecEntry::EOONotSet != iCurrentCodec.iAnnexb ) |
|
897 { |
|
898 entry->iAnnexb = iCurrentCodec.iAnnexb; |
|
899 } |
|
900 if ( iCurrentCodec.iModeSet.Count() ) |
|
901 { |
|
902 entry->iModeSet.Reset(); |
|
903 const TInt count = iCurrentCodec.iModeSet.Count(); |
|
904 for ( TInt counter = 0; counter < count; counter++ ) |
|
905 { |
|
906 entry->iModeSet.AppendL( iCurrentCodec.iModeSet[counter] ); |
|
907 } |
|
908 } |
|
909 |
|
910 TUint32 codecId = iCodecRegistry->AddL( *entry ); |
|
911 CleanupStack::PopAndDestroy( entry ); |
|
912 iEntry->iPreferredCodecs.AppendL( codecId ); |
|
913 ResetTempCodec(); |
|
914 } |
|
915 |
|
916 // --------------------------------------------------------------------------- |
|
917 // Resets temporary codec settings. |
|
918 // --------------------------------------------------------------------------- |
|
919 // |
|
920 void CVoipXmlVoipHandler::ResetTempCodec( TBool aCloseArray ) |
|
921 { |
|
922 if ( iCurrentCodec.iName ) |
|
923 { |
|
924 delete iCurrentCodec.iName; |
|
925 iCurrentCodec.iName = NULL; |
|
926 } |
|
927 iCurrentCodec.iJitterBuffer = KErrNotFound; |
|
928 iCurrentCodec.iOctetAlign = CRCSEAudioCodecEntry::EOONotSet; |
|
929 iCurrentCodec.iPtime = KErrNotFound; |
|
930 iCurrentCodec.iMaxPtime = KErrNotFound; |
|
931 iCurrentCodec.iModeChangePeriod = KErrNotFound; |
|
932 iCurrentCodec.iModeChangeNeighbor = CRCSEAudioCodecEntry::EOONotSet; |
|
933 iCurrentCodec.iMaxRed = KErrNotFound; |
|
934 iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOONotSet; |
|
935 iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOONotSet; |
|
936 iCurrentCodec.iModeSet.Reset(); |
|
937 if ( aCloseArray ) |
|
938 { |
|
939 iCurrentCodec.iModeSet.Close(); |
|
940 } |
|
941 } |
|
942 |
|
943 // --------------------------------------------------------------------------- |
|
944 // Resets temporary service provider settings. |
|
945 // --------------------------------------------------------------------------- |
|
946 // |
|
947 void CVoipXmlVoipHandler::ResetTempSpSettings() |
|
948 { |
|
949 iSpSettings.iAutoAcceptBuddies = EFalse; |
|
950 iSpSettings.iAutoEnable = EFalse; |
|
951 iSpSettings.iResubrcribe = KDefaultResubscribe; |
|
952 if ( iSpSettings.iBrandingUri ) |
|
953 { |
|
954 delete iSpSettings.iBrandingUri; |
|
955 iSpSettings.iBrandingUri = NULL; |
|
956 } |
|
957 if ( iSpSettings.iListeningUri ) |
|
958 { |
|
959 delete iSpSettings.iListeningUri; |
|
960 iSpSettings.iListeningUri = NULL; |
|
961 } |
|
962 if ( iSpSettings.iMwiUri ) |
|
963 { |
|
964 delete iSpSettings.iMwiUri; |
|
965 iSpSettings.iMwiUri = NULL; |
|
966 } |
|
967 if ( iSpSettings.iProviderUrl ) |
|
968 { |
|
969 delete iSpSettings.iProviderUrl; |
|
970 iSpSettings.iProviderUrl = NULL; |
|
971 } |
|
972 if ( iSpSettings.iBrandId ) |
|
973 { |
|
974 delete iSpSettings.iBrandId; |
|
975 iSpSettings.iBrandId = NULL; |
|
976 } |
|
977 } |
|
978 |
|
979 // --------------------------------------------------------------------------- |
|
980 // Sets SIP related VoIP settings. |
|
981 // --------------------------------------------------------------------------- |
|
982 // |
|
983 void CVoipXmlVoipHandler::SetSipInfoL( TUint32 aSipId ) |
|
984 { |
|
985 // First set SIP information to RCSE so that |
|
986 // an entry in service table will be created. |
|
987 TSettingIds settingIds; |
|
988 settingIds.iProfileType = CRCSEProfileEntry::EProtocolSIP; // SIP. |
|
989 settingIds.iProfileId = aSipId; |
|
990 // Never reference to profile specific settings. |
|
991 settingIds.iProfileSpecificSettingId = KNotSet; |
|
992 iEntry->iIds.AppendL( settingIds ); |
|
993 iRegistry->UpdateL( iEntry->iId, *iEntry ); |
|
994 |
|
995 // After update, we'll need to load the profile again from registry |
|
996 // so that we'll get all the values registry has added to the entry |
|
997 // (UpdateL takes entry as const reference). |
|
998 TUint32 profileId = iEntry->iId; |
|
999 iRegistry->FindL( profileId, *iEntry ); |
|
1000 iServiceId = iEntry->iServiceProviderId; |
|
1001 |
|
1002 // Compile and set User-Agent header. |
|
1003 CSIPManagedProfileRegistry* sipReg = CSIPManagedProfileRegistry::NewLC( |
|
1004 *this ); // CS:1 |
|
1005 CSIPManagedProfile* sipProf = static_cast<CSIPManagedProfile*>( |
|
1006 sipReg->ProfileL( aSipId ) ); |
|
1007 |
|
1008 if ( sipProf ) |
|
1009 { |
|
1010 CleanupStack::PushL( sipProf ); // CS:2 |
|
1011 |
|
1012 TBuf8<KMaxUserAgentHeaderLength> userAgentString( KNullDesC8 ); |
|
1013 |
|
1014 if ( iEntry->iSIPVoIPUAHTerminalType || |
|
1015 iEntry->iSIPVoIPUAHeaderWLANMAC || |
|
1016 iEntry->iSIPVoIPUAHeaderString.Length() != 0 ) |
|
1017 { |
|
1018 // Set this to be an user-agent param. |
|
1019 userAgentString.Append( KUserAgent ); |
|
1020 userAgentString.Append( KColon ); |
|
1021 userAgentString.Append( KSpace ); |
|
1022 |
|
1023 // Set terminal type if eanbled. |
|
1024 if ( iEntry->iSIPVoIPUAHTerminalType ) |
|
1025 { |
|
1026 CIpAppPhoneUtils* util = CIpAppPhoneUtils::NewLC(); // CS:3 |
|
1027 TBuf<KMaxTerminalTypeLength> terminalType( KNullDesC ); |
|
1028 util->GetTerminalTypeL( terminalType ); |
|
1029 userAgentString.Append( terminalType ); |
|
1030 userAgentString.Append( KSpace ); |
|
1031 CleanupStack::PopAndDestroy( util ); // CS:2 |
|
1032 } |
|
1033 |
|
1034 // Set WLAN MAC address if enabled. |
|
1035 if ( iEntry->iSIPVoIPUAHeaderWLANMAC ) |
|
1036 { |
|
1037 CIPAppUtilsAddressResolver* resolver = |
|
1038 CIPAppUtilsAddressResolver::NewLC(); // CS:3 |
|
1039 _LIT8( KFormatType, "-" ); |
|
1040 TBuf8<KMaxWlanMacAddressLength> wlanMACAddress( KNullDesC8 ); |
|
1041 resolver->GetWlanMACAddress( wlanMACAddress, KFormatType ); |
|
1042 userAgentString.Append( wlanMACAddress ); |
|
1043 userAgentString.Append( KSpace ); |
|
1044 CleanupStack::PopAndDestroy( resolver ); // CS:2 |
|
1045 } |
|
1046 |
|
1047 // Set free string if enabled. |
|
1048 if ( iEntry->iSIPVoIPUAHeaderString.Length() ) |
|
1049 { |
|
1050 userAgentString.Append( iEntry->iSIPVoIPUAHeaderString ); |
|
1051 } |
|
1052 } |
|
1053 |
|
1054 // Set new user agent header data to profile. |
|
1055 CDesC8ArrayFlat* array = new ( ELeave ) |
|
1056 CDesC8ArrayFlat( KUserAgentHeaderDataArrayInitSize ); |
|
1057 CleanupStack::PushL( array ); // CS:3 |
|
1058 array->AppendL( userAgentString ); |
|
1059 sipProf->SetParameter( KSIPHeaders, *array ); |
|
1060 sipReg->SaveL( *sipProf ); |
|
1061 // array, profile |
|
1062 CleanupStack::PopAndDestroy( 2, sipProf ); // CS:1 |
|
1063 } |
|
1064 CleanupStack::PopAndDestroy( sipReg ); // CS:0 |
|
1065 } |
|
1066 |
|
1067 // --------------------------------------------------------------------------- |
|
1068 // Sets SPSettings to service table. |
|
1069 // --------------------------------------------------------------------------- |
|
1070 // |
|
1071 void CVoipXmlVoipHandler::SetSpSettingsL() |
|
1072 { |
|
1073 TInt serviceId = iEntry->iServiceProviderId; |
|
1074 if ( 0 == serviceId || !iEntry->iIds.Count() ) |
|
1075 { |
|
1076 return; |
|
1077 } |
|
1078 CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1 |
|
1079 CSPProperty* property = CSPProperty::NewLC(); // CS:2 |
|
1080 |
|
1081 // ============================== |
|
1082 // Voice mailbox settings. |
|
1083 // ============================== |
|
1084 // |
|
1085 |
|
1086 TBool vmbx( EFalse ); |
|
1087 |
|
1088 // Set MWI URI if present. |
|
1089 //lint -e{960} No need for else statement here |
|
1090 if ( iSpSettings.iMwiUri ) |
|
1091 { |
|
1092 property->SetName( ESubPropertyVMBXMWIAddress ); |
|
1093 property->SetValue( iSpSettings.iMwiUri->Des() ); |
|
1094 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1095 // Set the same value to Listening URI if it has no value. |
|
1096 if ( !iSpSettings.iListeningUri ) |
|
1097 { |
|
1098 iSpSettings.iListeningUri = iSpSettings.iMwiUri->Des().AllocL(); |
|
1099 } |
|
1100 vmbx = ETrue; |
|
1101 } |
|
1102 // If there is no MWI URI but listening URI is present, set it as MWI URI. |
|
1103 else if ( iSpSettings.iListeningUri ) |
|
1104 { |
|
1105 property->SetName( ESubPropertyVMBXMWIAddress ); |
|
1106 property->SetValue( iSpSettings.iListeningUri->Des() ); |
|
1107 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1108 vmbx = ETrue; |
|
1109 } |
|
1110 |
|
1111 // Set Listening URI if present. This is a separate statement since |
|
1112 // the Listening URI may have been configured when setting MWI URI. |
|
1113 if ( iSpSettings.iListeningUri ) |
|
1114 { |
|
1115 property->SetName( ESubPropertyVMBXListenAddress ); |
|
1116 property->SetValue( iSpSettings.iListeningUri->Des() ); |
|
1117 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1118 vmbx = ETrue; |
|
1119 } |
|
1120 |
|
1121 if ( vmbx ) |
|
1122 { |
|
1123 property->SetName( ESubPropertyVMBXMWISubscribeInterval ); |
|
1124 property->SetValue( iSpSettings.iResubrcribe ); |
|
1125 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1126 |
|
1127 property->SetName( ESubPropertyVMBXSettingsId ); |
|
1128 property->SetValue( iEntry->iIds[0].iProfileId ); |
|
1129 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1130 } |
|
1131 |
|
1132 // ============================== |
|
1133 // "Core" Service Provider Settings. |
|
1134 // ============================== |
|
1135 // |
|
1136 |
|
1137 if ( iSpSettings.iProviderUrl ) |
|
1138 { |
|
1139 property->SetName( EPropertyServiceBookmarkUri ); |
|
1140 property->SetValue( iSpSettings.iProviderUrl->Des() ); |
|
1141 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1142 } |
|
1143 |
|
1144 if ( iSpSettings.iBrandingUri ) |
|
1145 { |
|
1146 property->SetName( ESubPropertyVoIPBrandDataUri ); |
|
1147 property->SetValue( iSpSettings.iBrandingUri->Des() ); |
|
1148 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1149 } |
|
1150 |
|
1151 if ( iPresenceId ) |
|
1152 { |
|
1153 property->SetName( ESubPropertyPresenceSettingsId ); |
|
1154 property->SetValue( iPresenceId ); |
|
1155 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1156 |
|
1157 // Converged Connection Handler (CCH) Presence Subservice plug-in UID |
|
1158 property->SetName( EPropertyPresenceSubServicePluginId ); |
|
1159 property->SetValue( KCCHPresenceSubServicePlugId ); |
|
1160 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1161 |
|
1162 // SIP IM enabled |
|
1163 if ( iSpSettings.iEnableSipIm ) |
|
1164 { |
|
1165 // Set IM as enabled. |
|
1166 property->SetName( ESubPropertyIMEnabled ); |
|
1167 property->SetValue( EOn ); |
|
1168 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1169 // Set IM launch UID. |
|
1170 property->SetName( ESubPropertyIMLaunchUid ); |
|
1171 property->SetValue( KIMLaunchUid ); |
|
1172 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1173 // The value only needs to be different from 0, |
|
1174 // no-one actually uses it. |
|
1175 property->SetName( ESubPropertyIMSettingsId ); |
|
1176 property->SetValue( KIMSettingsId ); |
|
1177 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1178 // Set IM plugin UID. |
|
1179 property->SetName( EPropertyIMSubServicePluginId ); |
|
1180 property->SetValue( KIMSubServicePluginId ); |
|
1181 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1182 // Set default IM tone. |
|
1183 TFileName toneFile; |
|
1184 toneFile.Copy( PathInfo::RomRootPath() ); |
|
1185 toneFile.Append( PathInfo::DigitalSoundsPath() ); |
|
1186 toneFile.Append( KDefaultTone ); |
|
1187 MVIMPSTSettingsStore* vimpStSettings = |
|
1188 CVIMPSTSettingsStore::NewLC(); // CS:3 |
|
1189 vimpStSettings->SetL( serviceId, |
|
1190 EServiceToneFileName, toneFile ); |
|
1191 // Pop vimpStSettings (can't use M object as argument). |
|
1192 CleanupStack::PopAndDestroy(); // CS:2 |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 if ( iSpSettings.iAutoAcceptBuddies ) |
|
1197 { |
|
1198 property->SetName( ESubPropertyPresenceRequestPreference ); |
|
1199 property->SetValue( EOn ); |
|
1200 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1201 } |
|
1202 |
|
1203 if ( iDestinationId ) |
|
1204 { |
|
1205 property->SetName( ESubPropertyVoIPPreferredSNAPId ); |
|
1206 property->SetValue( iDestinationId ); |
|
1207 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1208 if ( iSpSettings.iEnableSipIm ) |
|
1209 { |
|
1210 property->SetName( ESubPropertyIMPreferredSNAPId ); |
|
1211 property->SetValue( iDestinationId ); |
|
1212 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1213 } |
|
1214 } |
|
1215 |
|
1216 if ( iSpSettings.iBrandId ) |
|
1217 { |
|
1218 // Brand version. |
|
1219 property->SetName( EPropertyBrandVersion ); |
|
1220 property->SetValue( KBrandVersion ); |
|
1221 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1222 // Brand language. |
|
1223 property->SetName( EPropertyBrandLanguage ); |
|
1224 property->SetValue( ELangInternationalEnglish ); |
|
1225 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1226 // Brand ID. |
|
1227 property->SetName( EPropertyBrandId ); |
|
1228 property->SetValue( iSpSettings.iBrandId->Des() ); |
|
1229 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1230 } |
|
1231 |
|
1232 if ( iSpSettings.iAutoEnable ) |
|
1233 { |
|
1234 property->SetName( ESubPropertyVoIPEnabled ); |
|
1235 property->SetValue( EOn ); |
|
1236 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1237 // Also set voicemailbox on if it's defined. |
|
1238 if ( vmbx ) |
|
1239 { |
|
1240 property->SetName( ESubPropertyVMBXEnabled ); |
|
1241 property->SetValue( EOn ); |
|
1242 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1243 } |
|
1244 // Also set presence on if there is a presence link. |
|
1245 if ( iPresenceId ) |
|
1246 { |
|
1247 property->SetName( ESubPropertyPresenceEnabled ); |
|
1248 property->SetValue( EOn ); |
|
1249 spSettings->AddOrUpdatePropertyL( serviceId, *property ); |
|
1250 } |
|
1251 } |
|
1252 |
|
1253 // property, spSettings |
|
1254 CleanupStack::PopAndDestroy( 2, spSettings ); // CS:0 |
|
1255 } |
|
1256 |
|
1257 // --------------------------------------------------------------------------- |
|
1258 // Creates default codecs. |
|
1259 // --------------------------------------------------------------------------- |
|
1260 // |
|
1261 void CVoipXmlVoipHandler::AddDefaultCodecsL() |
|
1262 { |
|
1263 CRCSEAudioCodecEntry* codec = CRCSEAudioCodecEntry::NewLC(); |
|
1264 |
|
1265 TUint32 codecId( KErrNone ); |
|
1266 |
|
1267 codec->SetDefaultCodecValueSet( KAudioCodecAMRWB() ); |
|
1268 codecId = iCodecRegistry->AddL( *codec ); |
|
1269 iEntry->iPreferredCodecs.AppendL( codecId ); |
|
1270 |
|
1271 codec->SetDefaultCodecValueSet( KAudioCodecAMR() ); |
|
1272 codecId = iCodecRegistry->AddL( *codec ); |
|
1273 iEntry->iPreferredCodecs.AppendL( codecId ); |
|
1274 |
|
1275 codec->SetDefaultCodecValueSet( KAudioCodecPCMU() ); |
|
1276 codecId = iCodecRegistry->AddL( *codec ); |
|
1277 iEntry->iPreferredCodecs.AppendL( codecId ); |
|
1278 |
|
1279 codec->SetDefaultCodecValueSet( KAudioCodecPCMA() ); |
|
1280 codecId = iCodecRegistry->AddL( *codec ); |
|
1281 iEntry->iPreferredCodecs.AppendL( codecId ); |
|
1282 |
|
1283 codec->SetDefaultCodecValueSet( KAudioCodeciLBC() ); |
|
1284 codecId = iCodecRegistry->AddL( *codec ); |
|
1285 iEntry->iPreferredCodecs.AppendL( codecId ); |
|
1286 |
|
1287 codec->SetDefaultCodecValueSet( KAudioCodecG729() ); |
|
1288 codecId = iCodecRegistry->AddL( *codec ); |
|
1289 iEntry->iPreferredCodecs.AppendL( codecId ); |
|
1290 |
|
1291 codec->SetDefaultCodecValueSet( KAudioCodecCN() ); |
|
1292 codecId = iCodecRegistry->AddL( *codec ); |
|
1293 iEntry->iPreferredCodecs.AppendL( codecId ); |
|
1294 |
|
1295 CleanupStack::PopAndDestroy( codec ); |
|
1296 } |
|
1297 |
|
1298 // --------------------------------------------------------------------------- |
|
1299 // Sets the service as default service and preferred telephony as PS. |
|
1300 // --------------------------------------------------------------------------- |
|
1301 // |
|
1302 void CVoipXmlVoipHandler::SetAsDefaultL() |
|
1303 { |
|
1304 // Set the preferred service ID and preferred telephony as PS. |
|
1305 CRepository* repository = CRepository::NewL( KCRUidRichCallSettings ); |
|
1306 repository->Set( KRCSPSPreferredService, (TInt)iServiceId ); |
|
1307 repository->Set( KRCSEPreferredTelephony, 1 ); |
|
1308 delete repository; |
|
1309 } |
|
1310 |
|
1311 // End of File |
|