|
1 /* |
|
2 * Copyright (c) 2005-2007 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 * Version : %version: 42.1.4.1.3 % << Don't touch! Updated by Synergy at check-out. |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: Provide interface for the client requestin availability class. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include "musavaregisteravailability.h" |
|
22 #include "musavaavailabilityobserver.h" |
|
23 #include "musunittesting.h" |
|
24 #include "musavaobserver.h" |
|
25 #include "musavaavailability.h" |
|
26 #include "musavasharedobject.h" |
|
27 #include "muslogger.h" |
|
28 #include "musavasettingsimp.h" |
|
29 #include "musavasip.h" |
|
30 #include "musavaconnectionmonitor.h" |
|
31 #include "mussettings.h" |
|
32 #include "musavaclientresolverutil.h" |
|
33 |
|
34 #include <e32base.h> |
|
35 #include <sipprofile.h> |
|
36 #include <sipprofileregistry.h> |
|
37 #include <sipprofileregistryobserver.h> |
|
38 #include <escapeutils.h> |
|
39 |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // Symbian two-phase constructor |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 CMusAvaRegisterAvailability* CMusAvaRegisterAvailability::NewL( |
|
46 MMusAvaAvailabilityObserver& aObserver, |
|
47 CMusAvaSettingsImp& aSettings ) |
|
48 { |
|
49 CMusAvaRegisterAvailability* self = |
|
50 CMusAvaRegisterAvailability::NewLC( |
|
51 aObserver, |
|
52 aSettings ); |
|
53 CleanupStack::Pop( self ); |
|
54 return self; |
|
55 } |
|
56 |
|
57 |
|
58 // ---------------------------------------------------------------------------- |
|
59 // Two-phased constructor. |
|
60 // ---------------------------------------------------------------------------- |
|
61 // |
|
62 CMusAvaRegisterAvailability* CMusAvaRegisterAvailability::NewLC( |
|
63 MMusAvaAvailabilityObserver& aObserver, |
|
64 CMusAvaSettingsImp& aSettings ) |
|
65 { |
|
66 CMusAvaRegisterAvailability* self = |
|
67 new (ELeave) CMusAvaRegisterAvailability( |
|
68 aObserver, |
|
69 aSettings ); |
|
70 CleanupStack::PushL (self); |
|
71 self->ConstructL(); |
|
72 return self; |
|
73 } |
|
74 |
|
75 |
|
76 // ------------------------------------------------------------------------------ |
|
77 // Destructor. |
|
78 // ------------------------------------------------------------------------------ |
|
79 // |
|
80 CMusAvaRegisterAvailability::~CMusAvaRegisterAvailability() |
|
81 { |
|
82 if ( iSharedObj ) |
|
83 { |
|
84 iSharedObj->MusAvaSip().RemoveAdapter( *this ); |
|
85 iSharedObj->DeleteSingleton(); |
|
86 } |
|
87 } |
|
88 |
|
89 |
|
90 // ------------------------------------------------------------------------------ |
|
91 // Symbian 2nd phase constructor can leave. |
|
92 // ------------------------------------------------------------------------------ |
|
93 // |
|
94 void CMusAvaRegisterAvailability::ConstructL() |
|
95 { |
|
96 iSharedObj = CMusAvaSharedObject::GetSingletonL(); |
|
97 iSharedObj->MusAvaSip().AddAdapterL( *this ); |
|
98 iOperatorVariant = MultimediaSharingSettings::OperatorVariantSettingL(); |
|
99 } |
|
100 |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // Constructor. |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 CMusAvaRegisterAvailability::CMusAvaRegisterAvailability( |
|
107 MMusAvaAvailabilityObserver& aObserver, |
|
108 CMusAvaSettingsImp& aSettings ) |
|
109 :CMusAvaAvailability( aObserver ), |
|
110 iSettings( aSettings ) |
|
111 { |
|
112 } |
|
113 |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // Executes for the master - salve pattern. |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 void CMusAvaRegisterAvailability::DoExecuteL() |
|
120 { |
|
121 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::DoExecuteL " ) |
|
122 SetState( MMusAvaObserver::EMusAvaStatusInProgress ); |
|
123 RegisterL(); |
|
124 // TBD: SetState( MMusAvaObserver::EMusAvaNameRegistration ); |
|
125 |
|
126 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::DoExecuteL " ) |
|
127 } |
|
128 |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // Stop the execution. |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 void CMusAvaRegisterAvailability::Stop() |
|
135 { |
|
136 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::Stop" ) |
|
137 CSIPProfile* profile = iSharedObj->MusAvaSip().Profile(); |
|
138 if ( profile ) |
|
139 { |
|
140 CSIPProfileRegistry* registry = NULL; // not own, so not deleted |
|
141 TRAPD( error_register, registry = |
|
142 &iSharedObj->MusAvaSip().ProfileRegistryL() ); |
|
143 if ( error_register == KErrNone ) |
|
144 { |
|
145 MUS_LOG( "mus: [MUSAVA] Sip profile registry found" ) |
|
146 TInt error = registry->Disable( *profile ); |
|
147 MUS_LOG1( "mus: [MUSAVA] Disable Sip profile ( %d )", error ) |
|
148 } |
|
149 } |
|
150 |
|
151 SetState( MMusAvaObserver::EMusAvaStatusNotExecuted ); |
|
152 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::Stop" ) |
|
153 } |
|
154 |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CMusAvaRegisterAvailability::Name |
|
158 // |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 MMusAvaObserver::TAvailabilityName CMusAvaRegisterAvailability::Name() |
|
162 { |
|
163 return MMusAvaObserver::EMusAvaNameRegistration; |
|
164 } |
|
165 |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // An event related to SIP Profile has accorred |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 void CMusAvaRegisterAvailability::ProfileRegistryEventOccurred( |
|
172 TUint32 aProfileId, |
|
173 MSIPProfileRegistryObserver::TEvent aEvent) |
|
174 { |
|
175 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::\ |
|
176 ProfileRegistryEventOccurred " ) |
|
177 |
|
178 CSIPProfile* profile = iSharedObj->MusAvaSip().Profile(); |
|
179 if ( !profile ) |
|
180 { |
|
181 MUS_LOG( "mus: [MUSAVA] no sip profile found, returning!" ) |
|
182 return; |
|
183 } |
|
184 |
|
185 |
|
186 TUint32 profileId = 0; |
|
187 TUint connectionId = 0; |
|
188 |
|
189 profile->GetParameter( KSIPProfileId, profileId ); |
|
190 |
|
191 if ( aProfileId == profileId ) |
|
192 { |
|
193 switch (aEvent) |
|
194 { |
|
195 case MSIPProfileRegistryObserver::EProfileCreated: |
|
196 { |
|
197 MUS_LOG( "mus: [MUSAVA] Profile is created" ) |
|
198 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability\ |
|
199 ::ProfileRegistryEventOccurred" ) |
|
200 } |
|
201 break; |
|
202 |
|
203 case MSIPProfileRegistryObserver::EProfileUpdated: |
|
204 { |
|
205 MUS_LOG( "mus: [MUSAVA] Profile is updated" ) |
|
206 } |
|
207 break; |
|
208 |
|
209 case MSIPProfileRegistryObserver::EProfileRegistered: |
|
210 { |
|
211 MUS_LOG( "mus: [MUSAVA] Profile is registred" ) |
|
212 |
|
213 // Make sure that valid connection exists when registered |
|
214 CSIPConnection* sipConnection = NULL; |
|
215 TRAPD( err, sipConnection = iSharedObj->MusAvaSip().ConnectionL() ); |
|
216 if ( err != KErrNone || |
|
217 !sipConnection || |
|
218 sipConnection->State() == CSIPConnection::EUnavailable || |
|
219 sipConnection->State() == CSIPConnection::ESuspended || |
|
220 sipConnection->State() == CSIPConnection::EInactive ) |
|
221 { |
|
222 MUS_LOG1( "mus: [MUSAVA] CreateSIPConnectionL \ |
|
223 leave #%d", err ) |
|
224 SetState( MMusAvaObserver::MMusAvaObserver::EMusAvaConnectionErr ); |
|
225 } |
|
226 else |
|
227 { |
|
228 TRAP( err, connectionId = |
|
229 iSharedObj->ConnectionMonitor().ConnectionIDL() ); |
|
230 if ( err == KErrNotFound ) |
|
231 { |
|
232 SetState( MMusAvaObserver::EMusAvaConnectionErr ); |
|
233 } |
|
234 else |
|
235 { |
|
236 iSharedObj->ConnectionMonitor().SetConnectionID( |
|
237 connectionId ); |
|
238 if( err != KErrNone ) |
|
239 { |
|
240 MUS_LOG1( "mus: [MUSAVA] ConnectionIdL \ |
|
241 leave #%d", err ) |
|
242 } |
|
243 } |
|
244 } |
|
245 |
|
246 MUS_LOG( "mus: [MUSAVA] Enable profile." ) |
|
247 TRAP( err, EnableRegisterL() ); |
|
248 if( err != KErrNone ) |
|
249 { |
|
250 MUS_LOG1( "mus: [MUSAVA] EnableRegisterL leave #%d", |
|
251 err ) |
|
252 } |
|
253 |
|
254 TRAP( err, CreateSipAddressProposalL(); ); |
|
255 if( err != KErrNone ) |
|
256 { |
|
257 MUS_LOG1( "mus: [MUSAVA] CreateSipAddressProposalL \ |
|
258 err #%d", err ) |
|
259 } |
|
260 |
|
261 SetState( MMusAvaObserver::EMusAvaStatusAvailable ); |
|
262 |
|
263 // update sipprofile in settings |
|
264 if ( profileId != iSettings.SipProfileId() ) |
|
265 { |
|
266 MUS_LOG1( "mus: [MUSAVA] Profile id in settings before\ |
|
267 update:%d", iSettings.SipProfileId() ) |
|
268 iSettings.SetSipProfileId( profileId ); |
|
269 MUS_LOG1( "mus: [MUSAVA] Profile id in settings after\ |
|
270 update:%d", iSettings.SipProfileId() ) |
|
271 } |
|
272 else |
|
273 { |
|
274 MUS_LOG( "Profile is not needed to update!!!!!" ) |
|
275 } |
|
276 } |
|
277 break; |
|
278 |
|
279 case MSIPProfileRegistryObserver::EProfileDeregistered: |
|
280 { |
|
281 MUS_LOG( "mus: [MUSAVA] Profile is deregistered" ) |
|
282 SetState( MMusAvaObserver::EMusAvaStatusNotRegistered ); |
|
283 iSharedObj->MusAvaSip().DeleteSIPConnection(); |
|
284 } |
|
285 break; |
|
286 |
|
287 case MSIPProfileRegistryObserver::EProfileDestroyed: |
|
288 { |
|
289 MUS_LOG( "mus: [MUSAVA] Profile is destroyed " ) |
|
290 SetState( MMusAvaObserver::EMusAvaStatusNotRegistered ); |
|
291 } |
|
292 break; |
|
293 |
|
294 default: |
|
295 MUS_LOG( "mus: [MUSAVA] Unknown Profile Id" ) |
|
296 break; |
|
297 } |
|
298 } |
|
299 else |
|
300 { |
|
301 MUS_LOG( "mus: [MUSAVA] aProfileId != profileId" ) |
|
302 } |
|
303 |
|
304 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::\ |
|
305 ProfileRegistryEventOccurred" ) |
|
306 } |
|
307 |
|
308 // ----------------------------------------------------------------------------- |
|
309 // An asynchronous error has occurred related to SIP profile |
|
310 // Event is send to those observers, who have the |
|
311 // corresponding profile instantiated. |
|
312 // ----------------------------------------------------------------------------- |
|
313 // |
|
314 void CMusAvaRegisterAvailability::ProfileRegistryErrorOccurred( |
|
315 TUint32 aProfileId, |
|
316 TInt aError ) |
|
317 { |
|
318 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::\ |
|
319 ProfileRegistryErrorOccurred" ) |
|
320 |
|
321 CSIPProfile* profile = iSharedObj->MusAvaSip().Profile(); |
|
322 if ( !profile ) |
|
323 { |
|
324 return; |
|
325 } |
|
326 |
|
327 TUint32 profileId; |
|
328 |
|
329 profile->GetParameter( KSIPProfileId, profileId ); |
|
330 |
|
331 if( profileId == aProfileId ) |
|
332 { |
|
333 if ( iOperatorVariant == MusSettingsKeys::EOperatorSpecific && |
|
334 aError == KErrGeneral ) |
|
335 { |
|
336 MUS_LOG( "SIP profile is disabled by the user" ) |
|
337 SetState( MMusAvaObserver::EMusActivationError ); |
|
338 } |
|
339 else |
|
340 { |
|
341 MUS_LOG1("Error %d",aError ) |
|
342 SetState( MMusAvaObserver::EMusAvaStatusNotRegistered ); |
|
343 } |
|
344 } |
|
345 |
|
346 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::\ |
|
347 ProfileRegistryErrorOccurred" ) |
|
348 } |
|
349 |
|
350 |
|
351 // ----------------------------------------------------------------------------- |
|
352 // |
|
353 // ----------------------------------------------------------------------------- |
|
354 // |
|
355 void CMusAvaRegisterAvailability::CreateSipAddressProposalL() |
|
356 { |
|
357 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::\ |
|
358 CreateSipAddressProposalL() " ) |
|
359 |
|
360 HBufC* domain = iSharedObj->MusAvaSip().OwnDomainLC(); |
|
361 |
|
362 const TDesC& telNumber = iSettings.TelNumber(); |
|
363 |
|
364 iSettings.SetSipAddressProposalL( telNumber, *domain ); |
|
365 |
|
366 CleanupStack::PopAndDestroy( domain ); |
|
367 |
|
368 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::\ |
|
369 CreateSipAddressProposalL() " ) |
|
370 } |
|
371 |
|
372 |
|
373 // ----------------------------------------------------------------------------- |
|
374 // Connection state has changed. |
|
375 // iSipConnection has to be instantiated for us to get these callbacks. |
|
376 // from base class MSIPConnectionObserver |
|
377 // ----------------------------------------------------------------------------- |
|
378 // |
|
379 TInt CMusAvaRegisterAvailability::ConnectionStateChanged( |
|
380 CSIPConnection::TState aState ) |
|
381 { |
|
382 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::\ |
|
383 ConnectionStateChanged" ) |
|
384 TInt err = 0; |
|
385 switch ( aState ) |
|
386 { |
|
387 case CSIPConnection::EInit: |
|
388 { |
|
389 MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::EInit" ) |
|
390 break; |
|
391 } |
|
392 case CSIPConnection::EActive: |
|
393 { |
|
394 MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::EActive" ) |
|
395 break; |
|
396 } |
|
397 case CSIPConnection::ESuspended: |
|
398 { |
|
399 MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::ESuspended" ) |
|
400 SetState( MMusAvaObserver::EMusAvaConnectionErr ); |
|
401 break; |
|
402 } |
|
403 case CSIPConnection::EInactive: |
|
404 { |
|
405 MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::EInactive" ) |
|
406 // If we get here, then PDP context is probably |
|
407 // unavailable => close an existing PDP context. |
|
408 MUS_LOG( "mus: [MUSAVA] now calling CloseExistingConnectionL" ) |
|
409 iSharedObj->ConnectionMonitor().KillPdpContext(); |
|
410 TRAPD( leaveCode, err = RegisterL() ) |
|
411 if ( !leaveCode || err ) |
|
412 { |
|
413 SetState( MMusAvaObserver::EMusAvaConnectionErr ); |
|
414 } |
|
415 else |
|
416 { |
|
417 SetState( MMusAvaObserver::EMusAvaStatusAvailable ); |
|
418 } |
|
419 break; |
|
420 } |
|
421 case CSIPConnection::EUnavailable: |
|
422 { |
|
423 MUS_LOG( "mus: [MUSAVA] aState == CSIPConnection::EUnavailable" ) |
|
424 SetState( MMusAvaObserver::EMusAvaConnectionErr ); |
|
425 break; |
|
426 } |
|
427 default: |
|
428 { |
|
429 MUS_LOG( "mus: [MUSAVA] in default branch => ESipConnUnknown" ) |
|
430 break; |
|
431 } |
|
432 } |
|
433 |
|
434 MUS_LOG( "mus: [MUSAVA]: <- CMusAvaRegisterAvailability::ConnectionStateChanged" ) |
|
435 |
|
436 return ETrue; |
|
437 } |
|
438 |
|
439 // ----------------------------------------------------------------------------- |
|
440 // Initialize SIP Registration. |
|
441 // ----------------------------------------------------------------------------- |
|
442 // |
|
443 TBool CMusAvaRegisterAvailability::InitializeRegister() |
|
444 { |
|
445 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::\ |
|
446 InitializeRegister " ) |
|
447 |
|
448 MUS_LOG( "mus: [MUSAVA] Create SIP Profile " ) |
|
449 TBool profileCreated = EFalse; |
|
450 TRAPD( err, profileCreated = iSharedObj->MusAvaSip().CreateProfileL() ); |
|
451 if ( err || !profileCreated ) |
|
452 { |
|
453 MUS_LOG( "mus: [MUSAVA] Profile is not created " ) |
|
454 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::\ |
|
455 InitializeRegister " ) |
|
456 SetState( MMusAvaObserver::EMusAvaStatusNoSipProfile ); |
|
457 return EFalse; |
|
458 } |
|
459 |
|
460 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::\ |
|
461 InitializeRegister " ) |
|
462 |
|
463 return ETrue; |
|
464 } |
|
465 |
|
466 |
|
467 // ----------------------------------------------------------------------------- |
|
468 // SIP Registration. |
|
469 // ----------------------------------------------------------------------------- |
|
470 // |
|
471 TBool CMusAvaRegisterAvailability::RegisterL() |
|
472 { |
|
473 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::RegisterL " ) |
|
474 |
|
475 MUS_LOG( "mus: [MUSAVA] Checks if the profile is not enabled - \ |
|
476 Enable" ) |
|
477 if ( !InitializeRegister()) |
|
478 { |
|
479 MUS_LOG( "mus: [MUSAVA] SIP register initilisation fails " ) |
|
480 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::\ |
|
481 Register " ) |
|
482 return EFalse; |
|
483 } |
|
484 |
|
485 EnableRegisterL(); |
|
486 if ( !UpdateSIPProfile() ) |
|
487 { |
|
488 return EFalse; |
|
489 } |
|
490 return RegistrationStatusL(); |
|
491 } |
|
492 |
|
493 // ----------------------------------------------------------------------------- |
|
494 // Enable SIP Registration. |
|
495 // ----------------------------------------------------------------------------- |
|
496 // |
|
497 void CMusAvaRegisterAvailability::EnableRegisterL() |
|
498 { |
|
499 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::EnableRegisterL " ) |
|
500 MUS_LOG( "mus: [MUSAVA] Fetch SIP ProfileRegistry" ) |
|
501 |
|
502 CSIPProfileRegistry& registry = iSharedObj->MusAvaSip().ProfileRegistryL(); |
|
503 MUS_LOG( "mus: [MUSAVA] Profile status" ) |
|
504 if ( !registry.IsEnabled( *iSharedObj->MusAvaSip().Profile() ) ) |
|
505 { |
|
506 MUS_LOG("mus: [MUSAVA] Calling EnableL()" ) |
|
507 registry.EnableL( *iSharedObj->MusAvaSip().Profile(), |
|
508 iSharedObj->MusAvaSip().ConnectionObserver() ); |
|
509 } |
|
510 |
|
511 // Try to write client information to CenRep of client resolver. |
|
512 // This functionality is needed in __VOIP enabled terminals. |
|
513 // In __VOIP disabled builds this will fail because of a lack of needed |
|
514 // CenRep UID. To avoid branching, we just try to do this and let it fail |
|
515 // in normal build. |
|
516 CMusAvaClientResolverUtil* resolver = |
|
517 iSharedObj->MusAvaSip().ClientResolverUtil(); |
|
518 if ( resolver ) |
|
519 { |
|
520 TRAP_IGNORE( resolver->RegisterClientWithUserL( |
|
521 *iSharedObj->MusAvaSip().Profile() ) ) |
|
522 } |
|
523 |
|
524 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::EnableRegisterL " ) |
|
525 } |
|
526 |
|
527 |
|
528 // ----------------------------------------------------------------------------- |
|
529 // Update SIP Registration. |
|
530 // ----------------------------------------------------------------------------- |
|
531 // |
|
532 TBool CMusAvaRegisterAvailability::UpdateSIPProfile() |
|
533 { |
|
534 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::UpdateSIPProfile " ) |
|
535 TUint32 profileId = 0; // Initial value doesn't matter. |
|
536 // but better to set it to default profile |
|
537 TInt err = iSharedObj->MusAvaSip().Profile()->GetParameter( |
|
538 KSIPProfileId, profileId ); |
|
539 if( err == KErrNone) |
|
540 { |
|
541 MUS_LOG1("mus: [MUSAVA] Set SIP Profile ID in Central Repositary \ |
|
542 to %d",profileId ) |
|
543 iSettings.SetSipProfileId( profileId ); |
|
544 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::UpdateSIPProfile " ) |
|
545 return ETrue; |
|
546 } |
|
547 else |
|
548 { |
|
549 MUS_LOG1("mus: [MUSAVA] SIP Profile ID is not found. \ |
|
550 remove Id away from Central Repositary %d",err ) |
|
551 iSettings.SetSipProfileId( err ); |
|
552 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::UpdateSIPProfile " ) |
|
553 return EFalse; |
|
554 } |
|
555 } |
|
556 |
|
557 // ----------------------------------------------------------------------------- |
|
558 // SIP profile Registration status. |
|
559 // ----------------------------------------------------------------------------- |
|
560 // |
|
561 TBool CMusAvaRegisterAvailability::RegistrationStatusL() |
|
562 { |
|
563 MUS_LOG( "mus: [MUSAVA] -> CMusAvaRegisterAvailability::RegistrationStatusL " ) |
|
564 MUS_LOG("mus: [MUSAVA] Checking profile registration" ) |
|
565 |
|
566 TBool registered; |
|
567 |
|
568 TInt err = iSharedObj->MusAvaSip().Profile()->GetParameter( |
|
569 KSIPProfileRegistered, registered ); |
|
570 |
|
571 if( err != KErrNone || !registered ) |
|
572 { |
|
573 MUS_LOG2( "mus: [MUSAVA] Profile not registered, get error=%d, \ |
|
574 register value=%d", err, registered ) |
|
575 |
|
576 SetState( MMusAvaObserver::EMusAvaStatusInProgress ); |
|
577 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::RegistrationStatusL " ) |
|
578 return EFalse; |
|
579 } |
|
580 else |
|
581 { |
|
582 MUS_LOG("mus: [MUSAVA] profile is registred " ) |
|
583 |
|
584 iSharedObj->MusAvaSip().ConnectionL(); |
|
585 |
|
586 MUS_LOG("mus: [MUSAVA] connection created " ) |
|
587 |
|
588 HBufC* domain = iSharedObj->MusAvaSip().OwnDomainLC(); |
|
589 const TDesC& telNumber = iSettings.TelNumber(); |
|
590 |
|
591 iSettings.SetSipAddressProposalL( telNumber, *domain ); |
|
592 |
|
593 CleanupStack::PopAndDestroy( domain ); |
|
594 SetState( MMusAvaObserver::EMusAvaStatusAvailable ); |
|
595 MUS_LOG( "mus: [MUSAVA] <- CMusAvaRegisterAvailability::RegistrationStatusL " ) |
|
596 return ETrue; |
|
597 } |
|
598 } |
|
599 |