15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <e32property.h> |
19 #include <e32property.h> |
20 #include <networkhandlingdomainpskeys.h> |
|
21 #include <spdefinitions.h> |
20 #include <spdefinitions.h> |
22 #include "scpvoiphandler.h" |
21 #include "scpvoiphandler.h" |
23 #include "scpprofilehandler.h" |
22 #include "scpprofilehandler.h" |
24 #include "scplogger.h" |
23 #include "scplogger.h" |
25 #include "scpsubservice.h" |
24 #include "scpsubservice.h" |
26 #include "scpservicestorage.h" |
25 #include "scpservicestorage.h" |
27 #include "scpsettinghandler.h" |
26 #include "scpsettinghandler.h" |
28 #include "scpsipconnection.h" |
27 #include "scpsipconnection.h" |
29 #include "scputility.h" |
28 #include "scputility.h" |
30 #include "scppropertynotifier.h" |
|
31 #include "csipclientresolverutils.h" |
29 #include "csipclientresolverutils.h" |
32 |
30 |
33 // : These need to be in some common header |
31 // : These need to be in some common header |
34 const TUid KResolver = { 0x10283140 }; |
32 const TUid KResolver = { 0x10283140 }; |
35 |
33 |
51 void CScpVoipHandler::ConstructL() |
49 void CScpVoipHandler::ConstructL() |
52 { |
50 { |
53 SCPLOGSTRING2( "CScpVoipHandler[0x%x]::ConstructL", this ); |
51 SCPLOGSTRING2( "CScpVoipHandler[0x%x]::ConstructL", this ); |
54 |
52 |
55 BaseConstructL(); |
53 BaseConstructL(); |
56 iNetworkMode = CScpPropertyNotifier::NewL( KPSUidNetworkInfo, |
|
57 KNWTelephonyNetworkMode, *this ) ; |
|
58 iSipClientResolver = CSipClientResolverUtils::NewL(); |
54 iSipClientResolver = CSipClientResolverUtils::NewL(); |
59 } |
55 } |
60 |
56 |
61 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
62 // CScpVoipHandler::NewL |
58 // CScpVoipHandler::NewL |
80 // |
76 // |
81 CScpVoipHandler::~CScpVoipHandler() |
77 CScpVoipHandler::~CScpVoipHandler() |
82 { |
78 { |
83 SCPLOGSTRING2( "CScpVoipHandler[0x%x]::~CScpVoipHandler", this ); |
79 SCPLOGSTRING2( "CScpVoipHandler[0x%x]::~CScpVoipHandler", this ); |
84 delete iSipClientResolver; |
80 delete iSipClientResolver; |
85 delete iNetworkMode; |
|
86 } |
81 } |
87 |
82 |
88 // ----------------------------------------------------------------------------- |
83 // ----------------------------------------------------------------------------- |
89 // CScpVoipHandler::HandlePropertyChanged |
84 // CScpVoipHandler::HandlePropertyChanged |
90 // ----------------------------------------------------------------------------- |
85 // ----------------------------------------------------------------------------- |
196 // |
191 // |
197 void CScpVoipHandler::HandleSipConnectionEventL( TUint32 aProfileId, |
192 void CScpVoipHandler::HandleSipConnectionEventL( TUint32 aProfileId, |
198 TScpConnectionEvent aEvent ) |
193 TScpConnectionEvent aEvent ) |
199 { |
194 { |
200 SCPLOGSTRING4( "CScpVoipHandler[0x%x]::HandleSipConnectionEvent id: %d event: %d", |
195 SCPLOGSTRING4( "CScpVoipHandler[0x%x]::HandleSipConnectionEvent id: %d event: %d", |
201 this, aProfileId, aEvent ); |
196 this, aProfileId, aEvent ); |
202 |
197 |
203 if( iSubService.SipProfileId() == aProfileId && |
198 if( iSubService.SipProfileId() == aProfileId && |
204 iSubService.EnableRequestedState() != CScpSubService::EScpNoRequest ) |
199 iSubService.EnableRequestedState() != CScpSubService::EScpNoRequest ) |
205 { |
200 { |
206 // When in 2G mode with GPRS iap we are enabled but can't |
|
207 // create or receive any VoIP calls |
|
208 if( aEvent == EScpRegistered && |
201 if( aEvent == EScpRegistered && |
209 iSubService.EnableRequestedState() == CScpSubService::EScpEnabled ) |
202 iSubService.EnableRequestedState() == CScpSubService::EScpEnabled ) |
210 { |
203 { |
211 RBuf8 contactHeaderUser; |
204 RBuf8 contactHeaderUser; |
212 contactHeaderUser.CleanupClosePushL(); |
205 contactHeaderUser.CleanupClosePushL(); |
213 GetSipProfileContactHeaderUserL( contactHeaderUser ); |
206 GetSipProfileContactHeaderUserL( contactHeaderUser ); |
214 |
207 |
215 HBufC* string = HBufC::NewLC(contactHeaderUser.Length()); |
208 SCPLOGSTRING( "HandleSipConnectionEventL -> register client" ); |
216 string->Des().Copy(contactHeaderUser); |
|
217 |
|
218 SCPLOGSTRING2( "CScpVoipHandler::HandleSipConnectionEventL(), contactHeaderUser %S", string ); |
|
219 |
209 |
220 CleanupStack::PopAndDestroy(string); |
210 iSipClientResolver->RegisterClientWithUserL( |
221 |
211 GetCallProviderImplementationUidL(), contactHeaderUser, KResolver ); |
222 TInt networkMode = KErrNotFound; |
212 |
223 TInt result = iNetworkMode->GetValue( networkMode ); |
|
224 |
|
225 if( result == KErrNone && |
|
226 networkMode == ENWNetworkModeGsm && |
|
227 iSubService.GetIapType() == EScpGprs ) |
|
228 { |
|
229 aEvent = EScpBandwidthLimited; |
|
230 iSipClientResolver->UnRegisterClientWithUserL( |
|
231 GetCallProviderImplementationUidL(), contactHeaderUser ); |
|
232 } |
|
233 else if ( KErrNone == result && |
|
234 EScpGprs == iSubService.GetIapType() && |
|
235 !iSubService.ServiceStorage().SettingsHandler().IsVoIPOverWcdmaAllowedL( iSubService.SubServiceId() ) ) |
|
236 { |
|
237 aEvent = EScpBearerNotSupported; |
|
238 SCPLOGSTRING( "CScpVoipHandler::HandleSipConnectionEventL(), VoIP over 3G not allowed" ); |
|
239 iSipClientResolver->UnRegisterClientWithUserL( |
|
240 GetCallProviderImplementationUidL(), contactHeaderUser ); |
|
241 } |
|
242 else |
|
243 { |
|
244 iSipClientResolver->RegisterClientWithUserL( |
|
245 GetCallProviderImplementationUidL(), contactHeaderUser, KResolver ); |
|
246 SCPLOGSTRING( "CScpVoipHandler::HandleSipConnectionEventL(), client resolver" ); |
|
247 } |
|
248 |
|
249 CleanupStack::PopAndDestroy( &contactHeaderUser ); |
213 CleanupStack::PopAndDestroy( &contactHeaderUser ); |
250 } |
214 } |
251 |
215 |
252 iSubService.HandleConnectionEvent( aEvent ); |
216 iSubService.HandleConnectionEvent( aEvent ); |
253 } |
217 } |