|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Sip SubConnection Provider implementation |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 |
|
24 #include "sipscpr.h" |
|
25 #include "sipscprstates.h" |
|
26 |
|
27 using namespace ESock; |
|
28 using namespace NetStateMachine; |
|
29 using namespace Messages; |
|
30 using namespace MeshMachine; |
|
31 _LIT(KPanicSIPSCPRText,"SCPR doesn't appear to expect an incoming connection"); |
|
32 |
|
33 //-========================================================= |
|
34 // |
|
35 // Activities |
|
36 // |
|
37 //-========================================================= |
|
38 |
|
39 |
|
40 namespace SipSCprProvisionActivity |
|
41 { |
|
42 DECLARE_DEFINE_NODEACTIVITY(ECFActivityStoreProvision, SipSCprProvision, TCFDataClient::TProvisionConfig) |
|
43 NODEACTIVITY_ENTRY(KNoTag, SipSCprStates::TStoreProvision, CoreNetStates::TAwaitingProvision, MeshMachine::TNoTag) |
|
44 NODEACTIVITY_END() |
|
45 } |
|
46 |
|
47 namespace SipSCprNoBearerActivity |
|
48 { |
|
49 DECLARE_DEFINE_NODEACTIVITY(ECFActivityNoBearer, SipSCprNoBearer, TCFControlProvider::TNoBearer) |
|
50 NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TRaiseError<KErrNotSupported>, CoreNetStates::TAwaitingNoBearer, MeshMachine::TNoTag) |
|
51 NODEACTIVITY_END() |
|
52 } |
|
53 |
|
54 namespace SipSCprStartConnectionActivity |
|
55 { |
|
56 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStart, SipSCprStartConnection, TCFServiceProvider::TStart,PRActivities::CStartActivity::NewL) |
|
57 FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingStart, SipSCprStates::TNoTagOrAlreadyStarted) |
|
58 NODEACTIVITY_ENTRY(KNoTag, SipSCprStates::TStartSession, SipSCprStates::TAwaitingSessionEstablished, MeshMachine::TNoTagOrErrorTag) |
|
59 LAST_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendStarted) |
|
60 LAST_NODEACTIVITY_ENTRY(CoreNetStates::KAlreadyStarted, CoreNetStates::TSendStarted) |
|
61 LAST_NODEACTIVITY_ENTRY(KErrorTag, MeshMachine::TRaiseActivityError) |
|
62 NODEACTIVITY_END() |
|
63 } |
|
64 |
|
65 |
|
66 namespace SipSCprStopActivity |
|
67 { |
|
68 DECLARE_DEFINE_NODEACTIVITY(ECFActivityStop, SipSCprStop, TCFServiceProvider::TStop) |
|
69 FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingStop, SipSCprStates::TNoTagOrAlreadyStopped) |
|
70 //If SCPR is active, stop it, else jumpt to EAlreadyStopped |
|
71 NODEACTIVITY_ENTRY(KNoTag, SipSCprStates::TStopSession, SipSCprStates::TAwaitingSessionTerminated, MeshMachine::TNoTagOrErrorTag) |
|
72 LAST_NODEACTIVITY_ENTRY(KNoTag, /*PRStates::TSendStopped*/PRStates::TSendStoppedAndGoneDown) |
|
73 LAST_NODEACTIVITY_ENTRY(CoreNetStates::KAlreadyStopped, /*PRStates::TSendStopped*/PRStates::TSendStoppedAndGoneDown) |
|
74 LAST_NODEACTIVITY_ENTRY(KErrorTag, MeshMachine::TRaiseAndClearActivityError) |
|
75 NODEACTIVITY_END() |
|
76 } |
|
77 |
|
78 |
|
79 namespace SipSCprParamsRequestActivity |
|
80 { |
|
81 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
|
82 DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, SipSCprSetParams, TCFScpr::TSetParamsRequest) |
|
83 FIRST_NODEACTIVITY_ENTRY(PRStates::TAwaitingParamRequest, MeshMachine::TNoTag) |
|
84 LAST_NODEACTIVITY_ENTRY(KNoTag, SipSCprStates::TStoreAndSetParams) |
|
85 NODEACTIVITY_END() |
|
86 #else |
|
87 DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, SipSCprSetParams, TCFScpr::TParamsRequest) |
|
88 FIRST_NODEACTIVITY_ENTRY(SCprStates::TAwaitingParamRequest, MeshMachine::TNoTag) |
|
89 LAST_NODEACTIVITY_ENTRY(KNoTag, SipSCprStates::TStoreAndSetParams) |
|
90 NODEACTIVITY_END() |
|
91 #endif //SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW |
|
92 } |
|
93 |
|
94 namespace SipSCprBinderRequestActivity |
|
95 { |
|
96 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityBinderRequest, SipSCprBinderRequest, TCFServiceProvider::TCommsBinderRequest, MeshMachine::CNodeParallelActivityBase::NewL) |
|
97 NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TRaiseError<KErrNotSupported>, CoreNetStates::TAwaitingBinderRequest, MeshMachine::TNoTag) |
|
98 NODEACTIVITY_END() |
|
99 } |
|
100 |
|
101 namespace SipSCprRejoinDataClient |
|
102 { |
|
103 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityRejoin, SipSCprRejoin, TCFRejoiningProvider::TRejoinDataClientRequest, PRActivities::CRejoinDataClientActivity::NewL) |
|
104 NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TRaiseError<KErrNotSupported>, CoreNetStates::TAwaitingDataClientRejoin, MeshMachine::TNoTag) |
|
105 NODEACTIVITY_END() |
|
106 } |
|
107 |
|
108 namespace SipSCprActivities |
|
109 { |
|
110 DECLARE_DEFINE_ACTIVITY_MAP(activityMap) |
|
111 ACTIVITY_MAP_ENTRY(SipSCprProvisionActivity, SipSCprProvision) |
|
112 ACTIVITY_MAP_ENTRY(SipSCprNoBearerActivity, SipSCprNoBearer) |
|
113 ACTIVITY_MAP_ENTRY(SipSCprStartConnectionActivity, SipSCprStartConnection) |
|
114 ACTIVITY_MAP_ENTRY(SipSCprStopActivity, SipSCprStop) |
|
115 ACTIVITY_MAP_ENTRY(SipSCprParamsRequestActivity, SipSCprSetParams) |
|
116 ACTIVITY_MAP_ENTRY(SipSCprBinderRequestActivity, SipSCprBinderRequest) |
|
117 ACTIVITY_MAP_ENTRY(SipSCprRejoinDataClient, SipSCprRejoin) |
|
118 ACTIVITY_MAP_ENTRY(SipSCprRejoinDataClient, SipSCprRejoin) |
|
119 ACTIVITY_MAP_END_BASE(SCprActivities, coreSCprActivities) |
|
120 } |
|
121 |
|
122 //-========================================================= |
|
123 // |
|
124 // CSipSubConnectionProvider methods |
|
125 // |
|
126 //-========================================================= |
|
127 CSipSubConnectionProvider::~CSipSubConnectionProvider() |
|
128 { |
|
129 LOG_NODE_DESTROY(KSipSCprTag, CSipSubConnectionProvider); |
|
130 iSipSm->DeleteWhenReady(); |
|
131 } |
|
132 |
|
133 CSipSubConnectionProvider::CSipSubConnectionProvider(ESock::CSubConnectionProviderFactoryBase& aFactory) |
|
134 : CCoreSubConnectionProvider(aFactory, SipSCprActivities::activityMap::Self()) |
|
135 { |
|
136 LOG_NODE_CREATE(KSipSCprTag, CSipSubConnectionProvider); |
|
137 |
|
138 } |
|
139 |
|
140 CSipSubConnectionProvider* |
|
141 CSipSubConnectionProvider::NewL(CSubConnectionProviderFactoryBase& aFactory, TSubConnOpen::TSubConnType aSubConnType) |
|
142 { |
|
143 CSipSubConnectionProvider* provider = new(ELeave)CSipSubConnectionProvider(aFactory); |
|
144 CleanupStack::PushL(provider); |
|
145 provider->ConstructL(aSubConnType); |
|
146 CleanupStack::Pop(); |
|
147 return provider; |
|
148 } |
|
149 |
|
150 |
|
151 void CSipSubConnectionProvider::ConstructL(TSubConnOpen::TSubConnType aSubConnType) |
|
152 { |
|
153 CCoreSubConnectionProvider::ConstructL(); |
|
154 iStage = SipSCpr::EFresh; |
|
155 subconType = aSubConnType; |
|
156 // Set the flag if the sub con type is WaitForIncoming |
|
157 if (aSubConnType == RSubConnection::EWaitIncoming) |
|
158 { |
|
159 iAwaitingSubConnection = ETrue; |
|
160 } |
|
161 else |
|
162 { |
|
163 iAwaitingSubConnection = EFalse; |
|
164 } |
|
165 iSipSm = NULL; |
|
166 } |
|
167 |
|
168 |
|
169 void CSipSubConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage) |
|
170 { |
|
171 TNodeContext<CSipSubConnectionProvider> ctx(*this, aMessage, aSender, aRecipient); |
|
172 CCoreSubConnectionProvider::Received(ctx); |
|
173 User::LeaveIfError(ctx.iReturn); |
|
174 } |
|
175 |
|
176 void CSipSubConnectionProvider::DoParametersAboutToBeSetL(RCFParameterFamilyBundle_const& aParameterBundle) |
|
177 { |
|
178 |
|
179 if (iStage != SipSCpr::EFresh) |
|
180 { |
|
181 //Can't change parameters after starting. |
|
182 User::Leave(KErrNotSupported); |
|
183 } |
|
184 |
|
185 RParameterFamily calldescrFamily = aParameterBundle.FindFamily(KSubConnCallDescrParamsFamily); |
|
186 RParameterFamily authFamily = aParameterBundle.FindFamily(KSubConAuthorisationFamily); |
|
187 if(!calldescrFamily.IsNull()) |
|
188 { |
|
189 TSipParams& sipParams = iSipSm->GetSipParams(); |
|
190 STypeId idInv = STypeId::CreateSTypeId(KSubConSIPParametersUid,KSubConSIPInviteParamsType); |
|
191 STypeId idSbs = STypeId::CreateSTypeId(KSubConSIPParametersUid,KSubConSIPSubscribeParamsType); |
|
192 CSubConSIPInviteParamSet* sipInvitationParams = (CSubConSIPInviteParamSet*)calldescrFamily.FindParameterSet( |
|
193 idInv, RParameterFamily::ERequested); |
|
194 CSubConSIPSubscribeParamSet* sipSubscribeParams = (CSubConSIPSubscribeParamSet*)calldescrFamily.FindParameterSet( |
|
195 idSbs, RParameterFamily::ERequested); |
|
196 |
|
197 if (sipInvitationParams) |
|
198 { |
|
199 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::DoParametersAboutToBeSet() [this=%08x]\t -- CSubConSIPInviteParamSet found "), this)); |
|
200 |
|
201 sipParams.iRequest = TSipHLConsts::ERequestInvite; |
|
202 sipParams.iInvParams.iReqUri.Set(sipInvitationParams->GetRequestUri()); |
|
203 sipParams.iInvParams.iTo.Set(sipInvitationParams->GetTo()); |
|
204 if (sipInvitationParams->GetFrom().Length() == 0) |
|
205 { |
|
206 //The application may fail to supply 'from' in which case we |
|
207 //should reuse the 'from' field stored by the profile. |
|
208 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::DoParametersAboutToBeSet() [this=%08x]\t -- From field not found"), this)); |
|
209 sipInvitationParams->SetFromL(*iFromField); |
|
210 } |
|
211 sipParams.iInvParams.iFrom.Set(sipInvitationParams->GetFrom()); |
|
212 sipParams.iInvParams.iContact.Set(sipInvitationParams->GetContact()); |
|
213 sipParams.iInvParams.iContentType.Set(sipInvitationParams->GetContentType()); |
|
214 sipParams.iInvParams.iContentSubType.Set(sipInvitationParams->GetContentSubType()); |
|
215 sipParams.iInvParams.iContent.Set(sipInvitationParams->GetContent()); |
|
216 } |
|
217 else if (sipSubscribeParams) |
|
218 { |
|
219 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::DoParametersAboutToBeSet() [this=%08x]\t -- CSubConSIPSubscribeParamSet found"), this)); |
|
220 |
|
221 sipParams.iRequest = TSipHLConsts::ERequestSubscribe; |
|
222 sipParams.iSubsParams.iReqUri.Set(sipSubscribeParams->GetRequestUri()); |
|
223 sipParams.iSubsParams.iTo.Set(sipSubscribeParams->GetTo()); |
|
224 if (sipSubscribeParams->GetFrom().Length() == 0) |
|
225 { |
|
226 //The application may fail to supply 'from' in which case we |
|
227 //should reuse the 'from' field stored by the profile. |
|
228 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::DoParametersAboutToBeSet() [this=%08x]\t -- From field not found"), this)); |
|
229 sipSubscribeParams->SetFromL(*iFromField); |
|
230 } |
|
231 sipParams.iSubsParams.iFrom.Set(sipSubscribeParams->GetFrom()); |
|
232 sipParams.iSubsParams.iContact.Set(sipSubscribeParams->GetContact()); |
|
233 sipParams.iSubsParams.iEventType.Set(sipSubscribeParams->GetEventType()); |
|
234 sipParams.iSubsParams.iAcceptType.Set(sipSubscribeParams->GetAcceptType()); |
|
235 sipParams.iSubsParams.iAcceptSubType.Set(sipSubscribeParams->GetAcceptSubType()); |
|
236 sipParams.iSubsParams.iExpires = sipSubscribeParams->GetExpires(); |
|
237 sipParams.iSubsParams.iAutoRefresh = sipSubscribeParams->GetAutoRefresh(); |
|
238 } |
|
239 else |
|
240 { |
|
241 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::DoParametersAboutToBeSet() [this=%08x]\t -- UnSupported Call Description Params"), this)); |
|
242 //Send error message to mesh. Error activity will handle it and pass it originator |
|
243 User::Leave(KErrNotSupported); |
|
244 } |
|
245 } |
|
246 if (!authFamily.IsNull()) |
|
247 { |
|
248 STypeId idAuth = STypeId::CreateSTypeId(KSubConSIPParametersUid,KSubConSIPAuthenticateParamsType); |
|
249 CSubConSIPAuthenticateParamSet* sipAuthenticateParams = (CSubConSIPAuthenticateParamSet*)authFamily.FindParameterSet( |
|
250 idAuth, RParameterFamily::ERequested); |
|
251 |
|
252 if (sipAuthenticateParams) |
|
253 { |
|
254 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::DoParametersAboutToBeSet() [this=%08x]\t -- CSubConSIPAuthenticateParamSet found"), this)); |
|
255 |
|
256 TSIPCredentials credentials; |
|
257 credentials.iUserName.Set(sipAuthenticateParams->GetUserName()); |
|
258 credentials.iPasswd.Set(sipAuthenticateParams->GetPassword()); |
|
259 credentials.iRealm.Set(sipAuthenticateParams->GetRealm()); |
|
260 iTransitionEngine->AddCredentialsL(credentials); |
|
261 } |
|
262 else |
|
263 { |
|
264 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::DoParametersAboutToBeSet() [this=%08x]\t -- UnSupported Authentication Params"), this)); |
|
265 //Send error message to mesh. Error activity will handle it and pass it originator |
|
266 User::Leave(KErrNotSupported); |
|
267 } |
|
268 } |
|
269 if(authFamily.IsNull() && calldescrFamily.IsNull()) |
|
270 { |
|
271 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::DoParametersAboutToBeSet() [this=%08x]\t --Auth and Call Description Family NULL"), this)); |
|
272 //Send error message to mesh. Error activity will handle it and pass it originator |
|
273 User::Leave(KErrNotFound); |
|
274 } |
|
275 } |
|
276 |
|
277 void CSipSubConnectionProvider::InitialiseParametersL(TIncomingCallParameters& aCallParams) |
|
278 { |
|
279 RCFParameterFamilyBundle newBundle; |
|
280 iParameterBundle.CreateL(); |
|
281 newBundle.CreateL(); |
|
282 newBundle.Open(iParameterBundle); |
|
283 RParameterFamily sipCallDescrFamily = newBundle.CreateFamilyL(KSubConnCallDescrParamsFamily); |
|
284 CSubConSIPInviteParamSet* subConSipRequestedParSet = |
|
285 CSubConSIPInviteParamSet::NewL(sipCallDescrFamily, RParameterFamily::ERequested); |
|
286 |
|
287 subConSipRequestedParSet->SetRequestUriL(aCallParams.iReqUri); |
|
288 subConSipRequestedParSet->SetFromL(aCallParams.iFrom); |
|
289 subConSipRequestedParSet->SetToL(aCallParams.iTo); |
|
290 subConSipRequestedParSet->SetContentL(aCallParams.iContent); |
|
291 } |
|
292 //-========================================================= |
|
293 // |
|
294 // MSIPStateMachineClient methods |
|
295 // |
|
296 //-========================================================= |
|
297 |
|
298 void CSipSubConnectionProvider::CallEstablished() |
|
299 { |
|
300 |
|
301 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::Call Established"))); |
|
302 |
|
303 //We dont need this error here, neither do we need to pass erro in SessionEstablished message |
|
304 TInt error = KErrNone; |
|
305 ASSERT(iStage == SipSCpr::EStarting); |
|
306 RClientInterface::OpenPostMessageClose(Id(),TNodeCtxId(iActivityAwaitingResponse, Id()),TSipSCprMessages::TSipSessionEstablished(error).CRef()); |
|
307 iActivityAwaitingResponse = MeshMachine::KActivityNull; |
|
308 } |
|
309 |
|
310 |
|
311 void CSipSubConnectionProvider::CallTerminated(TInt aError, TInt aSipCode) |
|
312 { |
|
313 |
|
314 //The CallTerminated callback method can be triggered in three cases |
|
315 //1. As a result of RsubConnection::Stop(). The UE wants to send a BYE |
|
316 //2. As a result of the remote UE sending a BYE |
|
317 //3. SCPR start fails (in the cases where sip HL API's doesn't support the given SIP method) |
|
318 |
|
319 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::Call Terminated"))); |
|
320 |
|
321 iStage = SipSCpr::EStopped; |
|
322 |
|
323 if(iActivityAwaitingResponse == ECFActivityStart) |
|
324 { |
|
325 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::Call Terminated : Activity Start"))); |
|
326 RClientInterface::OpenPostMessageClose(Id(),TNodeCtxId(iActivityAwaitingResponse, Id()),TSipSCprMessages::TSipSessionEstablished(aError).CRef()); |
|
327 iActivityAwaitingResponse = MeshMachine::KActivityNull; |
|
328 } |
|
329 else if (iActivityAwaitingResponse == ECFActivityStop) |
|
330 { |
|
331 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::Call Terminated : Activity Stop"))); |
|
332 RClientInterface::OpenPostMessageClose(Id(),TNodeCtxId(iActivityAwaitingResponse, Id()),TSipSCprMessages::TSipSessionTerminated(aError).CRef()); |
|
333 iActivityAwaitingResponse = MeshMachine::KActivityNull; |
|
334 } |
|
335 else |
|
336 { |
|
337 // it if for incoming connection |
|
338 //if (iAwaitingSubConnection) |
|
339 // { |
|
340 // When the remote party sends BYE send a notification for which the |
|
341 // app is subscribed to. |
|
342 //Notify the upper layeer about the extended SIP reason for termination |
|
343 CSubConSIPResponseEvent* sipevent = NULL; |
|
344 TRAPD(error, sipevent = CSubConSIPResponseEvent::NewL()); |
|
345 if (error != KErrNone) |
|
346 { |
|
347 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSubConSIPResponseEvent::NewL() left with the error: [%d]"), error)); |
|
348 return; |
|
349 } |
|
350 sipevent->SetResponse(aSipCode); |
|
351 NotifyClientsL(*sipevent); |
|
352 } |
|
353 } |
|
354 |
|
355 /** |
|
356 This is a call-back function of SIP stata machine. |
|
357 It will be called when an incoming connection(incoming INVITE) is received with the |
|
358 incoming connection parameters |
|
359 */ |
|
360 void CSipSubConnectionProvider::IncomingCall(TIncomingCallParameters& aCallParams) |
|
361 { |
|
362 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::IncomingCall"))); |
|
363 |
|
364 ASSERT(iStage == SipSCpr::EFresh); |
|
365 TInt error = KErrNone; |
|
366 |
|
367 if ((!iAwaitingSubConnection) || !iParameterBundle.IsNull()) |
|
368 { |
|
369 //The logic behind this panic is that IncomingCall() should not |
|
370 //arrive, if it doesn't represent an incoming subconnection |
|
371 //that is: |
|
372 // iAwaitingSubConnection has have to be true |
|
373 User::Panic(KPanicSIPSCPRText, KErrBadHandle); |
|
374 } |
|
375 |
|
376 TRAP(error, InitialiseParametersL(aCallParams)); |
|
377 if (error != KErrNone) |
|
378 { |
|
379 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::InitialiseParametersL() left with error [%d]"), error)); |
|
380 } |
|
381 //at this point the incoming subconnection has been deemed fit |
|
382 //scpr should now send a TIncomingConnection message to its CPR so that RConn::WaitForIncoming can return |
|
383 |
|
384 // post this message to its control provider SIP CPR to send binder response |
|
385 // so that the subcon.open will be returned |
|
386 RNodeInterface* cp = ControlProvider(); |
|
387 cp->PostMessage(Id(),SipCpr::TSipCprMessages::TIncomingConnection(0).CRef()); |
|
388 |
|
389 } |
|
390 |
|
391 /** |
|
392 This is a call-back function of the SIP state machine. |
|
393 It will be called when the high-level API ignores the received challenge |
|
394 (Response code 401). |
|
395 */ |
|
396 void CSipSubConnectionProvider::CredentialsRequired(const TDesC8 &/* aRealm*/) |
|
397 { |
|
398 |
|
399 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::CredentialsRequired"))); |
|
400 |
|
401 ASSERT(iStage == SipSCpr::EStarting); |
|
402 TInt error = KErrNone; |
|
403 |
|
404 CSubConSIPAuthenticationRequiredEvent* event = NULL; |
|
405 TRAP(error, event = CSubConSIPAuthenticationRequiredEvent::NewL()); |
|
406 if (error != KErrNone) |
|
407 { |
|
408 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8(" CSubConSIPAuthenticationRequiredEvent::NewL()left with error [%d]"), error)); |
|
409 return; |
|
410 } |
|
411 delete event; // remove this if the following code is uncommented |
|
412 // uncomment the following code if app is subscribed for the event |
|
413 #if 0 |
|
414 TRAP(error, event->SetRealmL(aRealm)); |
|
415 if (error != KErrNone) |
|
416 { |
|
417 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSubConSIPAuthenticationRequiredEvent::SetRealmL() left with error [%d]"), error)); |
|
418 return; |
|
419 } |
|
420 NotifyClientsL(*event); |
|
421 #endif |
|
422 } |
|
423 |
|
424 /** |
|
425 This is callback function. This will be called when the SIP high-level |
|
426 API receives notification for the Subscribe request |
|
427 */ |
|
428 void CSipSubConnectionProvider::ReceiveNotification(TDesC8 & aNotification) |
|
429 { |
|
430 |
|
431 __CFLOG_VAR((KSipSCprTag, KSipSCprSubTag, _L8("CSipSubConnectionProvider::ReceiveNotification"))); |
|
432 CSubConSIPNotificationEvent* event = CSubConSIPNotificationEvent::NewL(); |
|
433 event->SetNotificationL(aNotification); |
|
434 |
|
435 TInt32 gId = event->GroupId(); |
|
436 |
|
437 NotifyClientsL(*event); |
|
438 } |
|
439 |
|
440 /** |
|
441 Creates SIP high-level state machine |
|
442 */ |
|
443 void CSipSubConnectionProvider::CreateStateMachineL() |
|
444 { |
|
445 iSipSm = CSipStateMachine::NewL(iTransitionEngine,NodeAddr(), iAwaitingSubConnection); |
|
446 } |
|
447 |
|
448 // this pointer is used in the creation of the SIP statemachine |
|
449 MSIPStateMachineClient* CSipSubConnectionProvider::NodeAddr() |
|
450 { |
|
451 return this; |
|
452 } |