|
1 |
|
2 // Copyright (c) 2004-2009 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: |
|
15 // INCLUDE FILES |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 #include "SIPExSIPEngine.h" |
|
21 #include "SIPExSIPStateBase.h" |
|
22 |
|
23 #include <uri8.h> |
|
24 #include <sipstrings.h> |
|
25 #include <sipstrconsts.h> |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 _LIT8( KSdpNoInfoDesC8, "-" ); |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CSIPExSIPEngine::NewL |
|
35 // Two-phased constructor. |
|
36 // ----------------------------------------------------------------------------- |
|
37 EXPORT_C CSIPExSIPEngine* CSIPExSIPEngine::NewL( |
|
38 TUid aAppUid, |
|
39 MSIPExSIPEngineObserver* aObserver ) |
|
40 { |
|
41 CSIPExSIPEngine* self = new( ELeave ) CSIPExSIPEngine(); |
|
42 CleanupStack::PushL( self ); |
|
43 self->ConstructL( aAppUid, aObserver ); |
|
44 CleanupStack::Pop( self ); |
|
45 |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // Destructor. |
|
52 // ----------------------------------------------------------------------------- |
|
53 CSIPExSIPEngine::~CSIPExSIPEngine() |
|
54 { |
|
55 SdpCodecStringPool::Close(); |
|
56 |
|
57 delete iIdle; |
|
58 delete iClientEstablishing; |
|
59 delete iClientOffering; |
|
60 delete iServerOffering; |
|
61 delete iServerEstablishing; |
|
62 delete iEstablished; |
|
63 delete iTerminating; |
|
64 |
|
65 delete iClientTx; |
|
66 delete iServerTx; |
|
67 |
|
68 delete iDialogAssoc; |
|
69 |
|
70 delete iConnection; |
|
71 delete iProfile; |
|
72 delete iProfileRegistry; |
|
73 delete iSIP; |
|
74 } |
|
75 |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CSIPExSIPEngine::CSIPExSIPEngine |
|
79 // C++ default constructor. |
|
80 // ----------------------------------------------------------------------------- |
|
81 CSIPExSIPEngine::CSIPExSIPEngine() |
|
82 { |
|
83 } |
|
84 |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CSIPExSIPEngine::ConstructL |
|
88 // Symbian 2nd phase constructor. Can leave. |
|
89 // ----------------------------------------------------------------------------- |
|
90 void CSIPExSIPEngine::ConstructL( |
|
91 TUid aAppUid, |
|
92 MSIPExSIPEngineObserver* aObserver ) |
|
93 { |
|
94 // Make note of the observer class. |
|
95 iObserver = aObserver; |
|
96 |
|
97 // Create instances of the CSIP and Profile Registry classes |
|
98 iSIP = CSIP::NewL( aAppUid, *this ); |
|
99 iProfileRegistry = CSIPProfileRegistry::NewL( *iSIP, *this ); |
|
100 |
|
101 // Open SDP Codec String Pool |
|
102 StringPoolL(); |
|
103 |
|
104 // Set our local address |
|
105 const TUint32 KInetAddr = INET_ADDR(127,0,0,1); |
|
106 iLocalAddr.SetAddress( KInetAddr ); |
|
107 |
|
108 // Set up the state machine |
|
109 // Create instances of the state classes. |
|
110 iIdle = CSIPExSIPIdleState::NewL(); |
|
111 iClientEstablishing = CSIPExSIPClientEstablishingState::NewL(); |
|
112 iClientOffering = CSIPExSIPClientOfferingState::NewL(); |
|
113 iServerOffering = CSIPExSIPServerOfferingState::NewL(); |
|
114 iServerEstablishing = CSIPExSIPServerEstablishingState::NewL(); |
|
115 iEstablished = CSIPExSIPEstablishedState::NewL(); |
|
116 iTerminating = CSIPExSIPTerminatingState::NewL(); |
|
117 |
|
118 // Create the links for state transitions. |
|
119 iIdle->LinkStates( *iClientEstablishing, *iServerOffering ); |
|
120 iClientEstablishing->LinkStates( *iIdle, *iClientOffering, *iEstablished ); |
|
121 iClientOffering->LinkStates( *iIdle, *iEstablished, *iIdle ); |
|
122 iServerOffering->LinkStates( *iServerEstablishing, *iIdle ); |
|
123 iServerEstablishing->LinkStates( *iEstablished, *iIdle ); |
|
124 iEstablished->LinkStates( *iTerminating, *iIdle ); |
|
125 iTerminating->LinkStates( *iIdle ); |
|
126 |
|
127 // Set current state data |
|
128 iCurrentState = iIdle; |
|
129 iConnState = CSIPConnection::EInactive; |
|
130 } |
|
131 |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CSIPExSIPEngine::EnableProfileL |
|
135 // First get the default profile from the registry, then, if it is |
|
136 // an IETF profile, enable it. |
|
137 // If non-IETF profile is default, call error callback with KErrNotSupported |
|
138 // and leave |
|
139 // Not part of the state machine. |
|
140 // ----------------------------------------------------------------------------- |
|
141 EXPORT_C TBool CSIPExSIPEngine::EnableProfileL() |
|
142 { |
|
143 // Check for existing profile |
|
144 if ( iProfile ) |
|
145 { |
|
146 delete iProfile; |
|
147 iProfile = NULL; |
|
148 } |
|
149 TBool registered( EFalse ); |
|
150 |
|
151 // Leaves with KErrNotFound if default profile is not found |
|
152 iProfile = iProfileRegistry->DefaultProfileL(); |
|
153 |
|
154 // Safety check that DefaultProfile() didn't return NULL pointer. |
|
155 if ( !iProfile ) |
|
156 { |
|
157 iObserver->ProfileError( KErrNotFound ); |
|
158 _LIT8( KProfileError, "Profile not found. Define a profile:"); |
|
159 iObserver->WriteLog(KProfileError()); |
|
160 User::Leave( KErrNotFound ); |
|
161 } |
|
162 // Leaves if profile type is not EInternet |
|
163 else if ( iProfile->Type().iSIPProfileClass != TSIPProfileTypeInfo::EInternet ) |
|
164 { |
|
165 delete iProfile; |
|
166 iProfile = NULL; |
|
167 iObserver->ProfileError( KErrNotSupported ); |
|
168 User::Leave( KErrNotSupported ); |
|
169 } |
|
170 else |
|
171 { |
|
172 const TDesC8* aor = NULL; |
|
173 iProfile->GetParameter( KSIPUserAor, aor ); |
|
174 iObserver->WriteLog( *aor ); |
|
175 iProfileRegistry->EnableL( *iProfile, *this ); |
|
176 |
|
177 // check whether profile was immediately set to registered state |
|
178 iProfile->GetParameter( KSIPProfileRegistered, registered ); |
|
179 } |
|
180 |
|
181 return registered; |
|
182 } |
|
183 |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CSIPExSIPEngine::DisableProfileL |
|
187 // Disable the profile given as a parameter. |
|
188 // Not part of the state machine. |
|
189 // ----------------------------------------------------------------------------- |
|
190 EXPORT_C void CSIPExSIPEngine::DisableProfileL() |
|
191 { |
|
192 if ( iProfile ) |
|
193 { |
|
194 iProfileRegistry->Disable( *iProfile ); |
|
195 delete iProfile; |
|
196 iProfile = NULL; |
|
197 } |
|
198 } |
|
199 |
|
200 |
|
201 // ----------------------------------------------------------------------------- |
|
202 // CSIPExSIPEngine::SendInviteL |
|
203 // Send INVITE to the remote peer given as a parameter. |
|
204 // ----------------------------------------------------------------------------- |
|
205 EXPORT_C void CSIPExSIPEngine::SendInviteL( const TDesC8& aSipUri ) |
|
206 { |
|
207 iCurrentState->SendInviteL( *this, aSipUri ); |
|
208 } |
|
209 |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CSIPExSIPEngine::CancelInvite |
|
213 // CANCEL a previously sent INVITE. |
|
214 // ----------------------------------------------------------------------------- |
|
215 EXPORT_C void CSIPExSIPEngine::CancelInviteL() |
|
216 { |
|
217 iCurrentState->CancelInviteL( *this ); |
|
218 } |
|
219 |
|
220 |
|
221 // ----------------------------------------------------------------------------- |
|
222 // CSIPExSIPEngine::AcceptInvite |
|
223 // Accept a received INVITE with 200 (OK). |
|
224 // ----------------------------------------------------------------------------- |
|
225 EXPORT_C void CSIPExSIPEngine::AcceptInviteL(const TInetAddr& aIPAddr ) |
|
226 { |
|
227 iLocalAddr = aIPAddr; |
|
228 iCurrentState->AcceptInviteL( *this ); |
|
229 } |
|
230 |
|
231 |
|
232 // ----------------------------------------------------------------------------- |
|
233 // CSIPExSIPEngine::DeclineInvite |
|
234 // Decline a received INVITE with 486 (Busy Here). |
|
235 // ----------------------------------------------------------------------------- |
|
236 EXPORT_C void CSIPExSIPEngine::DeclineInviteL() |
|
237 { |
|
238 iCurrentState->DeclineInviteL( *this ); |
|
239 } |
|
240 |
|
241 |
|
242 // ----------------------------------------------------------------------------- |
|
243 // CSIPExSIPEngine::EndSession |
|
244 // End the dialog with BYE. |
|
245 // ----------------------------------------------------------------------------- |
|
246 EXPORT_C void CSIPExSIPEngine::EndSessionL() |
|
247 { |
|
248 iCurrentState->EndSessionL( *this ); |
|
249 } |
|
250 |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CSIPExSIPEngine::CreateIML |
|
254 // Create and send an Instant Message to recipient defined with parameter. |
|
255 // This is implemented with the MESSAGE method and is sent outside of a |
|
256 // dialog. |
|
257 // ----------------------------------------------------------------------------- |
|
258 EXPORT_C void CSIPExSIPEngine::CreateIML( |
|
259 const TDesC8& aMessage, |
|
260 const TDesC8& aSipUri ) |
|
261 { |
|
262 _LIT8( KMediaType, "SIPEx" ); // Part of content type |
|
263 _LIT8( KMediaSubType, "InstantMessage" ); // Part of content type |
|
264 |
|
265 // Create the necessary elements of the IM |
|
266 CSIPRequestElements* reqElem = CreateReqElementsLC( aSipUri ); |
|
267 CSIPToHeader* toHeader = CreateToHeaderLC( aSipUri ); |
|
268 reqElem->SetToHeaderL( toHeader ); |
|
269 CleanupStack::Pop( toHeader ); |
|
270 |
|
271 // Create the From header value using info from the profile |
|
272 const TDesC8* aor = NULL; |
|
273 iProfile->GetParameter( KSIPUserAor, aor ); |
|
274 __ASSERT_ALWAYS( aor && *aor != KNullDesC8, User::Leave( KErrNotFound ) ); |
|
275 |
|
276 CSIPAddress* addr = CSIPAddress::DecodeL( *aor ); |
|
277 CleanupStack::PushL( addr ); |
|
278 CSIPFromHeader* fromHeader = CSIPFromHeader::NewL( addr ); |
|
279 CleanupStack::Pop( addr ); |
|
280 |
|
281 CleanupStack::PushL( fromHeader ); |
|
282 reqElem->SetFromHeaderL( fromHeader ); |
|
283 CleanupStack::Pop( fromHeader ); |
|
284 |
|
285 |
|
286 reqElem->SetMethodL( SIPStrings::StringF( SipStrConsts::EMessage ) ); |
|
287 |
|
288 // Get reference to the message elements from the request |
|
289 // elements, create and insert content type header (ownership |
|
290 // of the content type object is transferred) |
|
291 CSIPMessageElements& msgElem = reqElem->MessageElements(); |
|
292 CSIPContentTypeHeader* ct = |
|
293 CSIPContentTypeHeader::NewLC( KMediaType, KMediaSubType ); |
|
294 msgElem.SetContentL( aMessage.AllocL(), ct ); |
|
295 CleanupStack::Pop( ct ); |
|
296 |
|
297 // Get the current connection |
|
298 CSIPConnection& conn = ConnectionL(); |
|
299 |
|
300 // Send the request using the connection (ownership of the |
|
301 // request elements object is transferred) |
|
302 CSIPClientTransaction* ctx = conn.SendRequestL( reqElem ); |
|
303 CleanupStack::Pop( reqElem ); |
|
304 |
|
305 delete ctx; |
|
306 } |
|
307 |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // CSIPExSIPEngine::IMReceivedL |
|
311 // An Instant Message is received from the network. Respond with 200 (OK) |
|
312 // and alert the Engine Observer. |
|
313 // ----------------------------------------------------------------------------- |
|
314 void CSIPExSIPEngine::IMReceivedL( CSIPServerTransaction* aTransaction ) |
|
315 { |
|
316 const CSIPRequestElements* reqElem = aTransaction->RequestElements(); |
|
317 const CSIPFromHeader* fromHeader = reqElem->FromHeader(); |
|
318 |
|
319 CSIPResponseElements* respElem = |
|
320 CSIPResponseElements::NewLC( 200, |
|
321 SIPStrings::StringF( SipStrConsts::EPhraseOk ) ); |
|
322 // Use the transaction to send 200 (OK) |
|
323 aTransaction->SendResponseL( respElem ); |
|
324 CleanupStack::Pop( respElem ); |
|
325 |
|
326 // Inform the observer of the Instant Message |
|
327 iObserver->IMReceived( |
|
328 fromHeader->SIPAddress().Uri8().Uri().Extract( EUriUserinfo ), |
|
329 reqElem->MessageElements().Content()); |
|
330 |
|
331 // We no longer need aTransaction. Just delete it. |
|
332 delete aTransaction; |
|
333 aTransaction = NULL; |
|
334 } |
|
335 |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // CSIPExSIPEngine::IMReceived |
|
339 // Call the IMReceivedL method, trapping the possible errors. |
|
340 // ----------------------------------------------------------------------------- |
|
341 void CSIPExSIPEngine::IMReceived( CSIPServerTransaction* aTransaction ) |
|
342 { |
|
343 TRAPD( err, IMReceivedL( aTransaction )); |
|
344 |
|
345 if ( err != KErrNone ) |
|
346 { |
|
347 iObserver->EngineError( err ); |
|
348 } |
|
349 } |
|
350 |
|
351 |
|
352 // ----------------------------------------------------------------------------- |
|
353 // CSIPExSIPEngine::SetCurrentState |
|
354 // Sets the new current state of the state machine. |
|
355 // ----------------------------------------------------------------------------- |
|
356 void CSIPExSIPEngine::SetCurrentState( CSIPExSIPStateBase* aState ) |
|
357 { |
|
358 iCurrentState = aState; |
|
359 } |
|
360 |
|
361 |
|
362 // ----------------------------------------------------------------------------- |
|
363 // CSIPExSIPEngine::ConnectionL |
|
364 // Returns the active connection. |
|
365 // ----------------------------------------------------------------------------- |
|
366 CSIPConnection& CSIPExSIPEngine::ConnectionL() |
|
367 { |
|
368 CSIPConnection* conn = CurrentConnection(); |
|
369 if ( !conn ) |
|
370 { |
|
371 TUint32 iapId( 0 ); |
|
372 User::LeaveIfError( iProfile->GetParameter( KSIPAccessPointId, iapId ) ); |
|
373 iConnection = CSIPConnection::NewL( *iSIP, iapId, *this ); |
|
374 return *iConnection; |
|
375 } |
|
376 return *conn; |
|
377 } |
|
378 |
|
379 |
|
380 // ----------------------------------------------------------------------------- |
|
381 // CSIPExSIPEngine::Profile |
|
382 // Returns the enabled profile. |
|
383 // ----------------------------------------------------------------------------- |
|
384 CSIPProfile& CSIPExSIPEngine::Profile() |
|
385 { |
|
386 return *iProfile; |
|
387 } |
|
388 |
|
389 |
|
390 // ----------------------------------------------------------------------------- |
|
391 // CSIPExSIPEngine::SetServerTx |
|
392 // Sets the current Server Transaction. |
|
393 // ----------------------------------------------------------------------------- |
|
394 void CSIPExSIPEngine::SetServerTx( CSIPServerTransaction* aTx ) |
|
395 { |
|
396 delete iServerTx; |
|
397 iServerTx = aTx; |
|
398 } |
|
399 |
|
400 |
|
401 // ----------------------------------------------------------------------------- |
|
402 // CSIPExSIPEngine::ServerTx |
|
403 // Returns the current Server Transaction. |
|
404 // ----------------------------------------------------------------------------- |
|
405 CSIPServerTransaction& CSIPExSIPEngine::ServerTx() |
|
406 { |
|
407 return *iServerTx; |
|
408 } |
|
409 |
|
410 |
|
411 // ----------------------------------------------------------------------------- |
|
412 // CSIPExSIPEngine::SetClientTx |
|
413 // Sets the current Client Transaction. |
|
414 // ----------------------------------------------------------------------------- |
|
415 void CSIPExSIPEngine::SetClientTx( CSIPClientTransaction* aTx ) |
|
416 { |
|
417 delete iClientTx; |
|
418 iClientTx = aTx; |
|
419 } |
|
420 |
|
421 |
|
422 // ----------------------------------------------------------------------------- |
|
423 // CSIPExSIPEngine::ClearClientTx |
|
424 // Deletes the current Client Transaction. |
|
425 // ----------------------------------------------------------------------------- |
|
426 void CSIPExSIPEngine::ClearClientTx() |
|
427 { |
|
428 delete iClientTx; |
|
429 iClientTx = NULL; |
|
430 } |
|
431 |
|
432 |
|
433 // ----------------------------------------------------------------------------- |
|
434 // CSIPExSIPEngine::ClientTx |
|
435 // Returns the current Client Transaction. |
|
436 // ----------------------------------------------------------------------------- |
|
437 CSIPClientTransaction& CSIPExSIPEngine::ClientTx() |
|
438 { |
|
439 return *iClientTx; |
|
440 } |
|
441 |
|
442 |
|
443 // ----------------------------------------------------------------------------- |
|
444 // CSIPExSIPEngine::SetDialogAssoc |
|
445 // Sets the current Invite Dialog Association. |
|
446 // ----------------------------------------------------------------------------- |
|
447 void CSIPExSIPEngine::SetDialogAssoc( CSIPInviteDialogAssoc& aAssoc ) |
|
448 { |
|
449 delete iDialogAssoc; |
|
450 iDialogAssoc = &aAssoc; |
|
451 } |
|
452 |
|
453 |
|
454 // ----------------------------------------------------------------------------- |
|
455 // CSIPExSIPEngine::DialogAssoc |
|
456 // Returns the current Invite Dialog Association. |
|
457 // ----------------------------------------------------------------------------- |
|
458 CSIPInviteDialogAssoc& CSIPExSIPEngine::DialogAssoc() |
|
459 { |
|
460 return *iDialogAssoc; |
|
461 } |
|
462 |
|
463 |
|
464 // ----------------------------------------------------------------------------- |
|
465 // CSIPExSIPEngine::CreateToHeaderLC |
|
466 // (other items were commented in a header). |
|
467 // ----------------------------------------------------------------------------- |
|
468 CSIPToHeader* CSIPExSIPEngine::CreateToHeaderLC( const TDesC8& aSipUri ) |
|
469 { |
|
470 CSIPAddress* addr = CSIPAddress::DecodeL( aSipUri ); |
|
471 CleanupStack::PushL( addr ); |
|
472 |
|
473 CSIPToHeader* to = CSIPToHeader::NewL( addr ); |
|
474 CleanupStack::Pop( addr ); |
|
475 CleanupStack::PushL( to ); |
|
476 |
|
477 return to; |
|
478 } |
|
479 |
|
480 |
|
481 // ----------------------------------------------------------------------------- |
|
482 // CSIPExSIPEngine::CreateReqElementsLC |
|
483 // (other items were commented in a header). |
|
484 // ----------------------------------------------------------------------------- |
|
485 CSIPRequestElements* CSIPExSIPEngine::CreateReqElementsLC( const TDesC8& aSipUri ) |
|
486 { |
|
487 CUri8* uri8 = ConvertToUri8LC( aSipUri ); |
|
488 CSIPRequestElements* req = CSIPRequestElements::NewL( uri8 ); |
|
489 CleanupStack::Pop( uri8 ); |
|
490 CleanupStack::PushL( req ); |
|
491 return req; |
|
492 } |
|
493 |
|
494 |
|
495 // ----------------------------------------------------------------------------- |
|
496 // CSIPExSIPEngine::CreateMessageElementsLC |
|
497 // Create a CSIPMEssageElements instance with the required information. |
|
498 // ----------------------------------------------------------------------------- |
|
499 CSIPMessageElements* CSIPExSIPEngine::CreateMessageElementsLC() |
|
500 { |
|
501 _LIT8( KMediaType, "application" ); |
|
502 _LIT8( KMediaSubType, "sdp" ); |
|
503 |
|
504 CSIPMessageElements* msgElements = CSIPMessageElements::NewLC(); |
|
505 |
|
506 CSdpDocument* sdpDocument = SdpDocumentLC(); |
|
507 MediaFieldsL( sdpDocument ); |
|
508 |
|
509 HBufC8* content = SdpBodyL( sdpDocument ); |
|
510 CleanupStack::PushL( content ); |
|
511 |
|
512 CSIPContentTypeHeader* ct = |
|
513 CSIPContentTypeHeader::NewLC( KMediaType, KMediaSubType ); |
|
514 |
|
515 msgElements->SetContentL( content, ct ); |
|
516 |
|
517 CleanupStack::Pop( ct ); |
|
518 CleanupStack::Pop( content ); |
|
519 CleanupStack::PopAndDestroy( sdpDocument ); |
|
520 |
|
521 return msgElements; |
|
522 } |
|
523 |
|
524 |
|
525 // ----------------------------------------------------------------------------- |
|
526 // CSIPExSIPEngine::ConvertToUri8LC |
|
527 // (other items were commented in a header). |
|
528 // ----------------------------------------------------------------------------- |
|
529 CUri8* CSIPExSIPEngine::ConvertToUri8LC( const TDesC8& aSipUri ) |
|
530 { |
|
531 TUriParser8 parser; |
|
532 User::LeaveIfError( parser.Parse( aSipUri ) ); |
|
533 CUri8* uri8 = CUri8::NewLC( parser ); |
|
534 return uri8; |
|
535 } |
|
536 |
|
537 |
|
538 // ----------------------------------------------------------------------------- |
|
539 // CSIPExSIPEngine::SessionId |
|
540 // Set the session ID using a random number if not set before. Return ID. |
|
541 // ----------------------------------------------------------------------------- |
|
542 TInt64 CSIPExSIPEngine::SessionId() |
|
543 { |
|
544 if ( iSessionId > 0 ) |
|
545 { |
|
546 return iSessionId; |
|
547 } |
|
548 else |
|
549 { |
|
550 // Create a random number as the session ID |
|
551 TTime now; |
|
552 now.HomeTime(); |
|
553 TInt64 seed = now.Int64(); |
|
554 |
|
555 TInt random = Math::Rand( seed ); |
|
556 iSessionId = random; |
|
557 return iSessionId; |
|
558 } |
|
559 } |
|
560 |
|
561 |
|
562 // ----------------------------------------------------------------------------- |
|
563 // CSIPExSIPEngine::SdpDocumentLC |
|
564 // Create an instance of the SDP Document class, set the required fields, and |
|
565 // leave it on the cleanup stack. Return pointer to the SDP Document instance. |
|
566 // Ownership is transferred. |
|
567 // ----------------------------------------------------------------------------- |
|
568 CSdpDocument* CSIPExSIPEngine::SdpDocumentLC() |
|
569 { |
|
570 _LIT8( KSessionName, "SIP Example Application" ); |
|
571 |
|
572 // Create SDP document |
|
573 CSdpDocument* sdpDocument = CSdpDocument::NewL(); |
|
574 CleanupStack::PushL( sdpDocument ); |
|
575 |
|
576 CSdpOriginField* orgField = CSdpOriginField::NewL( KSdpNoInfoDesC8(), |
|
577 SessionId(), 0, |
|
578 iLocalAddr ); |
|
579 sdpDocument->SetOriginField( orgField ); |
|
580 |
|
581 // Set session name |
|
582 sdpDocument->SetSessionNameL( KSessionName ); |
|
583 |
|
584 // Set connection data |
|
585 CSdpConnectionField* connField = CSdpConnectionField::NewL( iLocalAddr ); |
|
586 sdpDocument->SetConnectionField( connField ); |
|
587 |
|
588 return sdpDocument; |
|
589 } |
|
590 |
|
591 |
|
592 // ----------------------------------------------------------------------------- |
|
593 // CSIPExSIPEngine::MediaFieldsL() |
|
594 // Insert the media line to the SDP document given as parameter. |
|
595 // The format of the media line is: |
|
596 // application 0 TCP SIPEx |
|
597 // ----------------------------------------------------------------------------- |
|
598 void CSIPExSIPEngine::MediaFieldsL( CSdpDocument* aDocument ) |
|
599 { |
|
600 _LIT8( KFormat, "SIPEx" ); |
|
601 |
|
602 // Set media field |
|
603 // Set media type: application |
|
604 RStringF media = StringPoolL().StringF( SdpCodecStringConstants::EMediaApplication, |
|
605 SdpCodecStringPool::StringTableL() ); |
|
606 // Set media transport: TCP |
|
607 RStringF prot = StringPoolL().StringF( SdpCodecStringConstants::EProtocolTcp, |
|
608 SdpCodecStringPool::StringTableL() ); |
|
609 // Create the media line |
|
610 CSdpMediaField* mediaDescription = |
|
611 CSdpMediaField::NewL( media, 0, prot, KFormat ); |
|
612 |
|
613 aDocument->MediaFields().Append( mediaDescription ); |
|
614 } |
|
615 |
|
616 |
|
617 // ----------------------------------------------------------------------------- |
|
618 // CSIPExSIPEngine::SdpBodyL() |
|
619 // Return SDP message body in textual form. |
|
620 // Ownership is transferred. |
|
621 // ----------------------------------------------------------------------------- |
|
622 HBufC8* CSIPExSIPEngine::SdpBodyL( CSdpDocument* aDocument ) |
|
623 { |
|
624 HBufC8* sdpBuf = NULL; |
|
625 |
|
626 // Build the message body using buffer writer |
|
627 if ( aDocument->IsValid() ) |
|
628 { |
|
629 CBufFlat* enBuf = CBufFlat::NewL( 1000 ); |
|
630 CleanupStack::PushL( enBuf ); |
|
631 RBufWriteStream writeStream; |
|
632 writeStream.Open( *enBuf, 0 ); |
|
633 aDocument->EncodeL( writeStream ); |
|
634 writeStream.Close(); |
|
635 TPtr8 ptr = enBuf->Ptr( 0 ); |
|
636 sdpBuf = ptr.AllocL(); |
|
637 CleanupStack::PopAndDestroy( enBuf ); |
|
638 writeStream.Close(); |
|
639 } |
|
640 |
|
641 return sdpBuf; |
|
642 } |
|
643 |
|
644 |
|
645 // ----------------------------------------------------------------------------- |
|
646 // CSIPExSIPEngine::CurrentConnection |
|
647 // (other items were commented in a header). |
|
648 // ----------------------------------------------------------------------------- |
|
649 CSIPConnection* CSIPExSIPEngine::CurrentConnection() |
|
650 { |
|
651 if ( iConnection ) |
|
652 { |
|
653 return iConnection; |
|
654 } |
|
655 |
|
656 return 0; |
|
657 } |
|
658 |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CSIPExSIPEngine::IPAddressFromResponseElementsL |
|
662 // (other items were commented in a header). |
|
663 // ----------------------------------------------------------------------------- |
|
664 const TInetAddr CSIPExSIPEngine::IPAddressFromResponseElementsL( |
|
665 const CSIPResponseElements& aRespElem ) |
|
666 { |
|
667 ; |
|
668 // First, retrieve remote party IP Address |
|
669 // Get Message Elements from Response Elements |
|
670 const CSIPMessageElements& msgElem = aRespElem.MessageElements(); |
|
671 |
|
672 // Get message content from Message Elements |
|
673 const TDesC8& content = msgElem.Content(); |
|
674 |
|
675 // Get the SDP Document from the message content |
|
676 CSdpDocument* SDPDoc = CSdpDocument::DecodeLC( content ); |
|
677 |
|
678 // Get the Connection Field from the SDP Document |
|
679 CSdpConnectionField* connField = SDPDoc->ConnectionField(); |
|
680 |
|
681 // And, finally, get the IP Address from the Connection Field |
|
682 const TInetAddr* addr = connField->InetAddress(); |
|
683 const TInetAddr inetAddr = *addr; |
|
684 |
|
685 CleanupStack::PopAndDestroy( SDPDoc ); |
|
686 |
|
687 return inetAddr; |
|
688 } |
|
689 |
|
690 |
|
691 // ----------------------------------------------------------------------------- |
|
692 // CSIPExSIPEngine::StringPoolL |
|
693 // Get SDP codec string pool. Open string pool if not opened. |
|
694 // ----------------------------------------------------------------------------- |
|
695 RStringPool CSIPExSIPEngine::StringPoolL() |
|
696 { |
|
697 TRAPD( error, SdpCodecStringPool::OpenL() ); |
|
698 if ( error == KErrAlreadyExists ) |
|
699 { |
|
700 return SdpCodecStringPool::StringPoolL(); |
|
701 } |
|
702 else if ( error == KErrNone ) |
|
703 { |
|
704 //Add missing string to the pool then return it |
|
705 return SdpCodecStringPool::StringPoolL(); |
|
706 } |
|
707 else |
|
708 { |
|
709 User::Leave( error ); |
|
710 return SdpCodecStringPool::StringPoolL(); //Return here to omit warning |
|
711 } |
|
712 } |
|
713 |
|
714 |
|
715 // ----------------------------------------------------------------------------- |
|
716 // CSIPExSIPEngine::Observer |
|
717 // Return pointer to the class registered as Engine Observer. |
|
718 // ----------------------------------------------------------------------------- |
|
719 MSIPExSIPEngineObserver* CSIPExSIPEngine::Observer() |
|
720 { |
|
721 return iObserver; |
|
722 } |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 // |
|
728 // IMPLEMENTATION OF THE METHODS INHERITED FROM BASE CLASSES |
|
729 // |
|
730 |
|
731 // From MSIPObserver: |
|
732 |
|
733 // ----------------------------------------------------------------------------- |
|
734 // CSIPExSIPEngine::IncomingRequest |
|
735 // Handle a request coming outside of a SIP dialog. |
|
736 // We have to use TRAPs because this is a non-leaving method. |
|
737 // We get the ownership to aTransaction. |
|
738 // ----------------------------------------------------------------------------- |
|
739 void CSIPExSIPEngine::IncomingRequest( |
|
740 TUint32 aIapId, |
|
741 CSIPServerTransaction* aTransaction ) |
|
742 { |
|
743 if ( !iProfile ) |
|
744 { |
|
745 TRAPD( err, EnableProfileL() ); |
|
746 |
|
747 if ( err != KErrNone ) |
|
748 { |
|
749 // A profile error occured. |
|
750 // Delete aTransaction and inform the observer. |
|
751 delete aTransaction; |
|
752 aTransaction = NULL; |
|
753 |
|
754 iObserver->ProfileError( err ); |
|
755 return; |
|
756 } |
|
757 } |
|
758 |
|
759 if ( !CurrentConnection() ) |
|
760 { |
|
761 // Create an instance of the SIP Connection object. |
|
762 TRAPD( err2, iConnection = CSIPConnection::NewL( *iSIP, aIapId, *this ) ); |
|
763 |
|
764 if ( err2 != KErrNone ) |
|
765 { |
|
766 // An error occured opening the connection. |
|
767 // Delete aTransaction and inform the observer. |
|
768 delete aTransaction; |
|
769 aTransaction = NULL; |
|
770 |
|
771 iObserver->EngineError( err2 ); |
|
772 return; |
|
773 } |
|
774 } |
|
775 |
|
776 if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EInvite ) ) |
|
777 { |
|
778 // An INVITE has been received. |
|
779 // Save the pointer for later queries and eventual |
|
780 // deletion. |
|
781 SetServerTx(aTransaction); |
|
782 |
|
783 // Let the current state handle the received INVITE. |
|
784 // Ownership of aTransaction is transferred. |
|
785 TRAPD( err2, iCurrentState->InviteReceivedL( *this, aTransaction ) ); |
|
786 if ( err2 != KErrNone ) |
|
787 { |
|
788 // An error occured when handling invitation. |
|
789 // Delete aTransaction and inform the observer. |
|
790 delete aTransaction; |
|
791 iServerTx = NULL; |
|
792 iObserver->EngineError( err2 ); |
|
793 return; |
|
794 } |
|
795 } |
|
796 else if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EMessage ) ) |
|
797 { |
|
798 IMReceived( aTransaction ); |
|
799 } |
|
800 } |
|
801 |
|
802 |
|
803 // ----------------------------------------------------------------------------- |
|
804 // CSIPExSIPEngine::TimedOut - No implementation needed |
|
805 // ----------------------------------------------------------------------------- |
|
806 void CSIPExSIPEngine::TimedOut( |
|
807 CSIPServerTransaction& /* aSIPServerTransaction */ ) |
|
808 { |
|
809 } |
|
810 |
|
811 |
|
812 // From MSIPConnectionObserver: |
|
813 |
|
814 // ----------------------------------------------------------------------------- |
|
815 // CSIPExSIPEngine::IncomingRequest |
|
816 // No dialog has been established yet, so this should be an INVITE or MESSAGE. |
|
817 // The ownership of aTransaction is transferred. |
|
818 // ----------------------------------------------------------------------------- |
|
819 void CSIPExSIPEngine::IncomingRequest( CSIPServerTransaction* aTransaction ) |
|
820 { |
|
821 if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EInvite ) ) |
|
822 { |
|
823 // An INVITE has been received. |
|
824 // Get profile, create connection, and let the |
|
825 // state machine handle it. |
|
826 |
|
827 if ( !iProfile ) |
|
828 { |
|
829 // If the default profile isn't enabled, do it now |
|
830 TRAPD( err, EnableProfileL() ); |
|
831 |
|
832 if ( err != KErrNone ) |
|
833 { |
|
834 // A profile error occured. |
|
835 // Delete aTransaction and inform the observer. |
|
836 delete aTransaction; |
|
837 aTransaction = NULL; |
|
838 |
|
839 iObserver->ProfileError( err ); |
|
840 } |
|
841 } |
|
842 |
|
843 // The transaction still exists, which means there |
|
844 // was no trouble with the profile part. Go on with |
|
845 // request handling. |
|
846 if ( aTransaction ) |
|
847 { |
|
848 // The ownership of aTransaction is transferred. |
|
849 // Save the pointer for later queries and eventual |
|
850 // deletion. |
|
851 SetServerTx(aTransaction); |
|
852 |
|
853 // Handle the incoming request in the state machine classes |
|
854 // The ownership of aTransaction is transferred. |
|
855 TRAPD( err2, iCurrentState->InviteReceivedL( *this, aTransaction )); |
|
856 } |
|
857 } |
|
858 else if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EMessage ) ) |
|
859 { |
|
860 // An Instant Message is received |
|
861 // The state machine isn't needed for this. |
|
862 IMReceived( aTransaction ); |
|
863 } |
|
864 } |
|
865 |
|
866 |
|
867 // ----------------------------------------------------------------------------- |
|
868 // CSIPExSIPEngine::IncomingRequest |
|
869 // A request concerning an established dialog is received. |
|
870 // ----------------------------------------------------------------------------- |
|
871 void CSIPExSIPEngine::IncomingRequest( |
|
872 CSIPServerTransaction* aTransaction, |
|
873 CSIPDialog& aDialog ) |
|
874 { |
|
875 const RPointerArray<CSIPDialogAssocBase>& dialogAssoc = |
|
876 aDialog.SIPDialogAssociations(); |
|
877 |
|
878 for ( TInt i = 0; i < dialogAssoc.Count(); i++ ) |
|
879 { |
|
880 if ( dialogAssoc[i]->Type() == |
|
881 SIPStrings::StringF( SipStrConsts::EInvite ) ) |
|
882 { |
|
883 iDialogAssoc = |
|
884 reinterpret_cast<CSIPInviteDialogAssoc*>( dialogAssoc[0] ); |
|
885 break; |
|
886 } |
|
887 } |
|
888 |
|
889 if ( aTransaction->Type() == SIPStrings::StringF( SipStrConsts::EBye ) ) |
|
890 { |
|
891 // The ownership of aTransaction is transferred. |
|
892 // Save the pointer for later queries and eventual |
|
893 // deletion. |
|
894 SetServerTx(aTransaction); |
|
895 |
|
896 TRAPD( err, iCurrentState->ByeReceivedL( *this, *aTransaction ) ); |
|
897 |
|
898 if ( err != KErrNone ) |
|
899 { |
|
900 iObserver->EngineError( err ); |
|
901 } |
|
902 } |
|
903 else if ( aTransaction->Type() == |
|
904 SIPStrings::StringF( SipStrConsts::EAck ) ) |
|
905 { |
|
906 // The ownership of aTransaction is transferred. |
|
907 // Save the pointer for later queries and eventual |
|
908 // deletion. |
|
909 SetServerTx(aTransaction); |
|
910 |
|
911 TRAPD( err, iCurrentState->AckReceivedL( *this, *aTransaction ) ); |
|
912 |
|
913 if ( err != KErrNone ) |
|
914 { |
|
915 iObserver->EngineError( err ); |
|
916 } |
|
917 } |
|
918 else if ( aTransaction->Type() == |
|
919 SIPStrings::StringF( SipStrConsts::EMessage ) ) |
|
920 { |
|
921 IMReceived( aTransaction ); |
|
922 } |
|
923 else |
|
924 { |
|
925 // Unknown, or unimplemented, request received |
|
926 delete aTransaction; |
|
927 aTransaction = NULL; |
|
928 iObserver->EngineError( KErrNotSupported ); |
|
929 } |
|
930 } |
|
931 |
|
932 // ----------------------------------------------------------------------------- |
|
933 // CSIPExSIPEngine::IncomingResponse - No implementation needed |
|
934 // ----------------------------------------------------------------------------- |
|
935 void CSIPExSIPEngine::IncomingResponse( |
|
936 CSIPClientTransaction& /* aTransaction */ ) |
|
937 { |
|
938 } |
|
939 |
|
940 |
|
941 // ----------------------------------------------------------------------------- |
|
942 // CSIPExSIPEngine::IncomingResponse |
|
943 // A response inside an established dialog is received. |
|
944 // ----------------------------------------------------------------------------- |
|
945 void CSIPExSIPEngine::IncomingResponse( CSIPClientTransaction& aTransaction, |
|
946 CSIPDialogAssocBase& aDialogAssoc ) |
|
947 { |
|
948 if ( aDialogAssoc.Type() == SIPStrings::StringF( SipStrConsts::EInvite ) ) |
|
949 { |
|
950 iDialogAssoc = reinterpret_cast<CSIPInviteDialogAssoc*>( &aDialogAssoc ); |
|
951 } |
|
952 |
|
953 TRAPD( err, iCurrentState->ResponseReceivedL( *this, aTransaction ) ); |
|
954 |
|
955 if ( err != KErrNone ) |
|
956 { |
|
957 iObserver->EngineError( err ); |
|
958 } |
|
959 } |
|
960 |
|
961 |
|
962 // ----------------------------------------------------------------------------- |
|
963 // CSIPExSIPEngine::IncomingResponse |
|
964 // Since the ownership is transferred, aDialogAssoc needs to be deleted |
|
965 // ----------------------------------------------------------------------------- |
|
966 void CSIPExSIPEngine::IncomingResponse( |
|
967 CSIPClientTransaction& /* aTransaction */, |
|
968 CSIPInviteDialogAssoc* aDialogAssoc ) |
|
969 { |
|
970 delete aDialogAssoc; |
|
971 aDialogAssoc = NULL; |
|
972 } |
|
973 |
|
974 |
|
975 // ----------------------------------------------------------------------------- |
|
976 // CSIPExSIPEngine::IncomingResponse - No implementation needed |
|
977 // ----------------------------------------------------------------------------- |
|
978 void CSIPExSIPEngine::IncomingResponse( |
|
979 CSIPClientTransaction& /* aTransaction */, |
|
980 CSIPRegistrationBinding& /* aRegistration */ ) |
|
981 { |
|
982 |
|
983 } |
|
984 |
|
985 |
|
986 // ----------------------------------------------------------------------------- |
|
987 // CSIPExSIPEngine::ErrorOccured |
|
988 // (other items were commented in a header). |
|
989 // ----------------------------------------------------------------------------- |
|
990 void CSIPExSIPEngine::ErrorOccured( |
|
991 TInt /* aError */, |
|
992 CSIPTransactionBase& /* aTransaction */ ) |
|
993 { |
|
994 |
|
995 } |
|
996 |
|
997 |
|
998 // ----------------------------------------------------------------------------- |
|
999 // CSIPExSIPEngine::ErrorOccured |
|
1000 // (other items were commented in a header). |
|
1001 // ----------------------------------------------------------------------------- |
|
1002 void CSIPExSIPEngine::ErrorOccured( |
|
1003 TInt /* aError */, |
|
1004 CSIPClientTransaction& /* aTransaction */, |
|
1005 CSIPRegistrationBinding& /* aRegistration */ ) |
|
1006 { |
|
1007 |
|
1008 } |
|
1009 |
|
1010 |
|
1011 // ----------------------------------------------------------------------------- |
|
1012 // CSIPExSIPEngine::ErrorOccured |
|
1013 // (other items were commented in a header). |
|
1014 // ----------------------------------------------------------------------------- |
|
1015 void CSIPExSIPEngine::ErrorOccured( |
|
1016 TInt /* aError */, |
|
1017 CSIPTransactionBase& /* aTransaction */, |
|
1018 CSIPDialogAssocBase& /* aDialogAssoc */ ) |
|
1019 { |
|
1020 |
|
1021 } |
|
1022 |
|
1023 |
|
1024 // ----------------------------------------------------------------------------- |
|
1025 // CSIPExSIPEngine::ErrorOccured |
|
1026 // (other items were commented in a header). |
|
1027 // ----------------------------------------------------------------------------- |
|
1028 void CSIPExSIPEngine::ErrorOccured( |
|
1029 TInt /* aError */, |
|
1030 CSIPRefresh& /* aSIPRefresh */ ) |
|
1031 { |
|
1032 |
|
1033 } |
|
1034 |
|
1035 |
|
1036 // ----------------------------------------------------------------------------- |
|
1037 // CSIPExSIPEngine::ErrorOccured |
|
1038 // (other items were commented in a header). |
|
1039 // ----------------------------------------------------------------------------- |
|
1040 void CSIPExSIPEngine::ErrorOccured( |
|
1041 TInt /* aError */, |
|
1042 CSIPRegistrationBinding& /* aRegistration */ ) |
|
1043 { |
|
1044 |
|
1045 } |
|
1046 |
|
1047 |
|
1048 // ----------------------------------------------------------------------------- |
|
1049 // CSIPExSIPEngine::ErrorOccured |
|
1050 // (other items were commented in a header). |
|
1051 // ----------------------------------------------------------------------------- |
|
1052 void CSIPExSIPEngine::ErrorOccured( |
|
1053 TInt /* aError */, |
|
1054 CSIPDialogAssocBase& /* aDialogAssoc */ ) |
|
1055 { |
|
1056 |
|
1057 } |
|
1058 |
|
1059 |
|
1060 // ----------------------------------------------------------------------------- |
|
1061 // CSIPExSIPEngine::InviteCompleted |
|
1062 // (other items were commented in a header). |
|
1063 // ----------------------------------------------------------------------------- |
|
1064 void CSIPExSIPEngine::InviteCompleted( |
|
1065 CSIPClientTransaction& /* aTransaction */ ) |
|
1066 { |
|
1067 delete iClientTx; |
|
1068 iClientTx = NULL; |
|
1069 } |
|
1070 |
|
1071 // ----------------------------------------------------------------------------- |
|
1072 // CSIPExSIPEngine::InviteCanceled |
|
1073 // (other items were commented in a header). |
|
1074 // ----------------------------------------------------------------------------- |
|
1075 void CSIPExSIPEngine::InviteCanceled( |
|
1076 CSIPServerTransaction& /* aTransaction */ ) |
|
1077 { |
|
1078 iCurrentState->CancelReceivedL( *this, *iClientTx ); |
|
1079 delete iClientTx; |
|
1080 iClientTx = NULL; |
|
1081 } |
|
1082 |
|
1083 // ----------------------------------------------------------------------------- |
|
1084 // CSIPExSIPEngine::ConnectionStateChanged |
|
1085 // (other items were commented in a header). |
|
1086 // ----------------------------------------------------------------------------- |
|
1087 void CSIPExSIPEngine::ConnectionStateChanged( CSIPConnection::TState aState ) |
|
1088 { |
|
1089 if ( iConnState == CSIPConnection::EActive && |
|
1090 aState != CSIPConnection::EActive ) |
|
1091 { |
|
1092 // A previously active connection is active no more |
|
1093 iObserver->ConnectionLost(); |
|
1094 } |
|
1095 else |
|
1096 { |
|
1097 iConnState = aState; |
|
1098 } |
|
1099 } |
|
1100 |
|
1101 |
|
1102 |
|
1103 // From MSIPProfileRegistryObserver |
|
1104 |
|
1105 |
|
1106 // ----------------------------------------------------------------------------- |
|
1107 // CSIPExSIPEngine::ProfileRegistryErrorOccurred |
|
1108 // (other items were commented in a header). |
|
1109 // ----------------------------------------------------------------------------- |
|
1110 void CSIPExSIPEngine::ProfileRegistryEventOccurred( |
|
1111 TUint32 aProfileId, |
|
1112 TEvent aEvent ) |
|
1113 { |
|
1114 switch (aEvent) |
|
1115 { |
|
1116 case MSIPProfileRegistryObserver::EProfileRegistered: |
|
1117 { |
|
1118 HandleProfileRegistered( aProfileId ); |
|
1119 break; |
|
1120 } |
|
1121 case MSIPProfileRegistryObserver::EProfileDeregistered: |
|
1122 { |
|
1123 HandleProfileDeregistered( aProfileId ); |
|
1124 break; |
|
1125 } |
|
1126 case MSIPProfileRegistryObserver::EProfileDestroyed: |
|
1127 { |
|
1128 HandleProfileDestroyed( aProfileId ); |
|
1129 break; |
|
1130 } |
|
1131 default: |
|
1132 { |
|
1133 // MSIPProfileRegistryObserver::EProfileCreated and |
|
1134 // MSIPProfileRegistryObserver::EProfileUpdated |
|
1135 // are ignored |
|
1136 break; |
|
1137 } |
|
1138 } |
|
1139 } |
|
1140 |
|
1141 // ----------------------------------------------------------------------------- |
|
1142 // CSIPExSIPEngine::ProfileRegistryErrorOccurred |
|
1143 // (other items were commented in a header). |
|
1144 // ----------------------------------------------------------------------------- |
|
1145 void CSIPExSIPEngine::ProfileRegistryErrorOccurred( |
|
1146 TUint32 /* aSIPProfileId */, |
|
1147 TInt aError ) |
|
1148 { |
|
1149 iObserver->ProfileError( aError ); |
|
1150 } |
|
1151 |
|
1152 |
|
1153 |
|
1154 // Private handling for profile events |
|
1155 |
|
1156 // ----------------------------------------------------------------------------- |
|
1157 // CSIPExSIPEngine::HandleProfileRegistered |
|
1158 // (other items were commented in a header). |
|
1159 // ----------------------------------------------------------------------------- |
|
1160 void CSIPExSIPEngine::HandleProfileRegistered( TUint32 aSIPProfileId ) |
|
1161 { |
|
1162 TUint32 profileId( 0 ); |
|
1163 iProfile->GetParameter( KSIPProfileId, profileId ); |
|
1164 if ( aSIPProfileId == profileId ) |
|
1165 { |
|
1166 // The profile registration is complete |
|
1167 // Inform the Engine Observer |
|
1168 iObserver->ProfileEnabled( aSIPProfileId ); |
|
1169 } |
|
1170 } |
|
1171 |
|
1172 // ----------------------------------------------------------------------------- |
|
1173 // CSIPExSIPEngine::HandleProfileDeregistered |
|
1174 // (other items were commented in a header). |
|
1175 // ----------------------------------------------------------------------------- |
|
1176 void CSIPExSIPEngine::HandleProfileDeregistered( TUint32 aSIPProfileId ) |
|
1177 { |
|
1178 TUint32 profileId( 0 ); |
|
1179 iProfile->GetParameter( KSIPProfileId, profileId ); |
|
1180 if ( aSIPProfileId == profileId ) |
|
1181 { |
|
1182 // The previously registered profile has |
|
1183 // become unregistered. |
|
1184 delete iDialogAssoc; |
|
1185 iDialogAssoc = 0; |
|
1186 delete iConnection; |
|
1187 iConnection = 0; |
|
1188 //iNotOwnedConnection = 0; |
|
1189 delete iProfile; |
|
1190 iProfile = 0; |
|
1191 |
|
1192 iObserver->ProfileError( KErrGeneral ); |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 // ----------------------------------------------------------------------------- |
|
1197 // CSIPExSIPEngine::HandleProfileDestroyed |
|
1198 // (other items were commented in a header). |
|
1199 // ----------------------------------------------------------------------------- |
|
1200 void CSIPExSIPEngine::HandleProfileDestroyed( TUint32 /* aSIPProfileId */ ) |
|
1201 { |
|
1202 delete iDialogAssoc; |
|
1203 iDialogAssoc = 0; |
|
1204 delete iConnection; |
|
1205 iConnection = 0; |
|
1206 //iNotOwnedConnection = 0; |
|
1207 delete iProfile; |
|
1208 iProfile = 0; |
|
1209 |
|
1210 iObserver->ProfileError( KErrGeneral ); |
|
1211 } |
|
1212 |
|
1213 // End of file |