|
1 /* |
|
2 * Copyright (c) 2007-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: Implements class CSPCall which provides call functionality |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <etelmm.h> |
|
20 #include <etel.h> |
|
21 #include <centralrepository.h> |
|
22 #include <settingsinternalcrkeys.h> |
|
23 #include <ccpdefs.h> |
|
24 #include <gsmerror.h> |
|
25 #include <etelsat.h> |
|
26 #include <cccpcallparameters.h> |
|
27 |
|
28 #include "cspcall.h" |
|
29 #include "cspetelcallrequester.h" |
|
30 #include "cspetelcalleventmonitor.h" |
|
31 #include "cspcallinfomonitor.h" |
|
32 #include "cspetelcallstatusmonitor.h" |
|
33 #include "cspetelcallcapsmonitor.h" |
|
34 #include "csptransferprovider.h" |
|
35 #include "cspforwardprovider.h" |
|
36 #include "csplogger.h" |
|
37 #include "csppanic.pan" |
|
38 #include "cspconsts.h" |
|
39 #include "cspaudiohandler.h" |
|
40 #include "mcspcommoninfo.h" |
|
41 #include "mcspsecuritysettingobserver.h" |
|
42 #include "tcspskypeidparser.h" |
|
43 #include "cspuuimonitor.h" |
|
44 #include "cspuuimessagesender.h" |
|
45 |
|
46 const TInt KTimesToSplitValue = 16; |
|
47 |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CSPCall::~CSPCall |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CSPCall::~CSPCall() |
|
54 { |
|
55 CSPLOGSTRING(CSPOBJECT, "CSPCall::~CSPCall <"); |
|
56 |
|
57 delete iParams; |
|
58 iCommonInfo.IndicateHangupComplete( *this ); |
|
59 |
|
60 if ( iAudioHandler |
|
61 && iAudioStatus == ECSPCallAudioStatusActive ) |
|
62 { |
|
63 iAudioStatus = ECSPCallAudioStatusInactive; |
|
64 iAudioHandler->Stop(); |
|
65 } |
|
66 |
|
67 delete iUserToUserInformation; |
|
68 delete iRequester; |
|
69 delete iCallEventMonitor; |
|
70 delete iCallStatusMonitor; |
|
71 delete iCallCapsMonitor; |
|
72 delete iCallInfoMonitor; |
|
73 delete iForwardProvider; |
|
74 delete iTransferProvider; |
|
75 delete iUUIMonitor; |
|
76 delete iUUIMessageSender; |
|
77 delete iSkypeId; |
|
78 |
|
79 iObservers.Close(); |
|
80 if ( iCall.SubSessionHandle() ) |
|
81 { |
|
82 iCall.Close(); |
|
83 } |
|
84 |
|
85 CSPLOGSTRING(CSPOBJECT, "CSPCall::~CSPCall >"); |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CSPCall::SetAudioHandler |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CSPCall::SetAudioHandler( CSPAudioHandler* aHandler ) |
|
93 { |
|
94 CSPLOGSTRING2(CSPINT, "CSPCall::SetAudioHandler handler: %x", aHandler); |
|
95 iAudioHandler = aHandler; |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // CSPCall::SecuritySettingChanged |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CSPCall::SecuritySettingChanged( TInt aValue ) |
|
103 { |
|
104 switch ( aValue ) |
|
105 { |
|
106 case MCSPSecuritySettingObserver::ESecureCall: |
|
107 { |
|
108 CSPLOGSTRING(CSPINT, |
|
109 "CSPCall::SecuritySettingChanged Sending 'secure call' event"); |
|
110 NotifyCallEventOccurred( MCCPCallObserver::ECCPSecureCall ); |
|
111 break; |
|
112 } |
|
113 case MCSPSecuritySettingObserver::ENotSecureCall: |
|
114 { |
|
115 CSPLOGSTRING(CSPINT, |
|
116 "CSPCall::SecuritySettingChanged Sending 'not secure call' event"); |
|
117 NotifyCallEventOccurred( MCCPCallObserver::ECCPNotSecureCall ); |
|
118 break; |
|
119 } |
|
120 case MCSPSecuritySettingObserver::ESecureNotSpecified: |
|
121 { |
|
122 CSPLOGSTRING(CSPINT, |
|
123 "CSPCall::SecuritySettingChanged Sending SecureNotSpecified"); |
|
124 NotifyCallEventOccurred( MCCPCallObserver::ECCPSecureNotSpecified ); |
|
125 break; |
|
126 } |
|
127 |
|
128 default: |
|
129 { |
|
130 CSPLOGSTRING(CSPERROR, "CSPCall::SecuritySettingChanged, \ |
|
131 unknown event"); |
|
132 break; |
|
133 } |
|
134 } |
|
135 } |
|
136 |
|
137 // --------------------------------------------------------------------------- |
|
138 // CSPCall::RemoteAlertingToneStatusChanged |
|
139 // Sends EarlyMediaStarted event to observer if network has started to |
|
140 // play remote alerting tone. There is only one known use case: Network |
|
141 // starts playing alerting tone during connecting state. |
|
142 // |
|
143 // This RemoteAlertingToneStatusChanged is called for every call, |
|
144 // so it is calls responsibility to determine if the |
|
145 // observer should be notified. |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 void CSPCall::RemoteAlertingToneStatusChanged( |
|
149 RMmCustomAPI::TRemoteAlertingToneStatus aNewStatus ) |
|
150 { |
|
151 CSPLOGSTRING2(CSPINT, |
|
152 "CSPCall::RemoteAlertingToneStatusChanged new status: %d", aNewStatus ); |
|
153 |
|
154 if ( aNewStatus == RMmCustomAPI::EUiStopTone || |
|
155 aNewStatus == RMmCustomAPI::EUiNoTone ) // NW tells us to stop playing |
|
156 { |
|
157 // Connecting is only state where network starts playing the tone. |
|
158 if ( iCallState == MCCPCallObserver::ECCPStateConnecting ) |
|
159 { |
|
160 NotifyCallEventOccurred( |
|
161 MCCPCallObserver::ECCCSPEarlyMediaStarted ); |
|
162 } |
|
163 } |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CSPCall::NotifyCallStateChangedETel |
|
168 // Notifies observers about state changes |
|
169 // --------------------------------------------------------------------------- |
|
170 // |
|
171 void CSPCall::NotifyCallStateChangedETel( RMobileCall::TMobileCallStatus aState ) |
|
172 { |
|
173 CSPLOGSTRING3(CSPINT, |
|
174 "CSPCall::NotifyCallStateChangedETel < state: %d this: %x", |
|
175 aState, this ); |
|
176 switch ( aState ) |
|
177 { |
|
178 /* |
|
179 Cannot receive any mapping call statuses from ETel to following |
|
180 optional states: |
|
181 |
|
182 ECCPStateForwarding MO call is being forwarded at receiver end |
|
183 ECCPStateQueued Call is queued locally. |
|
184 |
|
185 The commented observer calls are for CS specific call states. |
|
186 */ |
|
187 |
|
188 // Indicates that the call is idle or unknown. |
|
189 case RMobileCall::EStatusIdle: |
|
190 case RMobileCall::EStatusUnknown: |
|
191 { |
|
192 CSPLOGSTRING(CSPINT, "CSPCall::NotifyCallStateChangedETel Idle"); |
|
193 |
|
194 // If audio still active |
|
195 if ( iAudioStatus == ECSPCallAudioStatusActive |
|
196 && iAudioHandler |
|
197 && iParams->CallType() == CCPCall::ECallTypeCSVoice ) |
|
198 { |
|
199 iAudioStatus = ECSPCallAudioStatusInactive; |
|
200 iAudioHandler->Stop(); |
|
201 } |
|
202 |
|
203 // Notify error in case not going through disconnecting |
|
204 if ( iCallState != MCCPCallObserver::ECCPStateDisconnecting |
|
205 && !iTerminationErrorNotified ) |
|
206 { |
|
207 CheckAndNotifyTerminationError(); |
|
208 } |
|
209 |
|
210 NotifyCallStateChanged( MCCPCallObserver::ECCPStateIdle ); |
|
211 iCommonInfo.IndicateHangupComplete( *this ); |
|
212 break; |
|
213 } |
|
214 // The call is dialling. |
|
215 case RMobileCall::EStatusDialling: |
|
216 CSPLOGSTRING(CSPINT, "CSPCall callstate Dialling"); |
|
217 { |
|
218 if ( iAudioHandler && iParams->CallType() == CCPCall:: ECallTypeCSVoice ) |
|
219 { |
|
220 iAudioStatus = ECSPCallAudioStatusActive; |
|
221 iAudioHandler->Start(); |
|
222 } |
|
223 |
|
224 iDontReportTerm = EFalse; |
|
225 NotifyCallStateChanged( MCCPCallObserver::ECCPStateDialling ); |
|
226 break; |
|
227 } |
|
228 //Indicates that the MT call is ringing but not answered yet by |
|
229 // the local user |
|
230 case RMobileCall::EStatusRinging: |
|
231 { |
|
232 CSPLOGSTRING(CSPINT, "CSPCall::NotifyCallStateChangedETel Ringing"); |
|
233 NotifyCallStateChanged( MCCPCallObserver::ECCPStateRinging ); |
|
234 break; |
|
235 } |
|
236 // Indicates that the local user has answered the MT call but |
|
237 // the network has not acknowledged the call connection yet. |
|
238 case RMobileCall::EStatusAnswering: |
|
239 { |
|
240 CSPLOGSTRING(CSPINT, "CSPCall::NotifyCallStateChangedETel Answering"); |
|
241 |
|
242 if ( !iMobileOriginated |
|
243 && iAudioHandler |
|
244 && iAudioStatus == ECSPCallAudioStatusInactive |
|
245 && iParams->CallType() == CCPCall::ECallTypeCSVoice ) |
|
246 { |
|
247 iAudioStatus = ECSPCallAudioStatusActive; |
|
248 iAudioHandler->Start(); |
|
249 } |
|
250 |
|
251 NotifyCallStateChanged( MCCPCallObserver::ECCPStateAnswering ); |
|
252 break; |
|
253 } |
|
254 // MO Call: the network notifies to the MS that the remote party |
|
255 // is now ringing. |
|
256 case RMobileCall::EStatusConnecting: |
|
257 { |
|
258 CSPLOGSTRING(CSPINT, "CSPCall::NotifyCallStateChangedETelConnecting"); |
|
259 RMmCustomAPI::TRemoteAlertingToneStatus tone = |
|
260 iCommonInfo.GetRemoteAlertingToneStatus(); |
|
261 if ( tone == RMmCustomAPI::EUiNoTone || |
|
262 tone == RMmCustomAPI::EUiStopTone ) |
|
263 { |
|
264 NotifyCallStateChangedWithInband( MCCPCallObserver::ECCPStateConnecting ); |
|
265 } |
|
266 else |
|
267 { |
|
268 NotifyCallStateChanged( MCCPCallObserver::ECCPStateConnecting ); |
|
269 } |
|
270 break; |
|
271 } |
|
272 // Indicates that call is connected and active. |
|
273 case RMobileCall::EStatusConnected: |
|
274 { |
|
275 CSPLOGSTRING(CSPINT, "CSPCall::NotifyCallStateChangedETel Connected"); |
|
276 |
|
277 iDontReportTerm = ETrue; |
|
278 NotifyCallStateChanged( MCCPCallObserver::ECCPStateConnected ); |
|
279 break; |
|
280 } |
|
281 // Indicates that call is disconnecting. (Same as RCall::HangingUp) |
|
282 case RMobileCall::EStatusDisconnecting: |
|
283 { |
|
284 CSPLOGSTRING(CSPINT, "CSPCall::NotifyCallStateChangedETel Disconnecting"); |
|
285 |
|
286 if ( !iTerminationErrorNotified ) |
|
287 { |
|
288 CheckAndNotifyTerminationError(); |
|
289 } |
|
290 |
|
291 NotifyCallStateChanged( MCCPCallObserver::ECCPStateDisconnecting ); |
|
292 break; |
|
293 } |
|
294 // Indicates that the call is disconnecting with inband data |
|
295 // (to enable the network to send an audio tone), signifying |
|
296 // that the call is not to be released until user terminates call |
|
297 case RMobileCall::EStatusDisconnectingWithInband: |
|
298 { |
|
299 CSPLOGSTRING(CSPINT, |
|
300 "CSPCall::NotifyCallStateChangedETel DisconnectingWithInband"); |
|
301 |
|
302 if ( !iTerminationErrorNotified ) |
|
303 { |
|
304 CheckAndNotifyTerminationError(); |
|
305 } |
|
306 |
|
307 NotifyCallStateChangedWithInband( |
|
308 MCCPCallObserver::ECCPStateDisconnecting ); |
|
309 break; |
|
310 } |
|
311 // Indicates that the call is connected but on hold. |
|
312 case RMobileCall::EStatusHold: |
|
313 { |
|
314 CSPLOGSTRING(CSPINT, "CSPCall::NotifyCallStateChangedETel Hold"); |
|
315 NotifyCallStateChanged( MCCPCallObserver::ECCPStateHold ); |
|
316 break; |
|
317 } |
|
318 case RMobileCall::EStatusTransferring: |
|
319 { |
|
320 CSPLOGSTRING(CSPINT, "CSPCall::NotifyCallStateChangedETel Transferring"); |
|
321 NotifyCallStateChanged( MCCPCallObserver::ECCPStateTransferring ); |
|
322 break; |
|
323 } |
|
324 |
|
325 // Indicates that call is undergoing temporary channel loss |
|
326 // and it may or may not be reconnected. |
|
327 case RMobileCall::EStatusReconnectPending: // fall through |
|
328 //Indicates that the call is the non-active half of an alternating |
|
329 // call. This call is waiting for its active half or the remote |
|
330 // end to switch alternating call mode. |
|
331 case RMobileCall::EStatusWaitingAlternatingCallSwitch: // fall through |
|
332 case RMobileCall::EStatusTransferAlerting: |
|
333 { |
|
334 CSPLOGSTRING2(CSPINT, |
|
335 "CSPCall::NotifyCallStateChangedETel no special handling for state %d", |
|
336 aState); |
|
337 break; |
|
338 } |
|
339 |
|
340 default: |
|
341 { |
|
342 CSPLOGSTRING(CSPERROR, |
|
343 "CSPCall::NotifyCallStateChangedETel callstate UNKNOWN"); |
|
344 break; |
|
345 } |
|
346 } |
|
347 CSPLOGSTRING(CSPREQIN, "CSPCall::NotifyCallStateChangedETel >"); |
|
348 } |
|
349 |
|
350 // --------------------------------------------------------------------------- |
|
351 // CSPCall::NotifyCallEventOccurred |
|
352 // Notifies observers about call events |
|
353 // --------------------------------------------------------------------------- |
|
354 // |
|
355 void CSPCall::NotifyCallEventOccurred( |
|
356 MCCPCallObserver::TCCPCallEvent aEvent ) |
|
357 { |
|
358 CSPLOGSTRING2(CSPINT, |
|
359 "CSPCall::NotifyCallEventOccurred < event: %d", aEvent); |
|
360 |
|
361 TInt obsCount = iObservers.Count(); |
|
362 for ( TInt i = 0; i < obsCount; i++ ) |
|
363 { |
|
364 CSPLOGSTRING2(CSPINT, "CSPCall::NotifyCallEventOccurred obs=%d",i); |
|
365 MCCPCallObserver *obs = iObservers[i]; |
|
366 if ( obs ) |
|
367 { |
|
368 obs->CallEventOccurred( aEvent, this ); |
|
369 } |
|
370 |
|
371 CSPLOGSTRING2(CSPINT, "CSPCall::NotifyCallEventOccurred ok obs=%d",i); |
|
372 } |
|
373 |
|
374 CSPLOGSTRING2(CSPINT, "CSPCall::NotifyCallEventOccurred > event: %d", aEvent); |
|
375 } |
|
376 |
|
377 // --------------------------------------------------------------------------- |
|
378 // CSPCall::NotifyTransferCallEventOccurred |
|
379 // Forward notification of transfer event to it's provider |
|
380 // --------------------------------------------------------------------------- |
|
381 // |
|
382 void CSPCall::NotifyTransferCallEventOccurred( |
|
383 MCCPTransferObserver::TCCPTransferEvent aEvent ) |
|
384 { |
|
385 CSPLOGSTRING2(CSPINT, "CSPCall::NotifyTransferCallEventOccurred %d", aEvent); |
|
386 // forward the method call to CSPTransferProvider object |
|
387 iTransferProvider->TransferEventOccurred( aEvent ); |
|
388 } |
|
389 |
|
390 // --------------------------------------------------------------------------- |
|
391 // CSPCall::NotifyForwardEventOccurred |
|
392 // Notifies observers about call events |
|
393 // --------------------------------------------------------------------------- |
|
394 // |
|
395 void CSPCall::NotifyForwardEventOccurred( |
|
396 MCCPForwardObserver::TCCPForwardEvent aEvent ) |
|
397 { |
|
398 CSPLOGSTRING2(CSPINT, "CSPCall::NotifyForwardEventOccurred %d", aEvent); |
|
399 iForwardProvider->NotifyForwardEventOccurred( aEvent ); |
|
400 } |
|
401 |
|
402 // --------------------------------------------------------------------------- |
|
403 // CSPCall::CallName |
|
404 // Get call name |
|
405 // --------------------------------------------------------------------------- |
|
406 // |
|
407 void CSPCall::CallName( TName& aCallName ) |
|
408 { |
|
409 CSPLOGSTRING(CSPINT, "CSPCall::CallName"); |
|
410 aCallName.Zero(); |
|
411 aCallName.Append( iCallName ); |
|
412 } |
|
413 |
|
414 // --------------------------------------------------------------------------- |
|
415 // CSPCall::DialRequestFailed |
|
416 // Handles situations when dial fails |
|
417 // --------------------------------------------------------------------------- |
|
418 // |
|
419 void CSPCall::DialRequestFailed( TInt aErrorCode ) |
|
420 { |
|
421 CSPLOGSTRING(CSPERROR, "CSPCall::DialRequestFailed"); |
|
422 iDialCompletionCode = aErrorCode; |
|
423 |
|
424 // If state has not changed |
|
425 // ( e.g. in case of dial could not be initiated by network problem) |
|
426 if ( iCallStatusMonitor->State() == |
|
427 RMobileCall::RMobileCall::EStatusUnknown ) |
|
428 { |
|
429 NotifyErrorOccurred( iRequester->MapError( aErrorCode ) ); |
|
430 |
|
431 // Force release since otherwise call remains unreleased |
|
432 CSPLOGSTRING(CSPERROR, "CSPCall::DialRequestFailed() Force Idle"); |
|
433 NotifyCallStateChanged( MCCPCallObserver::ECCPStateIdle ); |
|
434 } |
|
435 |
|
436 // If dial request has completed after notifying disconnecting state |
|
437 else if ( iCallState == MCCPCallObserver::ECCPStateDisconnecting |
|
438 && !iTerminationErrorNotified ) |
|
439 { |
|
440 CheckAndNotifyTerminationError(); |
|
441 } |
|
442 } |
|
443 |
|
444 // --------------------------------------------------------------------------- |
|
445 // CSPCall::EmergencyDialRequestFailed |
|
446 // Handles situations when emergency dial fails |
|
447 // --------------------------------------------------------------------------- |
|
448 // |
|
449 void CSPCall::EmergencyDialRequestFailed( TInt /*aErrorCode*/ ) |
|
450 { |
|
451 CSPLOGSTRING(CSPERROR, "CSPCall::EmergencyDialRequestFailed"); |
|
452 |
|
453 // Always same error code for CCE |
|
454 NotifyErrorOccurred( ECCPEmergencyFailed ); |
|
455 |
|
456 // Mark that exit code will not be used |
|
457 iTerminationErrorNotified = ETrue; |
|
458 } |
|
459 |
|
460 // --------------------------------------------------------------------------- |
|
461 // CSPCall::NotifyErrorOccurred |
|
462 // Notifies observers about errors |
|
463 // --------------------------------------------------------------------------- |
|
464 // |
|
465 void CSPCall::NotifyErrorOccurred( TCCPError aError ) |
|
466 { |
|
467 CSPLOGSTRING2(CSPERROR, "CSPCall::NotifyErrorOccurred err %d", aError ); |
|
468 |
|
469 TInt obsCount = iObservers.Count(); |
|
470 for ( TInt i = 0; i < obsCount; i++ ) |
|
471 { |
|
472 MCCPCallObserver *obs = iObservers[i]; |
|
473 if ( obs ) |
|
474 { |
|
475 obs->ErrorOccurred( aError, this ); |
|
476 } |
|
477 } |
|
478 } |
|
479 |
|
480 // --------------------------------------------------------------------------- |
|
481 // CSPCall::CallCapsChanged |
|
482 // Notifies observers about new capabilities. |
|
483 // --------------------------------------------------------------------------- |
|
484 // |
|
485 void CSPCall::CallCapsChanged( const TUint32 aCapsFlags ) |
|
486 { |
|
487 CSPLOGSTRING2(CSPERROR, "CSPCall::CallCapsChanged %b", aCapsFlags ); |
|
488 iCapsFlags = aCapsFlags; |
|
489 TInt obsCount = iObservers.Count(); |
|
490 for ( TInt i = 0; i < obsCount; i++ ) |
|
491 { |
|
492 MCCPCallObserver *obs = iObservers[i]; |
|
493 if ( obs ) |
|
494 { |
|
495 obs->CallCapsChanged( aCapsFlags, this ); |
|
496 } |
|
497 } |
|
498 } |
|
499 |
|
500 // --------------------------------------------------------------------------- |
|
501 // From class MCCPCSCall |
|
502 // CSPCall::GetMobileCallInfo |
|
503 // --------------------------------------------------------------------------- |
|
504 // |
|
505 TInt CSPCall::GetMobileCallInfo( TDes8& aCallInfo ) const |
|
506 { |
|
507 CSPLOGSTRING(CSPINT, "CSPCall::GetMobileCallInfo"); |
|
508 return iCall.GetMobileCallInfo( aCallInfo ); |
|
509 } |
|
510 |
|
511 // --------------------------------------------------------------------------- |
|
512 // From class MCCPCSCall |
|
513 // CSPCall::GetMobileDataCallCaps |
|
514 // --------------------------------------------------------------------------- |
|
515 // |
|
516 TInt CSPCall::GetMobileDataCallCaps( TDes8& /*aCaps*/ ) const |
|
517 { |
|
518 CSPLOGSTRING(CSPERROR, |
|
519 "CSPCall::GetMobileDataCallCaps ERROR, Not supported"); |
|
520 return KErrNotSupported; |
|
521 } |
|
522 |
|
523 // --------------------------------------------------------------------------- |
|
524 // From class MCCPCall |
|
525 // CSPCall::Dial |
|
526 // --------------------------------------------------------------------------- |
|
527 // |
|
528 TInt CSPCall::Dial() |
|
529 { |
|
530 CSPLOGSTRING( CSPREQIN, "CSPCall::Dial" ); |
|
531 // Parameters not given, must create empty descriptor. |
|
532 TBuf8<1> params; |
|
533 return Dial(params); |
|
534 } |
|
535 |
|
536 // --------------------------------------------------------------------------- |
|
537 // From class MCCPCall |
|
538 // CSPCall::RemoteParty |
|
539 // --------------------------------------------------------------------------- |
|
540 // |
|
541 const TDesC& CSPCall::RemoteParty() const |
|
542 { |
|
543 CSPLOGSTRING(CSPREQIN, "CSPCall::RemoteParty"); |
|
544 return iRemotePartyNumber; |
|
545 } |
|
546 |
|
547 // --------------------------------------------------------------------------- |
|
548 // From class MCCPCall |
|
549 // CSPCall::RemotePartyName |
|
550 // --------------------------------------------------------------------------- |
|
551 // |
|
552 const TDesC& CSPCall::RemotePartyName() |
|
553 { |
|
554 CSPLOGSTRING(CSPREQIN, "CSPCall::RemotePartyName"); |
|
555 return iRemotePartyName; |
|
556 } |
|
557 |
|
558 // --------------------------------------------------------------------------- |
|
559 // From class MCCPCall |
|
560 // CSPCall::DialledParty |
|
561 // --------------------------------------------------------------------------- |
|
562 // |
|
563 const TDesC& CSPCall::DialledParty() const |
|
564 { |
|
565 CSPLOGSTRING2(CSPREQIN, "CSPCall::DialledParty %S", &iRemotePartyNumber); |
|
566 return iRemotePartyNumber; |
|
567 } |
|
568 |
|
569 // --------------------------------------------------------------------------- |
|
570 // From class MCCPCall |
|
571 // CSPCall::Answer |
|
572 // --------------------------------------------------------------------------- |
|
573 // |
|
574 TInt CSPCall::Answer() |
|
575 { |
|
576 CSPLOGSTRING(CSPREQIN, "CSPCall::Answer <"); |
|
577 TInt ret( KErrNone ); |
|
578 |
|
579 if ( iCallState == MCCPCallObserver::ECCPStateRinging |
|
580 || iCallState == MCCPCallObserver::ECCPStateQueued ) |
|
581 { |
|
582 if( iMobileOriginated ) |
|
583 { |
|
584 ret = KErrGeneral; |
|
585 } |
|
586 else if( iCallState != MCCPCallObserver::ECCPStateRinging && |
|
587 iCallState != MCCPCallObserver::ECCPStateQueued ) |
|
588 { |
|
589 ret = KErrAccessDenied; |
|
590 } |
|
591 else |
|
592 { |
|
593 ret = iCommonInfo.IndicateAnswerRequest( *this ); |
|
594 } |
|
595 } |
|
596 else |
|
597 { |
|
598 // Not correct state for answer |
|
599 ret = KErrNotReady; |
|
600 } |
|
601 |
|
602 CSPLOGSTRING2(CSPREQIN, "CSPCall::Answer > ret %d", ret); |
|
603 return ret; |
|
604 } |
|
605 |
|
606 // --------------------------------------------------------------------------- |
|
607 // From class MCCPCallCommandHandling |
|
608 // CSPCall::PerformAnswerRequest |
|
609 // --------------------------------------------------------------------------- |
|
610 // |
|
611 TInt CSPCall::PerformAnswerRequest() |
|
612 { |
|
613 CSPLOGSTRING(CSPREQIN, "CSPCall::PerformAnswerRequest"); |
|
614 |
|
615 TInt ret = iRequester->MakeRequest( CSPEtelCallRequester::ERequestTypeAnswer ); |
|
616 CSPLOGSTRING3(CSPINT, |
|
617 "CSPCall::Answer request performed, call state %d ret: %d", iCallState, ret); |
|
618 |
|
619 return ret; |
|
620 } |
|
621 |
|
622 // --------------------------------------------------------------------------- |
|
623 // From class MCCPCall |
|
624 // CSPCall::Reject |
|
625 // --------------------------------------------------------------------------- |
|
626 // |
|
627 TInt CSPCall::Reject() |
|
628 { |
|
629 CSPLOGSTRING(CSPREQIN, "CSPCall::Reject <"); |
|
630 TInt ret; |
|
631 if ( iCallState == MCCPCallObserver::ECCPStateRinging |
|
632 || iCallState == MCCPCallObserver::ECCPStateQueued |
|
633 || iCallState == MCCPCallObserver::ECCPStateAnswering ) |
|
634 { |
|
635 CSPLOGSTRING( CSPREQIN, "CSPCall::Reject 2" ); |
|
636 ret = HangUp(); |
|
637 } |
|
638 else |
|
639 { |
|
640 ret = KErrNotReady; |
|
641 } |
|
642 CSPLOGSTRING2(CSPREQIN, "CSPCall::Reject > ret: %d", ret ); |
|
643 return ret; |
|
644 } |
|
645 |
|
646 // --------------------------------------------------------------------------- |
|
647 // From class MCCPCall |
|
648 // CSPCall::Queue |
|
649 // --------------------------------------------------------------------------- |
|
650 // |
|
651 TInt CSPCall::Queue() |
|
652 { |
|
653 CSPLOGSTRING(CSPREQIN, "CSPCall::Queue"); |
|
654 TBool callWaitingState; |
|
655 iDontReportTerm = ETrue; |
|
656 |
|
657 TRAPD( res, iCommonInfo.GetCallWaitingL( *iParams, callWaitingState ) ); |
|
658 if( res == KErrNone ) |
|
659 { |
|
660 if ( callWaitingState ) |
|
661 { |
|
662 CSPLOGSTRING(CSPREQIN, "CSPCall::Queue Call Waiting On"); |
|
663 iCallState = MCCPCallObserver::ECCPStateQueued; |
|
664 |
|
665 // Notify Queued state |
|
666 TInt obsCount = iObservers.Count ( ); |
|
667 for (TInt i = 0; i < obsCount; i++ ) |
|
668 { |
|
669 MCCPCallObserver *obs = iObservers[i]; |
|
670 if ( obs ) |
|
671 { |
|
672 obs->CallStateChanged ( iCallState, this ); |
|
673 } |
|
674 } |
|
675 CSPLOGSTRING(CSPOBJECT, "CSPCall::Queue ok"); |
|
676 |
|
677 return KErrNone; |
|
678 } |
|
679 else |
|
680 { |
|
681 CSPLOGSTRING(CSPREQIN, "CSPCall::Queue Call Waiting Off"); |
|
682 } |
|
683 } |
|
684 else |
|
685 { |
|
686 CSPLOGSTRING2(CSPERROR, |
|
687 "CSPCall::Queue Error %d with CR. Call Waiting Off", |
|
688 res); |
|
689 } |
|
690 |
|
691 return KErrNotSupported; |
|
692 } |
|
693 |
|
694 // --------------------------------------------------------------------------- |
|
695 // From class MCCPCall |
|
696 // CSPCall::Ringing |
|
697 // --------------------------------------------------------------------------- |
|
698 // |
|
699 TInt CSPCall::Ringing() |
|
700 { |
|
701 CSPLOGSTRING(CSPREQIN, "CSPCall::Ringing"); |
|
702 iDontReportTerm = ETrue; |
|
703 |
|
704 // Ringing state is accepted because MT-call goes to ringing |
|
705 // state in the beginning based on ETel state maching. |
|
706 if ( iCallState == MCCPCallObserver::ECCPStateIdle || |
|
707 iCallState == MCCPCallObserver::ECCPStateRinging ) |
|
708 { |
|
709 NotifyRingingState(); |
|
710 return KErrNone; |
|
711 } |
|
712 else if ( iCallState == MCCPCallObserver::ECCPStateAnswering ) |
|
713 { |
|
714 // Do nothing if already in Answering state (autoanswer). |
|
715 return KErrNone; |
|
716 } |
|
717 |
|
718 return KErrNotReady; |
|
719 } |
|
720 |
|
721 // --------------------------------------------------------------------------- |
|
722 // From class MCCPCall |
|
723 // CSPCall::HangUp |
|
724 // --------------------------------------------------------------------------- |
|
725 // |
|
726 TInt CSPCall::HangUp() |
|
727 { |
|
728 CSPLOGSTRING2(CSPREQIN, "CSPCall::HangUp this: %x", this); |
|
729 TInt ret( KErrNone ); |
|
730 |
|
731 CSPEtelCallRequester::TRequestType req = iRequester->Request(); |
|
732 if ( req == CSPEtelCallRequester::ERequestTypeDial || |
|
733 ( req == CSPEtelCallRequester::ERequestTypeDialEmergency ) ) |
|
734 { |
|
735 CSPLOGSTRING(CSPREQIN, "CSPCall::HangUp 1: Cancel ongoing dial"); |
|
736 ret = iRequester->DialCancel(); |
|
737 CSPLOGSTRING(CSPREQIN, "CSPCall::HangUp Canceled"); |
|
738 } |
|
739 else if ( req == CSPEtelCallRequester::ERequestTypeHangup ) |
|
740 { |
|
741 CSPLOGSTRING(CSPREQIN, "CSPCall::HangUp 2"); |
|
742 ret = KErrAlreadyExists; |
|
743 } |
|
744 else if ( req == CSPEtelCallRequester::ERequestTypeNone |
|
745 && iCallState != MCCPCallObserver::ECCPStateIdle ) |
|
746 { |
|
747 CSPLOGSTRING(CSPREQIN, "CSPCall::HangUp 3"); |
|
748 ret = iRequester->MakeRequest( CSPEtelCallRequester::ERequestTypeHangup ); |
|
749 iCommonInfo.IndicateActiveHangup( *this ); |
|
750 } |
|
751 else if ( req == CSPEtelCallRequester::ERequestTypeNone ) |
|
752 { |
|
753 CSPLOGSTRING(CSPREQIN, "CSPCall::HangUp 4"); |
|
754 ret = KErrAlreadyExists; |
|
755 } |
|
756 else |
|
757 { |
|
758 CSPLOGSTRING(CSPREQIN, "CSPCall::HangUp 5"); |
|
759 // Request pending, must be canceled |
|
760 iRequester->Cancel(); |
|
761 ret = iRequester->MakeRequest( CSPEtelCallRequester::ERequestTypeHangup ); |
|
762 iCommonInfo.IndicateActiveHangup( *this ); |
|
763 } |
|
764 |
|
765 return ret; |
|
766 } |
|
767 |
|
768 // --------------------------------------------------------------------------- |
|
769 // From class MCCPCall |
|
770 // CSPCall::Cancel |
|
771 // --------------------------------------------------------------------------- |
|
772 // |
|
773 TInt CSPCall::Cancel() |
|
774 { |
|
775 CSPLOGSTRING(CSPREQIN, "CSPCall::Cancel"); |
|
776 return HangUp(); |
|
777 } |
|
778 |
|
779 // --------------------------------------------------------------------------- |
|
780 // From class MCCPCall |
|
781 // CSPCall::Hold |
|
782 // --------------------------------------------------------------------------- |
|
783 // |
|
784 TInt CSPCall::Hold() |
|
785 { |
|
786 CSPLOGSTRING2(CSPREQIN, "CSPCall::Hold this: %x", this); |
|
787 TInt ret; |
|
788 |
|
789 if ( iCallState == MCCPCallObserver::ECCPStateConnected ) |
|
790 { |
|
791 CSPLOGSTRING(CSPREQOUT, "CSPCall::Hold make request"); |
|
792 |
|
793 // Set call on hold |
|
794 ret = iRequester->MakeRequest( |
|
795 CSPEtelCallRequester::ERequestTypeHold ); |
|
796 if ( ret != KErrNone ) |
|
797 { |
|
798 CSPLOGSTRING2(CSPERROR, |
|
799 "CSPCall::Hold ERROR: %d", ret); |
|
800 } |
|
801 } |
|
802 else if ( iCallState == MCCPCallObserver::ECCPStateHold ) |
|
803 { |
|
804 CSPLOGSTRING(CSPERROR, "CSPCall::Hold : already held"); |
|
805 ret = KErrAlreadyExists; |
|
806 } |
|
807 else |
|
808 { |
|
809 CSPLOGSTRING(CSPERROR, "CSPCall::Hold not allowed"); |
|
810 ret = KErrNotReady; |
|
811 } |
|
812 |
|
813 return ret; |
|
814 } |
|
815 |
|
816 // --------------------------------------------------------------------------- |
|
817 // From class MCCPCall |
|
818 // CSPCall::Resume |
|
819 // --------------------------------------------------------------------------- |
|
820 // |
|
821 TInt CSPCall::Resume() |
|
822 { |
|
823 CSPLOGSTRING2(CSPREQIN, "CSPCall::Resume this: %x", this); |
|
824 TInt ret; |
|
825 |
|
826 if ( iCallState == MCCPCallObserver::ECCPStateHold ) |
|
827 { |
|
828 CSPLOGSTRING(CSPREQOUT, "CSPCall::Resume request"); |
|
829 |
|
830 ret = iRequester->MakeRequest( |
|
831 CSPEtelCallRequester::ERequestTypeResume ); |
|
832 if ( KErrNone != ret ) |
|
833 { |
|
834 CSPLOGSTRING2(CSPERROR, "CSPCall::Resume ERROR %d", ret); |
|
835 } |
|
836 } |
|
837 else if ( iCallState == MCCPCallObserver::ECCPStateConnected ) |
|
838 { |
|
839 CSPLOGSTRING(CSPERROR, "CSPCall::Resume already connected" ); |
|
840 ret = KErrAlreadyExists; |
|
841 } |
|
842 else |
|
843 { |
|
844 CSPLOGSTRING(CSPERROR, "CSPCall::Resume not held state" ); |
|
845 ret = KErrNotReady; |
|
846 } |
|
847 |
|
848 return ret; |
|
849 } |
|
850 |
|
851 // --------------------------------------------------------------------------- |
|
852 // From class MCCPCall |
|
853 // CSPCall::Swap |
|
854 // --------------------------------------------------------------------------- |
|
855 // |
|
856 TInt CSPCall::Swap() |
|
857 { |
|
858 CSPLOGSTRING2(CSPREQIN, "CSPCall::Swap this: %x", this); |
|
859 TInt ret; |
|
860 if ( iCallState == MCCPCallObserver::ECCPStateConnected |
|
861 || iCallState == MCCPCallObserver::ECCPStateHold ) |
|
862 { |
|
863 ret = iRequester->MakeRequest( CSPEtelCallRequester::ERequestTypeSwap ); |
|
864 if ( ret ) |
|
865 { |
|
866 CSPLOGSTRING2( CSPERROR, "CSPCall::Swap Error %d", ret ); |
|
867 } |
|
868 } |
|
869 else |
|
870 { |
|
871 ret = KErrNotReady; |
|
872 } |
|
873 return ret; |
|
874 } |
|
875 |
|
876 // --------------------------------------------------------------------------- |
|
877 // From class MCCPCall |
|
878 // CSPCall::IsMobileOriginated |
|
879 // --------------------------------------------------------------------------- |
|
880 // |
|
881 TBool CSPCall::IsMobileOriginated() const |
|
882 { |
|
883 CSPLOGSTRING(CSPREQIN, "CSPCall::IsMobileOriginated"); |
|
884 return iMobileOriginated; |
|
885 } |
|
886 |
|
887 // --------------------------------------------------------------------------- |
|
888 // From class MCCPCall |
|
889 // CSPCall::State |
|
890 // --------------------------------------------------------------------------- |
|
891 // |
|
892 MCCPCallObserver::TCCPCallState CSPCall::State() const |
|
893 { |
|
894 CSPLOGSTRING2(CSPREQIN, "CSPCall::State %d", iCallState); |
|
895 return iCallState; |
|
896 } |
|
897 |
|
898 // --------------------------------------------------------------------------- |
|
899 // From class MCCPCall |
|
900 // CSPCall::Uid |
|
901 // --------------------------------------------------------------------------- |
|
902 // |
|
903 TUid CSPCall::Uid() const |
|
904 { |
|
905 CSPLOGSTRING2(CSPREQIN, "CSPCall::Uid %d", KCSPImplementationUid); |
|
906 return KCSPImplementationUid; |
|
907 } |
|
908 |
|
909 // --------------------------------------------------------------------------- |
|
910 // From class MCCPCall |
|
911 // CSPCall::Caps |
|
912 // --------------------------------------------------------------------------- |
|
913 // |
|
914 MCCPCallObserver::TCCPCallControlCaps CSPCall::Caps( ) const |
|
915 { |
|
916 CSPLOGSTRING2(CSPREQIN, "CSPCall::Caps %b", iCapsFlags ); |
|
917 return (MCCPCallObserver::TCCPCallControlCaps) iCapsFlags; |
|
918 } |
|
919 |
|
920 // --------------------------------------------------------------------------- |
|
921 // From class MCCPCall |
|
922 // CSPCall::SetParameters |
|
923 // --------------------------------------------------------------------------- |
|
924 // |
|
925 void CSPCall::SetParameters( const CCCPCallParameters& /*aNewParams*/ ) |
|
926 { |
|
927 CSPLOGSTRING(CSPOBJECT, "CSPCall::SetParameters ERROR Can't set params"); |
|
928 } |
|
929 |
|
930 // --------------------------------------------------------------------------- |
|
931 // From class MCCPCall |
|
932 // CSPCall::Parameters |
|
933 // --------------------------------------------------------------------------- |
|
934 // |
|
935 const CCCPCallParameters& CSPCall::Parameters() const |
|
936 { |
|
937 CSPLOGSTRING(CSPINT, "CSPCall::Parameters"); |
|
938 return *iParams; |
|
939 } |
|
940 |
|
941 // --------------------------------------------------------------------------- |
|
942 // From class MCCPCall |
|
943 // CSPCall::TransferProvider |
|
944 // --------------------------------------------------------------------------- |
|
945 // |
|
946 MCCPTransferProvider* CSPCall::TransferProviderL(const MCCPTransferObserver& |
|
947 aObserver ) |
|
948 { |
|
949 CSPLOGSTRING(CSPREQIN, "CSPCall::TransferProvider"); |
|
950 iTransferProvider->AddObserverL( aObserver ); |
|
951 return iTransferProvider; |
|
952 } |
|
953 |
|
954 // --------------------------------------------------------------------------- |
|
955 // From class MCCPCall |
|
956 // CSPCall::ForwardProvider |
|
957 // --------------------------------------------------------------------------- |
|
958 // |
|
959 MCCPForwardProvider* CSPCall::ForwardProviderL( |
|
960 const MCCPForwardObserver& aObserver ) |
|
961 { |
|
962 CSPLOGSTRING(CSPREQIN, "CSPCall::ForwardProvider"); |
|
963 iForwardProvider->AddObserverL( aObserver ); |
|
964 return iForwardProvider; |
|
965 } |
|
966 |
|
967 // --------------------------------------------------------------------------- |
|
968 // From class MCCPCall |
|
969 // CSPCall::AddObserverL |
|
970 // --------------------------------------------------------------------------- |
|
971 // |
|
972 void CSPCall::AddObserverL( const MCCPCallObserver& aObserver ) |
|
973 { |
|
974 CSPLOGSTRING2(CSPREQIN, "CSPCall::AddObserverL %x", &aObserver); |
|
975 if ( iObservers.Find( &aObserver ) == KErrNotFound ) |
|
976 { |
|
977 iObservers.AppendL( &aObserver ); |
|
978 } |
|
979 } |
|
980 |
|
981 // --------------------------------------------------------------------------- |
|
982 // From class MCCPCall |
|
983 // Removes observer. |
|
984 // --------------------------------------------------------------------------- |
|
985 // |
|
986 TInt CSPCall::RemoveObserver( const MCCPCallObserver& aObserver ) |
|
987 { |
|
988 CSPLOGSTRING2(CSPREQIN, "CSPCall::RemoveObserver %x", &aObserver); |
|
989 |
|
990 TInt found = iObservers.Find( &aObserver ); |
|
991 if ( found != KErrNotFound ) |
|
992 { |
|
993 iObservers.Remove( found ); |
|
994 return KErrNone; |
|
995 } |
|
996 |
|
997 return found; |
|
998 } |
|
999 |
|
1000 // --------------------------------------------------------------------------- |
|
1001 // From class MCCPCall |
|
1002 // CSPCall::IsCallForwarded |
|
1003 // --------------------------------------------------------------------------- |
|
1004 // |
|
1005 TBool CSPCall::IsCallForwarded( ) const |
|
1006 { |
|
1007 CSPLOGSTRING(CSPREQIN, "CSPCall::IsCallForwarded <"); |
|
1008 TBool ret( EFalse ); |
|
1009 TInt err( KErrNone ); |
|
1010 RMobileCall::TMobileCallInfoV3 callInfo; |
|
1011 RMobileCall::TMobileCallInfoV3Pckg pck( callInfo ); |
|
1012 err = iCall.GetMobileCallInfo( pck ); |
|
1013 if (err == KErrNone ) |
|
1014 { |
|
1015 ret = callInfo.iForwarded; |
|
1016 } |
|
1017 |
|
1018 CSPLOGSTRING2(CSPREQIN, |
|
1019 "CSPCall::IsCallForwarded > forwarder: %d", ret ); |
|
1020 |
|
1021 return ret; |
|
1022 } |
|
1023 |
|
1024 // --------------------------------------------------------------------------- |
|
1025 // From class MCCPCall |
|
1026 // CSPCall::IsSecured |
|
1027 // --------------------------------------------------------------------------- |
|
1028 // |
|
1029 TBool CSPCall::IsSecured( ) const |
|
1030 { |
|
1031 CSPLOGSTRING(CSPREQIN, "CSPCall::IsSecured"); |
|
1032 return iCommonInfo.NetworkSecurityStatus(); |
|
1033 } |
|
1034 |
|
1035 // --------------------------------------------------------------------------- |
|
1036 // From class MCCPCall |
|
1037 // CSPCall::SecureSpecified |
|
1038 // --------------------------------------------------------------------------- |
|
1039 // |
|
1040 TBool CSPCall::SecureSpecified( ) const |
|
1041 { |
|
1042 CSPLOGSTRING(CSPREQIN, "CSPCall::SecureSpecified"); |
|
1043 return iCommonInfo.SecureSpecified(); |
|
1044 } |
|
1045 |
|
1046 // --------------------------------------------------------------------------- |
|
1047 // From class MCCPCall |
|
1048 // CSPCall::Tone |
|
1049 // --------------------------------------------------------------------------- |
|
1050 // |
|
1051 TCCPTone CSPCall::Tone() const |
|
1052 { |
|
1053 CSPLOGSTRING(CSPREQIN, "CSPCall::Tone <"); |
|
1054 TCCPTone tone( ECCPNoSoundSequence ); |
|
1055 |
|
1056 if ( iCallState == MCCPCallObserver::ECCPStateConnecting ) |
|
1057 { |
|
1058 RMmCustomAPI::TRemoteAlertingToneStatus ts = iCommonInfo.GetRemoteAlertingToneStatus(); |
|
1059 |
|
1060 if (ts == RMmCustomAPI::EUiRbtTone ) |
|
1061 { |
|
1062 tone = ECCPRemoteAlerting; |
|
1063 } |
|
1064 else if ( ts == RMmCustomAPI::EUiStopTone ) |
|
1065 { |
|
1066 tone = ECCPNoSoundSequence; |
|
1067 } |
|
1068 else |
|
1069 { |
|
1070 // No tone |
|
1071 tone = ECCPNoSoundSequence; |
|
1072 } |
|
1073 } |
|
1074 else |
|
1075 { |
|
1076 // Handle disconnecting tones |
|
1077 TInt callDisconnectingError = ExitCodeError(); |
|
1078 CSPLOGSTRING2(CSPINT, "CSPCall::Tone exit code err: %d", callDisconnectingError); |
|
1079 |
|
1080 switch( callDisconnectingError ) |
|
1081 { |
|
1082 case KErrNone: |
|
1083 // GSM: DIAL TONE (optional) - not used in Nokia phones |
|
1084 CSPLOGSTRING(CSPERROR, "CSPCall::Tone: No sound"); |
|
1085 break; |
|
1086 case KErrGsmCCUserBusy: |
|
1087 // GSM: SUBSCRIBER BUSY |
|
1088 tone = ECCPToneUserBusy; |
|
1089 CSPLOGSTRING(CSPINT, "CSPCall::Tone: Subscriber Busy"); |
|
1090 break; |
|
1091 // Fall through |
|
1092 case KErrGsmCCNumberChanged: |
|
1093 case KErrGsmCCResponseToStatusEnquiry: |
|
1094 case KErrGsmCCNormalUnspecified: |
|
1095 // GSM: NONE, Nokia phones: radio path not available |
|
1096 tone = ECCPToneRadioPathNotAvailable; |
|
1097 CSPLOGSTRING(CSPINT, "CSPCall::Tone: RadioPathNotAvailable"); |
|
1098 break; |
|
1099 case KErrGsmCCNoChannelAvailable: |
|
1100 case KErrGsmCCTemporaryFailure: |
|
1101 case KErrGsmCCSwitchingEquipmentCongestion: |
|
1102 case KErrGsmCCRequestedChannelNotAvailable: |
|
1103 case KErrGsmCCQualityOfServiceNotAvailable: |
|
1104 case KErrGsmCCBearerCapabilityNotCurrentlyAvailable: |
|
1105 // GSM: CONGESTION |
|
1106 tone = ECCPToneCongestion; |
|
1107 CSPLOGSTRING(CSPINT, "CSPCall::Tone: Congestion"); |
|
1108 break; |
|
1109 case KErrGsmCCUnassignedNumber: |
|
1110 case KErrGsmCCNoRouteToDestination: |
|
1111 case KErrGsmCCChannelUnacceptable: |
|
1112 case KErrGsmCCOperatorDeterminedBarring: |
|
1113 case KErrGsmCCUserNotResponding: |
|
1114 case KErrGsmCCUserAlertingNoAnswer: |
|
1115 case KErrGsmCCCallRejected: |
|
1116 case KErrGsmCCNonSelectedUserClearing: |
|
1117 case KErrGsmCCDestinationOutOfOrder: |
|
1118 case KErrGsmCCInvalidNumberFormat: |
|
1119 case KErrGsmCCFacilityRejected: |
|
1120 case KErrGsmCCNetworkOutOfOrder: |
|
1121 case KErrGsmCCAccessInformationDiscarded: |
|
1122 case KErrGsmCCResourceNotAvailable: |
|
1123 case KErrGsmCCRequestedFacilityNotSubscribed: |
|
1124 case KErrGsmCCIncomingCallsBarredInCug: |
|
1125 case KErrGsmCCBearerCapabilityNotAuthorised: |
|
1126 case KErrGsmCCServiceNotAvailable: |
|
1127 case KErrGsmCCBearerServiceNotImplemented: |
|
1128 case KErrGsmCCChannelTypeNotImplemented: |
|
1129 case KErrGsmCCAcmGreaterThanAcmMax: |
|
1130 case KErrGsmCCRequestedFacilityNotImplemented: |
|
1131 case KErrGsmCCOnlyRestrictedDigitalInformationBCAvailable: |
|
1132 case KErrGsmCCServiceNotImplemented: |
|
1133 case KErrGsmCCInvalidCallReferenceValue: |
|
1134 case KErrGsmCCChannelDoesNotExist: |
|
1135 case KErrGsmCCSuspendedCallExistsButCallIdentityDoesNotWork: |
|
1136 case KErrGsmCCCallIdentityInUse: |
|
1137 case KErrGsmCCNoCallSuspended: |
|
1138 case KErrGsmCCRequestedCallIdentityAlreadyCleared: |
|
1139 case KErrGsmCCUserNotInCug: |
|
1140 case KErrGsmCCIncompatibleDestination: |
|
1141 case KErrGsmCCInvalidTransitNetworkSelection: |
|
1142 case KErrGsmCCIncompatibleSegmentedMessage: |
|
1143 case KErrGsmCCSemanticallyIncorrectMessage: |
|
1144 case KErrGsmCCInvalidMandatoryInformation: |
|
1145 case KErrGsmCCNonExistentMessageType: |
|
1146 case KErrGsmCCIncompatibleMessageInProtocolState: |
|
1147 case KErrGsmCCNonExistentInformationElement: |
|
1148 case KErrGsmCCConditionalIEError: |
|
1149 case KErrGsmCCIncompatibleMessageInCallState: |
|
1150 case KErrGsmCCRecoveryOnTimerExpiry: |
|
1151 case KErrGsmCCUnspecifiedProtocolError: |
|
1152 case KErrGsmCCUnspecifiedInterworkingError: |
|
1153 // GSM: SPECIAL INFORMATION |
|
1154 tone = ECCPToneSpecialInformation; |
|
1155 CSPLOGSTRING(CSPINT, "CSPCall::Tone: Special Information"); |
|
1156 break; |
|
1157 default: |
|
1158 CSPLOGSTRING(CSPERROR, "CSPCall::Tone: ERROR not found"); |
|
1159 break; |
|
1160 } |
|
1161 } |
|
1162 |
|
1163 CSPLOGSTRING2(CSPREQIN, "CSPCall::Tone > tone: %d", tone); |
|
1164 return tone; |
|
1165 } |
|
1166 |
|
1167 // --------------------------------------------------------------------------- |
|
1168 // From class MCCPCSCall |
|
1169 // CSPCall::NoFdnCheck |
|
1170 // --------------------------------------------------------------------------- |
|
1171 // |
|
1172 void CSPCall::NoFDNCheck( ) |
|
1173 { |
|
1174 CSPLOGSTRING(CSPREQIN, "CSPCall::NoFDNCheck"); |
|
1175 iFdnCheck = EFalse; |
|
1176 } |
|
1177 |
|
1178 // --------------------------------------------------------------------------- |
|
1179 // CSPCall::LogDialedNumber |
|
1180 // --------------------------------------------------------------------------- |
|
1181 // |
|
1182 TBool CSPCall::LogDialedNumber() const |
|
1183 { |
|
1184 CSPLOGSTRING(CSPREQIN, "CSPCall::LogDialedNumber true"); |
|
1185 return ETrue; |
|
1186 } |
|
1187 |
|
1188 // --------------------------------------------------------------------------- |
|
1189 // From class MCCPCSCall |
|
1190 // CSPCall::Dial |
|
1191 // --------------------------------------------------------------------------- |
|
1192 // |
|
1193 TInt CSPCall::Dial( const TDesC8& /*aCallParams*/ ) |
|
1194 { |
|
1195 CSPLOGSTRING(CSPREQIN, "CSPCall::Dial"); |
|
1196 return iCommonInfo.IndicateDialRequest( *this ); |
|
1197 } |
|
1198 |
|
1199 // --------------------------------------------------------------------------- |
|
1200 // From class MCCPCallCommandHandling |
|
1201 // CSPCall::PerformDialRequest |
|
1202 // --------------------------------------------------------------------------- |
|
1203 // |
|
1204 TInt CSPCall::PerformDialRequest() |
|
1205 { |
|
1206 CSPLOGSTRING(CSPREQIN, "CSPCall::PerformDialRequest"); |
|
1207 iDialCompletionCode = KErrNone; |
|
1208 iTerminationErrorNotified = EFalse; |
|
1209 |
|
1210 // Send the User to User Information. |
|
1211 if( iUserToUserInformation->Length() ) |
|
1212 { |
|
1213 iUUIMessageSender->SendUUIMessage( *iUserToUserInformation ); |
|
1214 } |
|
1215 |
|
1216 return DialFdnCond( iFdnCheck ); |
|
1217 } |
|
1218 |
|
1219 // --------------------------------------------------------------------------- |
|
1220 // CSPCall::CSPCall |
|
1221 // --------------------------------------------------------------------------- |
|
1222 // |
|
1223 CSPCall::CSPCall( RMobileLine& aLine, |
|
1224 TBool aMobileOriginated, |
|
1225 const TDesC& aName, |
|
1226 MCSPCommonInfo& aCommonInfo, |
|
1227 TBool aIsEmergencyCall ) : |
|
1228 iLine( aLine ), |
|
1229 iMobileOriginated( aMobileOriginated ), |
|
1230 iName( aName ), |
|
1231 iCommonInfo( aCommonInfo ), |
|
1232 iTerminationErrorNotified( EFalse ), |
|
1233 iIsEmergencyCall( aIsEmergencyCall), |
|
1234 iFdnCheck(ETrue), |
|
1235 iAudioStatus( ECSPCallAudioStatusInactive ) |
|
1236 |
|
1237 { |
|
1238 CSPLOGSTRING(CSPOBJECT, "CSPCall::CSPCall"); |
|
1239 } |
|
1240 |
|
1241 // --------------------------------------------------------------------------- |
|
1242 // CSPCall::ConstructL |
|
1243 // Constructing CSPCall in 2nd phase |
|
1244 // --------------------------------------------------------------------------- |
|
1245 // |
|
1246 void CSPCall::ConstructL( const CCCECallParameters& aParams ) |
|
1247 { |
|
1248 CSPLOGSTRING(CSPOBJECT, "CSPCall::ConstructL <"); |
|
1249 |
|
1250 // Create cloned copy of call parameters |
|
1251 iParams = static_cast<CCCECallParameters*>( aParams.CloneL() ); |
|
1252 |
|
1253 // Open call handle |
|
1254 OpenCallHandleL(); |
|
1255 |
|
1256 // Update call info |
|
1257 UpdateCallInfo(); |
|
1258 |
|
1259 // Update call state from ETel |
|
1260 UpdateCallState(); |
|
1261 |
|
1262 // Create call handlers for call related requests |
|
1263 // and for monitoring call related events |
|
1264 CreateCallHandlersL(); |
|
1265 |
|
1266 CSPLOGSTRING(CSPOBJECT, "CSPCall::ConstructL >"); |
|
1267 } |
|
1268 |
|
1269 // --------------------------------------------------------------------------- |
|
1270 // CSPCall::OpenCallHandleL |
|
1271 // Open call handle, calls either OpenNewCallL or OpenExistingCallL depending |
|
1272 // of the call direction and if the call is a client call |
|
1273 // --------------------------------------------------------------------------- |
|
1274 // |
|
1275 void CSPCall::OpenCallHandleL() |
|
1276 { |
|
1277 CSPLOGSTRING(CSPINT, "CSPCall::OpenCallHandleL <"); |
|
1278 |
|
1279 if ( iMobileOriginated ) |
|
1280 { |
|
1281 // There is no existing call on line, open new call |
|
1282 OpenNewCall(); |
|
1283 } |
|
1284 else |
|
1285 { |
|
1286 // Mobile terminated call on line, open existing call |
|
1287 OpenExistingCallL( iName ); |
|
1288 } |
|
1289 |
|
1290 CSPLOGSTRING(CSPINT, "CSPCall::OpenCallHandleL >"); |
|
1291 } |
|
1292 |
|
1293 // --------------------------------------------------------------------------- |
|
1294 // CSPCall::UpdateCallInfoL |
|
1295 // Update call info including remote party name and number data |
|
1296 // --------------------------------------------------------------------------- |
|
1297 // |
|
1298 void CSPCall::UpdateCallInfo() |
|
1299 { |
|
1300 CSPLOGSTRING(CSPINT, "CSPCall::UpdateCallInfo <"); |
|
1301 RMobileCall::TMobileCallInfoV7 callInfo; |
|
1302 RMobileCall::TMobileCallInfoV7Pckg pck( callInfo ); |
|
1303 TInt err = iCall.GetMobileCallInfo( pck ); |
|
1304 |
|
1305 UpdateCallInfoImpl( callInfo ); |
|
1306 |
|
1307 CSPLOGSTRING(CSPINT, "CSPCall::UpdateCallInfo >"); |
|
1308 } |
|
1309 |
|
1310 // --------------------------------------------------------------------------- |
|
1311 // CSPCall::UpdateCallInfoImpl |
|
1312 // Implementation for UpdateCallInfo(). |
|
1313 // --------------------------------------------------------------------------- |
|
1314 // |
|
1315 void CSPCall::UpdateCallInfoImpl( RMobileCall::TMobileCallInfoV7 aCallInfo ) |
|
1316 { |
|
1317 CSPLOGSTRING(CSPINT, "CSPCall::UpdateCallInfoImpl <"); |
|
1318 |
|
1319 if ( iMobileOriginated ) |
|
1320 { |
|
1321 // Call wasn't added by ETel monitor, update info accordingly |
|
1322 UpdateCallNameNumberInfo( aCallInfo, EFalse ); |
|
1323 } |
|
1324 else |
|
1325 { |
|
1326 // Call was added by ETel monitor, update info accordingly |
|
1327 UpdateCallNameNumberInfo( aCallInfo, ETrue ); |
|
1328 } |
|
1329 |
|
1330 |
|
1331 CSPLOGSTRING(CSPINT, "CSPCall::UpdateCallInfoImpl >"); |
|
1332 } |
|
1333 |
|
1334 // --------------------------------------------------------------------------- |
|
1335 // CSPCall::UpdateCallOrigin |
|
1336 // Set call origin to CCCECallParameters. |
|
1337 // --------------------------------------------------------------------------- |
|
1338 // |
|
1339 void CSPCall::UpdateCallOrigin( RMobileCall::TMobileCallInfoV7 aCallInfo ) |
|
1340 { |
|
1341 CSPLOGSTRING(CSPINT, "CSPCall::UpdateCallOrigin <"); |
|
1342 |
|
1343 if ( iMobileOriginated ) |
|
1344 { |
|
1345 if ( RMobileCall::EOriginatorSIM == aCallInfo.iCallParamOrigin ) |
|
1346 { |
|
1347 iParams->SetOrigin(CCCECallParameters::ECCECallOriginSAT); |
|
1348 } |
|
1349 } |
|
1350 CSPLOGSTRING(CSPINT, "CSPCall::UpdateCallOrigin >"); |
|
1351 } |
|
1352 |
|
1353 |
|
1354 |
|
1355 // --------------------------------------------------------------------------- |
|
1356 // CSPCall::UpdateCallStateL |
|
1357 // |
|
1358 // --------------------------------------------------------------------------- |
|
1359 // |
|
1360 int CSPCall::UpdateCallState() |
|
1361 { |
|
1362 CSPLOGSTRING(CSPINT, "CSPCall::UpdateCallState <"); |
|
1363 TInt err( KErrNone ); |
|
1364 |
|
1365 // Update call state from ETel |
|
1366 RMobileCall::TMobileCallStatus etelState; |
|
1367 err = iCall.GetMobileCallStatus( etelState ); |
|
1368 if ( KErrNone == err ) |
|
1369 { |
|
1370 iCallState = CCPStateFromETelState( etelState ); |
|
1371 } |
|
1372 CSPLOGSTRING2(CSPINT, "CSPCall::UpdateCallState > res %d", err); |
|
1373 |
|
1374 return err; |
|
1375 } |
|
1376 |
|
1377 // --------------------------------------------------------------------------- |
|
1378 // CSPCall::CreateCallHandlersL |
|
1379 // Create call handlers for call related requests and call monitoring |
|
1380 // --------------------------------------------------------------------------- |
|
1381 // |
|
1382 void CSPCall::CreateCallHandlersL() |
|
1383 { |
|
1384 CSPLOGSTRING(CSPINT, "CSPCall::CreateCallHandlersL <"); |
|
1385 |
|
1386 iRequester = CSPEtelCallRequester::NewL( *this, iCall ); |
|
1387 |
|
1388 iCallEventMonitor = CSPEtelCallEventMonitor::NewL( *this, iCall ); |
|
1389 iCallEventMonitor->StartMonitoring(); |
|
1390 iCallStatusMonitor = CSPEtelCallStatusMonitor::NewL( *this, iCall ); |
|
1391 iCallStatusMonitor->StartMonitoring(); |
|
1392 |
|
1393 iCallCapsMonitor = CSPEtelCallCapsMonitor::NewL( *this, iCall ); |
|
1394 iCallCapsMonitor->StartMonitoring(); |
|
1395 iCapsFlags = iCallCapsMonitor->FetchCallControlCapsL(); |
|
1396 |
|
1397 iCallInfoMonitor = CSPCallInfoMonitor::NewL( *this, iCall ); |
|
1398 iCallInfoMonitor->StartMonitoring(); |
|
1399 |
|
1400 // Start UUI monitor and create message sender |
|
1401 iSkypeId = TCSPSkypeIdParser::CreateSkypeIdBufferL(); |
|
1402 iUUIMonitor = CSPUUIMonitor::NewL( iCall,*this ); |
|
1403 iUUIMonitor->StartMonitor(); |
|
1404 iUUIMessageSender = CSPUUIMessageSender::NewL( iCall ); |
|
1405 iUserToUserInformation = iParams->UUSId().AllocL(); |
|
1406 |
|
1407 // Transfer provider |
|
1408 iTransferProvider = CSPTransferProvider::NewL( iCall, *this, iCommonInfo ); |
|
1409 |
|
1410 // Forward provider |
|
1411 iForwardProvider = CSPForwardProvider::NewL(); |
|
1412 |
|
1413 CSPLOGSTRING(CSPINT, "CSPCall::CreateCallHandlersL >"); |
|
1414 } |
|
1415 |
|
1416 // --------------------------------------------------------------------------- |
|
1417 // CSPCall::NotifyRingingState |
|
1418 // Gets to ringing state |
|
1419 // --------------------------------------------------------------------------- |
|
1420 // |
|
1421 void CSPCall::NotifyRingingState( ) |
|
1422 { |
|
1423 CSPLOGSTRING(CSPREQIN, "CSPCall::NotifyRingingState"); |
|
1424 iCallState = MCCPCallObserver::ECCPStateRinging; |
|
1425 |
|
1426 TInt obsCount = iObservers.Count ( ); |
|
1427 for (TInt i = 0; i < obsCount; i++ ) |
|
1428 { |
|
1429 MCCPCallObserver *obs = iObservers[i]; |
|
1430 if ( obs ) |
|
1431 { |
|
1432 obs->CallStateChanged ( iCallState, this ); |
|
1433 } |
|
1434 } |
|
1435 } |
|
1436 |
|
1437 // --------------------------------------------------------------------------- |
|
1438 // CSPCall::CCPStateFromETelState |
|
1439 // Simple mapping between state enumerations. |
|
1440 // --------------------------------------------------------------------------- |
|
1441 // |
|
1442 MCCPCallObserver::TCCPCallState CSPCall::CCPStateFromETelState( |
|
1443 RMobileCall::TMobileCallStatus aEtelState ) |
|
1444 { |
|
1445 MCCPCallObserver::TCCPCallState ret = MCCPCallObserver::ECCPStateIdle; |
|
1446 switch ( aEtelState ) |
|
1447 { |
|
1448 case RMobileCall::EStatusUnknown: |
|
1449 { |
|
1450 CSPLOGSTRING( CSPREQIN, |
|
1451 "CSPCall::State > RMobileCall::Unknown" ); |
|
1452 ret = MCCPCallObserver::ECCPStateIdle; |
|
1453 break; |
|
1454 } |
|
1455 case RMobileCall::EStatusIdle: |
|
1456 { |
|
1457 CSPLOGSTRING( CSPREQIN, |
|
1458 "CSPCall::State > RMobileCall::EStatusIdle" ); |
|
1459 ret = MCCPCallObserver::ECCPStateIdle; |
|
1460 break; |
|
1461 } |
|
1462 case RMobileCall::EStatusRinging: |
|
1463 { |
|
1464 CSPLOGSTRING( CSPREQIN, |
|
1465 "CSPCall::State > RMobileCall::EStatusRinging" ); |
|
1466 ret = MCCPCallObserver::ECCPStateRinging; |
|
1467 break; |
|
1468 } |
|
1469 // Map the following to connecting status |
|
1470 case RMobileCall::EStatusDialling: |
|
1471 { |
|
1472 CSPLOGSTRING( CSPREQIN, "CSPCall::State > \ |
|
1473 RMobileCall::EStatusDialling" ); |
|
1474 ret = MCCPCallObserver::ECCPStateDialling; |
|
1475 break; |
|
1476 } |
|
1477 case RMobileCall::EStatusConnecting: |
|
1478 { |
|
1479 CSPLOGSTRING( CSPREQIN, "CSPCall::State > \ |
|
1480 RMobileCall::Connecting" ); |
|
1481 ret = MCCPCallObserver::ECCPStateConnecting; |
|
1482 break; |
|
1483 } |
|
1484 case RMobileCall::EStatusAnswering: |
|
1485 { |
|
1486 CSPLOGSTRING( CSPREQIN, "CSPCall::State > \ |
|
1487 RMobileCall::Answering" ); |
|
1488 ret = MCCPCallObserver::ECCPStateAnswering; |
|
1489 break; |
|
1490 } |
|
1491 // Call is connected and active. |
|
1492 case RMobileCall::EStatusConnected: |
|
1493 { |
|
1494 CSPLOGSTRING( CSPREQIN, |
|
1495 "CSPCall::State > RMobileCall::EStatusConnected" ); |
|
1496 ret = MCCPCallObserver::ECCPStateConnected; |
|
1497 break; |
|
1498 } |
|
1499 case RMobileCall::EStatusDisconnectingWithInband: |
|
1500 case RMobileCall::EStatusDisconnecting: |
|
1501 { |
|
1502 CSPLOGSTRING( CSPREQIN, |
|
1503 "CSPCall::State > RMobileCall::EStatusDisconnecting/Inband?"); |
|
1504 ret = MCCPCallObserver::ECCPStateDisconnecting; |
|
1505 break; |
|
1506 } |
|
1507 case RMobileCall::EStatusReconnectPending: |
|
1508 { |
|
1509 CSPLOGSTRING( CSPREQIN, |
|
1510 "CSPCall::State > RMobileCall::EStatusHangingUp" ); |
|
1511 ret = MCCPCallObserver::ECCPStateDisconnecting; |
|
1512 break; |
|
1513 } |
|
1514 case RMobileCall::EStatusHold: |
|
1515 { |
|
1516 CSPLOGSTRING( CSPREQIN, |
|
1517 "CSPCall::State > RMobileCall::EStatusHold" ); |
|
1518 ret = MCCPCallObserver::ECCPStateHold; |
|
1519 break; |
|
1520 } |
|
1521 case RMobileCall::EStatusWaitingAlternatingCallSwitch: |
|
1522 { |
|
1523 // This state is not used in real life. |
|
1524 CSPLOGSTRING( CSPREQIN, |
|
1525 "CSPCall::State > RMobileCall::EStatusWaitingAlternatingCallSwitch" ); |
|
1526 ret = MCCPCallObserver::ECCPStateConnected; |
|
1527 break; |
|
1528 } |
|
1529 case RMobileCall::EStatusTransferring: |
|
1530 { |
|
1531 CSPLOGSTRING( CSPREQIN, |
|
1532 "CSPCall::State > RMobileCall::EStatusHold" ); |
|
1533 ret = MCCPCallObserver::ECCPStateTransferring; |
|
1534 break; |
|
1535 } |
|
1536 case RMobileCall::EStatusTransferAlerting: |
|
1537 { |
|
1538 CSPLOGSTRING( CSPREQIN, |
|
1539 "CSPCall::State > RMobileCall::EStatusHold" ); |
|
1540 ret = MCCPCallObserver::ECCPStateTransferring; |
|
1541 break; |
|
1542 } |
|
1543 default: |
|
1544 { |
|
1545 CSPLOGSTRING( CSPREQIN, |
|
1546 "CSPCall::CCPStateFromETelState unhandled state "); |
|
1547 } |
|
1548 } |
|
1549 |
|
1550 CSPLOGSTRING3(CSPINT, |
|
1551 "CSPCall::CCPStateFromETelState ETel: %d CCP: %d", aEtelState, ret); |
|
1552 return ret; |
|
1553 } |
|
1554 |
|
1555 // --------------------------------------------------------------------------- |
|
1556 // CSPCall::NotifyCallStateChanged |
|
1557 // Notifies observers about state changes |
|
1558 // --------------------------------------------------------------------------- |
|
1559 // |
|
1560 void CSPCall::NotifyCallStateChanged( MCCPCallObserver::TCCPCallState aState ) |
|
1561 { |
|
1562 CSPLOGSTRING3(CSPINT, |
|
1563 "CSPCall::NotifyCallStateChanged < state: %d this: %x", |
|
1564 aState, this ); |
|
1565 |
|
1566 iCallState = aState; |
|
1567 TBool notifyObservers( ETrue ); |
|
1568 |
|
1569 if ( !iMobileOriginated && MCCPCallObserver::ECCPStateRinging == aState ) |
|
1570 { |
|
1571 CSPLOGSTRING2(CSPINT, "CSPCall::No notify on ringing MT", aState); |
|
1572 notifyObservers = EFalse; |
|
1573 } |
|
1574 |
|
1575 if ( notifyObservers ) |
|
1576 { |
|
1577 TInt obsCount = iObservers.Count(); |
|
1578 for ( TInt i = 0; i < obsCount; i++ ) |
|
1579 { |
|
1580 MCCPCallObserver *obs = iObservers[i]; |
|
1581 if ( obs ) |
|
1582 { |
|
1583 obs->CallStateChanged( aState, this ); |
|
1584 } |
|
1585 } |
|
1586 } |
|
1587 |
|
1588 CSPLOGSTRING3(CSPINT, |
|
1589 "CSPCall::NotifyCallStateChanged > state: %d this: %x", |
|
1590 aState, this ); |
|
1591 } |
|
1592 |
|
1593 // --------------------------------------------------------------------------- |
|
1594 // CSPCall::NotifyCallStateChangedWithInband |
|
1595 // Notifies observers about state changes |
|
1596 // --------------------------------------------------------------------------- |
|
1597 // |
|
1598 void CSPCall::NotifyCallStateChangedWithInband( |
|
1599 MCCPCallObserver::TCCPCallState aState ) |
|
1600 { |
|
1601 CSPLOGSTRING3(CSPINT, |
|
1602 "CSPCall::NotifyCallStateChangedWithInBand < state: %d this: %x", |
|
1603 aState, this ); |
|
1604 |
|
1605 iCallState = aState; |
|
1606 |
|
1607 if ( !iMobileOriginated && MCCPCallObserver::ECCPStateRinging == aState ) |
|
1608 { |
|
1609 CSPLOGSTRING2(CSPINT, "CSPCall::No notify on ringing MT", aState); |
|
1610 } |
|
1611 else |
|
1612 { |
|
1613 TInt obsCount = iObservers.Count(); |
|
1614 for ( TInt i = 0; i < obsCount; i++ ) |
|
1615 { |
|
1616 MCCPCallObserver *obs = iObservers[i]; |
|
1617 if ( obs ) |
|
1618 { |
|
1619 obs->CallStateChangedWithInband( aState, this ); |
|
1620 } |
|
1621 } |
|
1622 } |
|
1623 CSPLOGSTRING3(CSPINT, |
|
1624 "CSPCall::NotifyCallStateChangedWithInband > state: %d this: %x", |
|
1625 aState, this); |
|
1626 } |
|
1627 |
|
1628 // --------------------------------------------------------------------------- |
|
1629 // CSPCall::ReadRepositoryL |
|
1630 // Reads the given information from Central Repository. |
|
1631 // --------------------------------------------------------------------------- |
|
1632 // |
|
1633 void CSPCall::ReadRepositoryL( TUid aUid, TUint aKey, TInt& aVal) |
|
1634 { |
|
1635 CSPLOGSTRING(CSPINT, "CSPCall::ReadRepositoryL"); |
|
1636 |
|
1637 CRepository* cr = CRepository::NewL( aUid ); |
|
1638 TInt err = cr->Get( aKey, aVal ); |
|
1639 delete cr; |
|
1640 User::LeaveIfError( err ); |
|
1641 } |
|
1642 |
|
1643 // --------------------------------------------------------------------------- |
|
1644 // CSPCall::CheckAndNotifyTerminationError |
|
1645 // Reads error code from ETel. |
|
1646 // --------------------------------------------------------------------------- |
|
1647 // |
|
1648 void CSPCall::CheckAndNotifyTerminationError() |
|
1649 { |
|
1650 CSPLOGSTRING2(CSPINT, |
|
1651 "CSPCall::CheckAndNotifyTerminationError dial completion code: %d", |
|
1652 iDialCompletionCode); |
|
1653 |
|
1654 // Emergency error handling is separated into CSPEtelCallRequester |
|
1655 if ( !iIsEmergencyCall ) |
|
1656 { |
|
1657 TInt termErr = ExitCodeError(); |
|
1658 CSPLOGSTRING2(CSPINT, |
|
1659 "CSPCall::CheckAndNotifyTerminationError exit code error: %d", |
|
1660 termErr); |
|
1661 |
|
1662 if ( termErr == KErrNone ) |
|
1663 { |
|
1664 // Handle KErrGsmCCUnassignedNumber correctly |
|
1665 // because the value is not stored in exit code. |
|
1666 termErr = iDialCompletionCode; |
|
1667 CSPLOGSTRING(CSPINT, |
|
1668 "CSPCall::CheckAndNotifyTerminationError use dial completion code"); |
|
1669 } |
|
1670 |
|
1671 if ( termErr == KErrGsmRRPreEmptiveRelease ) |
|
1672 { |
|
1673 // Error KErrGsmRRPreEmptiveRelease occurs when there is active call |
|
1674 // and user make emergency call, can be ignored. |
|
1675 CSPLOGSTRING3( |
|
1676 CSPERROR, |
|
1677 "CSPCall::CheckAndNotifyTerminationError preemptive release, ignore: %d", |
|
1678 termErr, |
|
1679 this ); |
|
1680 } |
|
1681 else if ( iDontReportTerm |
|
1682 && ( termErr == KErrGsmCCNormalUnspecified |
|
1683 || termErr == KErrGsmCCCallRejected ) ) |
|
1684 { |
|
1685 // Not an error, since this happens on normal |
|
1686 // call termination situation after connected call. |
|
1687 CSPLOGSTRING3(CSPERROR, |
|
1688 "CSPCall::CheckAndNotifyTerminationError DISCARD this: %x err: %d", |
|
1689 this, |
|
1690 termErr); |
|
1691 } |
|
1692 else if ( termErr ) |
|
1693 { |
|
1694 TCCPError ccpErr(ECCPErrorNone); |
|
1695 |
|
1696 // Only a couple of error codes can have diagnostic information. |
|
1697 // aDiagnostic ought to be undefined in other situatios, |
|
1698 // but at least in this way we can really guarantee it. |
|
1699 if ( termErr == KErrGsmCCFacilityRejected || |
|
1700 termErr == KErrGsmCCRequestedFacilityNotSubscribed || |
|
1701 termErr == KErrGsmCCIncomingCallsBarredInCug || |
|
1702 termErr == KErrGsmCCRequestedFacilityNotImplemented || |
|
1703 termErr == KErrGsmCCUserNotInCug ) |
|
1704 { |
|
1705 TName name; |
|
1706 CallName( name ); |
|
1707 TInt diagErr = iCommonInfo.GetDiagnosticError( name ); |
|
1708 ccpErr = iRequester->MapError( diagErr ); |
|
1709 |
|
1710 // Finally use exit code if diagnostic did not contain |
|
1711 // any useful information. |
|
1712 if ( ccpErr == ECCPRequestFailure ) |
|
1713 { |
|
1714 ccpErr = iRequester->MapError( termErr ); |
|
1715 } |
|
1716 } |
|
1717 else |
|
1718 { |
|
1719 ccpErr = iRequester->MapError( termErr ); |
|
1720 } |
|
1721 |
|
1722 NotifyErrorOccurred( ccpErr ); |
|
1723 iTerminationErrorNotified = ETrue; |
|
1724 } |
|
1725 } |
|
1726 } |
|
1727 |
|
1728 // --------------------------------------------------------------------------- |
|
1729 // CSPCall::ExitCodeError |
|
1730 // Reads error code from ETel call info's iExitCode. |
|
1731 // --------------------------------------------------------------------------- |
|
1732 // |
|
1733 TInt CSPCall::ExitCodeError() const |
|
1734 { |
|
1735 CSPLOGSTRING2(CSPINT, "CSPCall::ExitCodeError < this: %x", |
|
1736 this ); |
|
1737 TInt callError; |
|
1738 RMobileCall::TMobileCallInfoV3 callInfo; |
|
1739 RMobileCall::TMobileCallInfoV3Pckg pck( callInfo ); |
|
1740 TInt getErr = iCall.GetMobileCallInfo( pck ); |
|
1741 // Is there value in higher 16 bits |
|
1742 if ( KErrNone == getErr && (callInfo.iExitCode & 0xFFFF0000) ) |
|
1743 { |
|
1744 CSPLOGSTRING2(CSPINT, "CSPCall::ExitCodeError callInfo.iExitCode %d", |
|
1745 callInfo.iExitCode ); |
|
1746 callError = ( callInfo.iExitCode >> KTimesToSplitValue ); |
|
1747 |
|
1748 if ( callError > KErrEtelGsmBase ) |
|
1749 // Not in valid exteded range |
|
1750 { |
|
1751 // Ignore invalid extented code |
|
1752 if ( ( callInfo.iExitCode & 0x0000FFFF ) == KErrNone ) |
|
1753 // core error is zero |
|
1754 { |
|
1755 callError = KErrNone; |
|
1756 } |
|
1757 else |
|
1758 { |
|
1759 callError = ( ( callInfo.iExitCode & 0x0000FFFF ) |
|
1760 | 0xFFFF0000 ); |
|
1761 } |
|
1762 } |
|
1763 } |
|
1764 // Higher and lower 16 bits are zero |
|
1765 else if ( !( callInfo.iExitCode & 0xFFFFFFFF ) ) |
|
1766 { |
|
1767 callError = KErrNone; |
|
1768 } |
|
1769 else |
|
1770 { |
|
1771 // No extended error, expand value to full range |
|
1772 callError = ( callInfo.iExitCode | 0xFFFF0000 ); |
|
1773 } |
|
1774 |
|
1775 CSPLOGSTRING2(CSPINT, "CSPCall::ExitCodeError > err: %d", callError); |
|
1776 |
|
1777 return callError; |
|
1778 } |
|
1779 |
|
1780 // --------------------------------------------------------------------------- |
|
1781 // CSPCall::UUSMessageReceived |
|
1782 // --------------------------------------------------------------------------- |
|
1783 // |
|
1784 void CSPCall::UUSMessageReceived( TDesC& aMessage ) |
|
1785 { |
|
1786 CSPLOGSTRING(CSPREQIN, "CSPCall::UUSMessageReceived"); |
|
1787 TCSPSkypeIdParser parser; |
|
1788 |
|
1789 TPtr ptr = iSkypeId->Des(); |
|
1790 ptr.Zero(); |
|
1791 const TInt error( parser.Parse( aMessage, ptr ) ); |
|
1792 |
|
1793 if ( !error ) |
|
1794 { |
|
1795 iRemotePartyName = ptr; |
|
1796 NotifyCallEventOccurred( MCCPCallObserver::ECCPNotifyRemotePartyInfoChange ); |
|
1797 } |
|
1798 CSPLOGSTRING2(CSPINT, "CSPCall::UUSMessageReceived err: %d", error ); |
|
1799 } |
|
1800 |
|
1801 // --------------------------------------------------------------------------- |
|
1802 // CSPCall::NotifyRemotePartyInfoChanged |
|
1803 // --------------------------------------------------------------------------- |
|
1804 // |
|
1805 void CSPCall::NotifyRemotePartyInfoChanged(const TDesC& aRemoteParty) |
|
1806 { |
|
1807 CSPLOGSTRING(CSPREQIN, "CSPCall::NotifyRemotePartyInfoChanged"); |
|
1808 iRemotePartyName = aRemoteParty; |
|
1809 NotifyCallEventOccurred( MCCPCallObserver::ECCPNotifyRemotePartyInfoChange ); |
|
1810 } |
|
1811 |
|
1812 // --------------------------------------------------------------------------- |
|
1813 // CSPCall::DontReportTerminationError |
|
1814 // --------------------------------------------------------------------------- |
|
1815 // |
|
1816 void CSPCall::DontReportTerminationError() |
|
1817 { |
|
1818 CSPLOGSTRING(CSPREQIN, "CSPCall::DontReportTerminationError"); |
|
1819 iDontReportTerm = ETrue; |
|
1820 } |
|
1821 |
|
1822 // --------------------------------------------------------------------------- |
|
1823 // CSPCall::UpdateCallNameNumberInfo |
|
1824 // Update call info including remote party name and number data |
|
1825 // --------------------------------------------------------------------------- |
|
1826 // |
|
1827 void CSPCall::UpdateCallNameNumberInfo( |
|
1828 RMobileCall::TMobileCallInfoV3& aCallInfo, |
|
1829 TBool aCallAddedByMonitor ) |
|
1830 { |
|
1831 CSPLOGSTRING(CSPINT, "CSPCall::UpdateCallNameNumberInfo <"); |
|
1832 |
|
1833 iCallName.Zero(); |
|
1834 iRemotePartyNumber.Zero(); |
|
1835 iRemotePartyName.Zero(); |
|
1836 |
|
1837 if ( aCallAddedByMonitor ) |
|
1838 { |
|
1839 CSPLOGSTRING(CSPINT, |
|
1840 "CSPCall::UpdateCallNameNumberInfo call added by monitor"); |
|
1841 |
|
1842 // If call was created by ETel line status or incoming call monitor |
|
1843 // the call name is already known, only remote party info is fetched from |
|
1844 // call info |
|
1845 iCallName.Append( iName ); |
|
1846 iRemotePartyName.Append( aCallInfo.iRemoteParty.iCallingName ); |
|
1847 iRemotePartyNumber.Append( aCallInfo.iRemoteParty.iRemoteNumber.iTelNumber ); |
|
1848 } |
|
1849 else |
|
1850 { |
|
1851 CSPLOGSTRING(CSPINT, |
|
1852 "CSPCall::UpdateCallNameNumberInfo call added by plugin owner"); |
|
1853 |
|
1854 // The call was not created by monitor and the remote number is already known, |
|
1855 // fetch only call name from call info |
|
1856 iCallName.Append( aCallInfo.iCallName ); |
|
1857 iRemotePartyNumber.Append( iName ); |
|
1858 } |
|
1859 |
|
1860 CSPLOGSTRING2(CSPINT, |
|
1861 "CSPCall::UpdateCallNameNumberInfo iCallName: %S", &iCallName ); |
|
1862 CSPLOGSTRING2(CSPINT, |
|
1863 "CSPCall::UpdateCallNameNumberInfo iRemotePartyNumber: %S", &iRemotePartyNumber ); |
|
1864 CSPLOGSTRING2(CSPINT, |
|
1865 "CSPCall::UpdateCallNameNumberInfo iRemotePartyName: %S", &iRemotePartyName ); |
|
1866 |
|
1867 CSPLOGSTRING(CSPINT, "CSPCall::UpdateCallNameNumberInfo >"); |
|
1868 } |
|
1869 |
|
1870 // --------------------------------------------------------------------------- |
|
1871 // CSPCall::OpenNewCall |
|
1872 // Open new call |
|
1873 // --------------------------------------------------------------------------- |
|
1874 // |
|
1875 void CSPCall::OpenNewCall() |
|
1876 { |
|
1877 CSPLOGSTRING(CSPINT, "CSPCall::OpenNewCall <"); |
|
1878 |
|
1879 // Open new call |
|
1880 __ASSERT_ALWAYS( iCall.OpenNewCall( iLine ) == KErrNone, |
|
1881 Panic( ECSPPanicNoEtel ) ); |
|
1882 |
|
1883 CSPLOGSTRING(CSPINT, "CSPCall::OpenNewCall >"); |
|
1884 } |
|
1885 |
|
1886 // --------------------------------------------------------------------------- |
|
1887 // CSPCall::OpenExistingCallL |
|
1888 // Open existing call |
|
1889 // --------------------------------------------------------------------------- |
|
1890 // |
|
1891 void CSPCall::OpenExistingCallL( const TDesC& aName ) |
|
1892 { |
|
1893 CSPLOGSTRING2(CSPINT, |
|
1894 "CSPCall::OpenExistingCallL < aName: %S", &aName); |
|
1895 |
|
1896 // Open existing call with given name from current line |
|
1897 TInt err = iCall.OpenExistingCall( iLine, aName ); |
|
1898 |
|
1899 if ( KErrNone != err ) |
|
1900 { |
|
1901 CSPLOGSTRING2(CSPERROR, |
|
1902 "CSPCall::OpenCallHandleL OpenExistingCall error: %d, leaving", err); |
|
1903 User::Leave( err ); |
|
1904 } |
|
1905 |
|
1906 CSPLOGSTRING(CSPINT, "CSPCall::OpenExistingCallL >"); |
|
1907 } |
|
1908 |
|
1909 // End of File |
|
1910 |