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