cbsref/telephonyrefplugins/atltsy/atcommand/callcontrol/src/atdialvoice.cpp
branchRCL_3
changeset 65 630d2f34d719
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
       
     1 // Copyright (c) 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 // @file atdialvoice.cpp
       
    15 // This contains CATDialVoice which dial a voice call.
       
    16 //
       
    17 
       
    18 //user include
       
    19 #include "atdialvoice.h"
       
    20 #include "ltsycommondefine.h"
       
    21 #include <ctsy/ltsy/cctsydispatchercallback.h>
       
    22 #include "globalphonemanager.h"
       
    23 #include "activecommandstore.h"
       
    24 #include "atmanager.h"
       
    25 #include "ltsycallinformationmanager.h"
       
    26 #include "mslogger.h"
       
    27 
       
    28 //const define 
       
    29 const TInt KLtsyWaitForConnect = 60;
       
    30 _LIT8(KLtsyDialVoiceCommandFormat,"ATD%S;\r");
       
    31 _LIT8(KLtsyBusyString, "BUSY");
       
    32 _LIT8(KLtsyNoAnswerString, "NO ANSWER");
       
    33 _LIT8(KLtsyUnsolicitedCallCreated, "+WIND: 5*");
       
    34 _LIT8(KLtsyUnsolicitedCallingAltert, "+WIND: 2");
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // CATDialVoice::NewL
       
    38 // other items were commented in a header
       
    39 // ---------------------------------------------------------------------------
       
    40 CATDialVoice* CATDialVoice::NewL(CGlobalPhonemanager& aGloblePhone,
       
    41 		                         CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    42 	{
       
    43 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::NewL()"));
       
    44 	
       
    45 	CATDialVoice* self = CATDialVoice::NewLC(aGloblePhone, aCtsyDispatcherCallback);
       
    46 	CleanupStack::Pop(self);
       
    47 	return self;
       
    48 	}
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // CATDialVoice::NewLC
       
    52 // other items were commented in a header
       
    53 // ---------------------------------------------------------------------------
       
    54 CATDialVoice* CATDialVoice::NewLC(CGlobalPhonemanager& aGloblePhone,
       
    55 		                          CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    56 	{
       
    57 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::NewLC()"));
       
    58 	
       
    59 	CATDialVoice* self = new (ELeave) CATDialVoice(aGloblePhone, aCtsyDispatcherCallback);
       
    60 	CleanupStack::PushL(self);
       
    61 	self->ConstructL();
       
    62 	return self;
       
    63 	}
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CATDialVoice::~CATDialVoice
       
    67 // other items were commented in a header
       
    68 // ---------------------------------------------------------------------------
       
    69 CATDialVoice::~CATDialVoice()
       
    70 	{
       
    71 	delete iATH;
       
    72 	}
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CATDialVoice::CATDialVoice
       
    76 // other items were commented in a header
       
    77 // ---------------------------------------------------------------------------
       
    78 CATDialVoice::CATDialVoice(CGlobalPhonemanager& aGloblePhone, 
       
    79 		                   CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    80 				           :CAtCommandBase(aGloblePhone, aCtsyDispatcherCallback)	
       
    81 	{
       
    82 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::CATDialVoice()"));
       
    83 	
       
    84 	iAtType = ELtsyAT_Call_ATD;
       
    85 	iResult = KErrNone;
       
    86 	iOKFounded = EFalse;
       
    87 	iCallId = KLtsyErrorCallId;
       
    88 	iStatus = KErrNone;
       
    89 	iDialStep = EATDialNotInProgress;
       
    90 	iIsEmergencyCall = EFalse;
       
    91 	}
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // CATDialVoice::ConstructL
       
    95 // other items were commented in a header
       
    96 // ---------------------------------------------------------------------------
       
    97 void CATDialVoice::ConstructL()
       
    98 	{
       
    99 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::ConstructL()"));
       
   100 	
       
   101 	//Invoke base class function
       
   102 	CAtCommandBase::ConstructL();
       
   103 	
       
   104 	//Set read and write timeout
       
   105 	SetTimeOut(KLtsyDefaultWriteTimeOut, KLtsyWaitForConnect);
       
   106 	
       
   107 	//Add expecting string
       
   108 	AddExpectStringL(KLtsyUnsolicitedCallCreated);
       
   109 	AddExpectStringL(KLtsyUnsolicitedCallingAltert);
       
   110 	AddExpectStringL(KLtsyBusyString);
       
   111 	AddExpectStringL(KLtsyNoAnswerString);
       
   112 	AddExpectStringL(KLtsyNoCarrierString);
       
   113 	
       
   114 	//Create Hang up call
       
   115 	iATH = CATHangUp::NewL(iPhoneGlobals, iCtsyDispatcherCallback);
       
   116 	
       
   117 	//Add Observer
       
   118 	iATH->AddAllCallReleaseObserver(this);
       
   119 	}
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // CATDialVoice::SetEmergnecyCallFlag
       
   123 // other items were commented in a header
       
   124 // ---------------------------------------------------------------------------
       
   125 void CATDialVoice::InitVariable()
       
   126 	{
       
   127 	iAtType = ELtsyAT_Call_ATD;
       
   128 	iResult = KErrNone;
       
   129 	iOKFounded = EFalse;
       
   130 	iCallId = KLtsyErrorCallId;
       
   131 	iStatus = KErrNone;
       
   132 	iDialStep = EATDialNotInProgress;
       
   133 	}
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 // CATDialVoice::ReleaseAllCallComplete
       
   137 // other items were commented in a header
       
   138 // ---------------------------------------------------------------------------
       
   139 void CATDialVoice::ReleaseAllCallComplete(TInt /*aError*/)
       
   140 	{
       
   141 	//if aError equal KErrNone or other dial Emergency call
       
   142 	ExecuteCommand();
       
   143 	}
       
   144 
       
   145 // ---------------------------------------------------------------------------
       
   146 // CATDialVoice::SetEmergnecyCallFlag
       
   147 // other items were commented in a header
       
   148 // ---------------------------------------------------------------------------
       
   149 void CATDialVoice::SetEmergnecyCallFlag(TBool aIsEmergencyCall)
       
   150 	{
       
   151 	iIsEmergencyCall = aIsEmergencyCall;
       
   152 	}
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // CATDialVoice::SetTelephoneNumber
       
   156 // other items were commented in a header
       
   157 // ---------------------------------------------------------------------------
       
   158 void CATDialVoice::SetTelephoneNumber(const TDesC8& aTelNum)
       
   159 	{
       
   160 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::SetTelephoneNumber()"));
       
   161 	
       
   162 	iTelNum.Copy(aTelNum.Left(iTelNum.MaxLength()));
       
   163 	}
       
   164 
       
   165 // ---------------------------------------------------------------------------
       
   166 // CATDialVoice::ExecuteCommand
       
   167 // other items were commented in a header
       
   168 // ---------------------------------------------------------------------------
       
   169 void CATDialVoice::ExecuteCommand()
       
   170 	{
       
   171 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::ExecuteCommand()"));
       
   172 	LOGTEXT2(_L8("[Ltsy CallControl] Telephone number = %S"), &iTelNum);
       
   173 	
       
   174 	iOKFounded = EFalse;
       
   175 	iTxBuffer.Format(KLtsyDialVoiceCommandFormat, &iTelNum);
       
   176 	Write(); 
       
   177 	iDialStep = EATWaitForWriteComplete;
       
   178 	}
       
   179 
       
   180 // ---------------------------------------------------------------------------
       
   181 // CATDialVoice::StartRequest
       
   182 // other items were commented in a header
       
   183 // ---------------------------------------------------------------------------
       
   184 void CATDialVoice::StartRequest()
       
   185 	{
       
   186 	if (iIsEmergencyCall && iPhoneGlobals.GetCallInfoManager().IsHaveUsedCallId())
       
   187 		{
       
   188 		iATH->InitVariable();
       
   189 		iATH->StartRequest();
       
   190 		}
       
   191 	else
       
   192 		{
       
   193 		ExecuteCommand();
       
   194 		}
       
   195 	}
       
   196 
       
   197 // ---------------------------------------------------------------------------
       
   198 // CATDialVoice::ParseUnsolicitedCommandBufL
       
   199 // other items were commented in a header
       
   200 // ---------------------------------------------------------------------------
       
   201 TInt CATDialVoice::ParseUnsolicitedCommandBufL(TUnsolicitedParams& aParams, const TDesC8& aCommandBuf)
       
   202 	{
       
   203 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::ParseUnsolicitedCommandBufL()"));
       
   204 	
       
   205 	RArray<TPtrC8> rArray;
       
   206 	CleanupClosePushL(rArray);
       
   207 	
       
   208 	iParser->ParseRespondedBuffer(rArray, aCommandBuf);
       
   209 	aParams.InitParams();
       
   210 	
       
   211 	TInt nCount = rArray.Count();
       
   212 	if (nCount <= 1)
       
   213 		{
       
   214 		CleanupStack::PopAndDestroy(1);
       
   215 		return KErrGeneral;
       
   216 		}
       
   217 
       
   218 	for(TInt index =1; index < nCount; index++)
       
   219 		{
       
   220 		if(index == 1)
       
   221 			{
       
   222 			TInt tVal(0);
       
   223 			TLex8 tLex(rArray[index]);
       
   224 			TInt nRes = tLex.Val(tVal);
       
   225 			if (nRes == KErrNone)
       
   226 				{
       
   227 				aParams.iEvent = tVal;
       
   228 				}
       
   229 			else
       
   230 				{
       
   231 				CleanupStack::PopAndDestroy(1);
       
   232 				return nRes;
       
   233 				}
       
   234 			}
       
   235 		
       
   236 		if(index == 2)
       
   237 			{
       
   238 			TInt tVal(0);
       
   239 			TLex8 tLex(rArray[index]);
       
   240 			TInt nRes = tLex.Val(tVal);
       
   241 			if (nRes == KErrNone)
       
   242 				{
       
   243 				aParams.iIdx = tVal;
       
   244 				}
       
   245 			else
       
   246 				{
       
   247 				CleanupStack::PopAndDestroy(1);	
       
   248 				return nRes;
       
   249 				}
       
   250 			}
       
   251 		}
       
   252 	
       
   253 	CleanupStack::Pop(1);
       
   254 	
       
   255 	return KErrNone;
       
   256 	}
       
   257 
       
   258 // ---------------------------------------------------------------------------
       
   259 // CATDialVoice::ProcessUnsolicitedCallCreated
       
   260 // other items were commented in a header
       
   261 // ---------------------------------------------------------------------------
       
   262 TInt CATDialVoice::ProcessUnsolicitedCallCreated(const TUnsolicitedParams& aParams)
       
   263 	{
       
   264 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::ProcessUnsolicitedCallCreated()"));
       
   265 	
       
   266 	if (aParams.iEvent !=  KLtsyUnsolicitedEvent05)
       
   267 		{
       
   268 		return KErrGeneral;
       
   269 		}
       
   270 	
       
   271 	TInt nCallId = aParams.iIdx;
       
   272 	if ((nCallId < KLtsyMinCallId) || (nCallId > KLtsyMaxCallId))
       
   273 		{
       
   274 		nCallId = iPhoneGlobals.GetCallInfoManager().FindUnUesedCallId();
       
   275 		if (KErrNotFound == nCallId)
       
   276 			{
       
   277 			return KErrNotFound;
       
   278 			}
       
   279 		}
       
   280 	
       
   281 	iCallId = nCallId;
       
   282 	return KErrNone;
       
   283 	}
       
   284 
       
   285 // ---------------------------------------------------------------------------
       
   286 // CATDialVoice::ParseResponseL
       
   287 // other items were commented in a header
       
   288 // ---------------------------------------------------------------------------
       
   289 void CATDialVoice::ParseResponseL(const TDesC8& aResponseBuf)
       
   290 	{
       
   291 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::ParseResponseL()"));
       
   292 	
       
   293 	if (aResponseBuf.Match(KLtsyUnsolicitedCallCreated) == 0)
       
   294 		{
       
   295 		LOGTEXT2(_L8("[Ltsy CallControl] iDialStep = %d"),iDialStep);
       
   296 		ASSERT(iDialStep == EATWaitForDiallingComplete);
       
   297 		
       
   298 		TUnsolicitedParams aParams;
       
   299 		iResult = ParseUnsolicitedCommandBufL(aParams, aResponseBuf);
       
   300 		if (iResult == KErrNone)
       
   301 			{
       
   302 			iResult = ProcessUnsolicitedCallCreated(aParams);
       
   303 			}
       
   304 		}
       
   305 	else if (aResponseBuf.Match(KLtsyUnsolicitedCallingAltert) == 0)
       
   306 		{
       
   307 		LOGTEXT2(_L8("[Ltsy CallControl] iDialStep = %d"),iDialStep);
       
   308 		ASSERT(iDialStep == EATWaitForConnectingComplete);
       
   309 		iResult = KErrNone;
       
   310 		}
       
   311 	else if (aResponseBuf.Match(KLtsyOkString) == 0)
       
   312 		{
       
   313 		LOGTEXT2(_L8("[Ltsy CallControl] iDialStep = %d"),iDialStep);
       
   314 		LOGTEXT(_L8("[Ltsy CallControl] The call was connected successfully"));
       
   315 		
       
   316 		// if no KLtsyUnsolicitedCallingAltert string was received before we receive "OK"
       
   317 		// it aslo means the call has been connected even though such KLtsyUnsolicitedCallingAltert
       
   318 		// or KLtsyUnsolicitedCallCreated was not received
       
   319 		if(iDialStep == EATWaitForConnectingComplete || iDialStep == EATWaitForDiallingComplete)
       
   320 		    {
       
   321 		    LOGTEXT(_L8("[Ltsy CallControl] No alert string [+WIND: 2] received before we receive string [ok]"));
       
   322 		    
       
   323 		    if (iCallId == KLtsyErrorCallId)
       
   324 		    	{
       
   325 		    	iCallId = iPhoneGlobals.GetCallInfoManager().FindUnUesedCallId();
       
   326 		    	}
       
   327 		    
       
   328 		    HandleConnectingComplete();
       
   329 		    iDialStep = EATWaitForConnectedComplete;
       
   330 		    }
       
   331 		
       
   332 		iResult = KErrNone;
       
   333 		}
       
   334 	else if (aResponseBuf.Match(KLtsyBusyString) == 0)
       
   335 		{
       
   336 		LOGTEXT(_L8("[Ltsy CallControl] Busy tone was detected"));
       
   337 		//iResult = KErrEtelBusyDetected;
       
   338 		iResult = KErrGsmCCUserBusy;
       
   339 		}
       
   340 	else if (aResponseBuf.Match(KLtsyNoAnswerString) == 0)
       
   341 		{
       
   342 		LOGTEXT(_L8("[Ltsy CallControl] No answer from remote party"));
       
   343 		//iResult = KErrEtelNoAnswer;
       
   344 		iResult = KErrGsmCCUserAlertingNoAnswer;
       
   345 		}
       
   346 	else if (aResponseBuf.Match(KLtsyNoCarrierString) == 0)
       
   347 		{
       
   348 		// that could be the problem of the client, when there were two ongoing call, but a new call is coming up. As
       
   349 		// GSM only support two ongoing calls
       
   350 		LOGTEXT(_L8("[Ltsy CallControl] No carrier was detected"));
       
   351 		if(iCallId == KLtsyErrorCallId)
       
   352 		    {
       
   353 		    iResult = KErrEtelNoCarrier;
       
   354 		    return;
       
   355 		    }
       
   356 		        
       
   357 		const TLtsyCallInformation& tCallInfo(iPhoneGlobals.GetCallInfoManager().GetCallInformationByCallId(iCallId));		
       
   358 		if (tCallInfo.GetCallIdIsUsedInfo() == TLtsyCallInformation::EUsed)
       
   359 			{
       
   360 			if (tCallInfo.GetCallState() == TLtsyCallInformation::EDialingCall)
       
   361 				{
       
   362 				iResult = KErrEtelNoCarrier;
       
   363 				}
       
   364 			else
       
   365 				{
       
   366 				iResult = KErrGsmCCNormalCallClearing;
       
   367 				}
       
   368 			}
       
   369 		}
       
   370 	else if (aResponseBuf.Match(KLtsyErrorString) == 0)
       
   371 		{
       
   372 		LOGTEXT(_L8("[Ltsy CallControl] There was an error connecting the call"));
       
   373 		iResult = KErrArgument;
       
   374 		}
       
   375 	else
       
   376 		{
       
   377 		LOGTEXT(_L8("[Ltsy CallControl] An unknown problem occurred connecting the call"));
       
   378 		iResult = KErrGeneral;
       
   379 		}
       
   380 	}
       
   381 
       
   382 // ---------------------------------------------------------------------------
       
   383 // CATDialVoice::Complete
       
   384 // other items were commented in a header
       
   385 // ---------------------------------------------------------------------------
       
   386 void CATDialVoice::Complete()
       
   387 	{
       
   388 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::Complete()"));
       
   389 	LOGTEXT2(_L8("[Ltsy CallControl] iStatus = %d"), iStatus);
       
   390 	LOGTEXT2(_L8("[Ltsy CallControl] iResult = %d"), iResult);
       
   391 	//Remove Active Command and Stop timer
       
   392 	CAtCommandBase::Complete();
       
   393 		
       
   394 	//Let other command can use I/O port
       
   395 	iPhoneGlobals.iEventSignalActive = EFalse;
       
   396 	}
       
   397 
       
   398 // ---------------------------------------------------------------------------
       
   399 // CATDialVoice::HandleIOErrorL
       
   400 // other items were commented in a header
       
   401 // ---------------------------------------------------------------------------
       
   402 void CATDialVoice::HandleIOError()
       
   403 	{
       
   404 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::HandleIOError()"));
       
   405 	
       
   406 	if (iDialStep == EATWaitForWriteComplete)
       
   407 		{
       
   408 		if (iIsEmergencyCall)
       
   409 			{
       
   410 			iCtsyDispatcherCallback.CallbackCallControlDialEmergencyComp(iStatus, KLtsyErrorCallId);
       
   411 			}
       
   412 		else
       
   413 			{
       
   414 			iCtsyDispatcherCallback.CallbackCallControlDialVoiceComp(iStatus, KLtsyErrorCallId);
       
   415 			}
       
   416 		}
       
   417 	else
       
   418 		{
       
   419 		//Call id has not be allocated
       
   420 		if (KLtsyErrorCallId == iCallId)
       
   421 			{
       
   422 			if (iIsEmergencyCall)
       
   423 				{
       
   424 				iCtsyDispatcherCallback.CallbackCallControlDialEmergencyComp(iStatus, iCallId);
       
   425 				}
       
   426 			else
       
   427 				{
       
   428 				iCtsyDispatcherCallback.CallbackCallControlDialVoiceComp(iStatus, iCallId);
       
   429 				}
       
   430 			}
       
   431 		else
       
   432 			{
       
   433 			iCtsyDispatcherCallback.CallbackCallControlNotifyCallStatusChangeInd(iStatus, 
       
   434 					                                                             iCallId, 
       
   435 																		         RMobileCall::EStatusDisconnecting);
       
   436 			
       
   437 			iCtsyDispatcherCallback.CallbackCallControlNotifyCallStatusChangeInd(iStatus, 
       
   438 					                                                             iCallId, 
       
   439 																		         RMobileCall::EStatusIdle);
       
   440 			//Setting ltsy call information
       
   441 			iPhoneGlobals.GetCallInfoManager().ResetCallInformationByCallId(iCallId);
       
   442 			}
       
   443 		}
       
   444 	}
       
   445 
       
   446 // ---------------------------------------------------------------------------
       
   447 // CATDialVoice::HandleResponseError
       
   448 // other items were commented in a header
       
   449 // ---------------------------------------------------------------------------
       
   450 void CATDialVoice::HandleResponseError()
       
   451 	{
       
   452 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::HandleResponseError()"));
       
   453 	
       
   454 	//Call id has not be allocated
       
   455 	if (KLtsyErrorCallId == iCallId)
       
   456 		{
       
   457 		if (iIsEmergencyCall)
       
   458 			{
       
   459 			iCtsyDispatcherCallback.CallbackCallControlDialEmergencyComp(iResult, iCallId);
       
   460 			}
       
   461 		else
       
   462 			{
       
   463 			iCtsyDispatcherCallback.CallbackCallControlDialVoiceComp(iResult, iCallId);
       
   464 			}
       
   465 		}
       
   466 	else
       
   467 		{
       
   468 		iCtsyDispatcherCallback.CallbackCallControlNotifyCallStatusChangeInd(iResult, 
       
   469 																			 iCallId, 
       
   470 																			 RMobileCall::EStatusDisconnecting);
       
   471 		
       
   472 		iCtsyDispatcherCallback.CallbackCallControlNotifyCallStatusChangeInd(iResult, 
       
   473 																			 iCallId, 
       
   474 																			 RMobileCall::EStatusIdle);
       
   475 		//Setting ltsy call information
       
   476 		iPhoneGlobals.GetCallInfoManager().ResetCallInformationByCallId(iCallId);
       
   477 		}
       
   478 	}
       
   479 
       
   480 // ---------------------------------------------------------------------------
       
   481 // CATDialVoice::HandleDiallingCompleteL
       
   482 // other items were commented in a header
       
   483 // ---------------------------------------------------------------------------
       
   484 void CATDialVoice::HandleDiallingComplete()
       
   485 	{
       
   486 	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDialVoice::HandleDiallingComplete()"));
       
   487 	LOGTEXT2(_L8("[Ltsy CallControl] Call id = %d"), iCallId);
       
   488 	
       
   489 	if (iIsEmergencyCall)
       
   490 		{
       
   491 		iCtsyDispatcherCallback.CallbackCallControlDialEmergencyComp(KErrNone, iCallId);
       
   492 		}
       
   493 	else
       
   494 		{
       
   495 		iCtsyDispatcherCallback.CallbackCallControlDialVoiceComp(KErrNone, iCallId);
       
   496 		}
       
   497 	
       
   498 	LOGTEXT(_L8("[Ltsy CallControl] Call status = RMobileCall::EStatusDialling"));
       
   499 	iCtsyDispatcherCallback.CallbackCallControlNotifyCallStatusChangeInd(KErrNone, 
       
   500 																		 iCallId, 
       
   501 													 RMobileCall::EStatusDialling);
       
   502 	
       
   503 	//Setting ltsy call information
       
   504 	TLtsyCallInformation& tCallInfo(iPhoneGlobals.GetCallInfoManager().GetCallInformationByCallId(iCallId));
       
   505 	tCallInfo.SetCallId(iCallId);
       
   506 	tCallInfo.SetCallIdIsUsedInfo(TLtsyCallInformation::EUsed);
       
   507 	tCallInfo.SetCallDirection(TLtsyCallInformation::EMoCall);
       
   508 	tCallInfo.SetCallState(TLtsyCallInformation::EDialingCall);
       
   509 	tCallInfo.SetCallMode(TLtsyCallInformation::EVoiceCall);
       
   510 	tCallInfo.SetConferenceCall(TLtsyCallInformation::ENotConference);
       
   511 	//Emergency call flag
       
   512 	if (iIsEmergencyCall)
       
   513 		{
       
   514 		tCallInfo.SetEmergencyCallFlag(ETrue);
       
   515 		}
       
   516 	
       
   517 	
       
   518 	//If have another and it's state is not hold so setting hold
       
   519 	for (TInt n = KLtsyMinCallId; n <= KLtsyMaxCallId; n++)
       
   520 		{
       
   521 		if (n != iCallId)
       
   522 			{
       
   523 			TLtsyCallInformation& tCallInfo(iPhoneGlobals.GetCallInfoManager().GetCallInformationByCallId(n));
       
   524 			if (tCallInfo.GetCallIdIsUsedInfo() == TLtsyCallInformation::EUsed && 
       
   525 				tCallInfo.GetCallState() != TLtsyCallInformation::EHeldCall)
       
   526 				{
       
   527 				//Setting ltsy call state
       
   528 				tCallInfo.SetCallState(TLtsyCallInformation::EHeldCall);
       
   529 				
       
   530 				//Notify CTSY state change
       
   531 				iCtsyDispatcherCallback.CallbackCallControlNotifyCallStatusChangeInd(KErrNone, 
       
   532 																					 n, 
       
   533 																      RMobileCall::EStatusHold);				
       
   534 				}
       
   535 			}
       
   536 		}
       
   537 	}
       
   538 
       
   539 // ---------------------------------------------------------------------------
       
   540 // CATDialVoice::HandleConnectingCompleteL
       
   541 // other items were commented in a header
       
   542 // ---------------------------------------------------------------------------
       
   543 void CATDialVoice::HandleConnectingComplete()
       
   544 	{
       
   545 	LOGTEXT(_L8("[Ltsy CallControl] Call status = RMobileCall::EStatusConnecting"));
       
   546 	
       
   547 	iCtsyDispatcherCallback.CallbackCallControlNotifyCallStatusChangeInd(KErrNone, 
       
   548 																		 iCallId, 
       
   549 													 RMobileCall::EStatusConnecting);	
       
   550 	
       
   551 	//Setting ltsy call information
       
   552 	TLtsyCallInformation& tCallInfo(iPhoneGlobals.GetCallInfoManager().GetCallInformationByCallId(iCallId));
       
   553 	tCallInfo.SetCallState(TLtsyCallInformation::EAlertingCall);
       
   554 	}
       
   555 
       
   556 // ---------------------------------------------------------------------------
       
   557 // CATDialVoice::HandleConnectedCompleteL
       
   558 // other items were commented in a header
       
   559 // ---------------------------------------------------------------------------
       
   560 void CATDialVoice::HandleConnectedComplete()
       
   561 	{
       
   562 	LOGTEXT(_L8("[Ltsy CallControl] Call status = RMobileCall::EStatusConnected"));
       
   563 	iCtsyDispatcherCallback.CallbackCallControlNotifyCallStatusChangeInd(KErrNone, 
       
   564 			                                                              iCallId, 
       
   565 			                                           RMobileCall::EStatusConnected);
       
   566 	
       
   567 	//Setting ltsy call information
       
   568 	TLtsyCallInformation& tCallInfo(iPhoneGlobals.GetCallInfoManager().GetCallInformationByCallId(iCallId));
       
   569 	tCallInfo.SetCallState(TLtsyCallInformation::EActiveCall);	
       
   570 	}
       
   571 
       
   572 // ---------------------------------------------------------------------------
       
   573 // CATDialVoice::EventSignal
       
   574 // other items were commented in a header
       
   575 // ---------------------------------------------------------------------------
       
   576 void CATDialVoice::EventSignal(TAtEventSource /*aEventSource*/, TInt aStatus)
       
   577 	{
       
   578 	LOGTEXT(_L8("[Ltsy] Starting CATDialVoice::EventSignal()"));
       
   579 	
       
   580 	iStatus = aStatus;
       
   581 	
       
   582 	if (aStatus != KErrNone)
       
   583 		{
       
   584 		HandleIOError();
       
   585 		Complete();
       
   586 		return;
       
   587 		}
       
   588 	
       
   589 	switch (iDialStep)
       
   590 		{
       
   591 		case EATWaitForWriteComplete:
       
   592 			iDialStep = EATWaitForDiallingComplete;
       
   593 			break;
       
   594 			
       
   595 		case EATWaitForDiallingComplete:
       
   596 			//first clean current line
       
   597 			ClearCurrentLine();
       
   598 			//Process result
       
   599 			if (iResult == KErrNone)
       
   600 				{
       
   601 				HandleDiallingComplete();
       
   602 				iDialStep = EATWaitForConnectingComplete;
       
   603 				}
       
   604 			else
       
   605 				{
       
   606 				HandleResponseError();
       
   607 				Complete();
       
   608 				}
       
   609 			break;
       
   610 			
       
   611 		case EATWaitForConnectingComplete:
       
   612 			//first clean current line
       
   613 			ClearCurrentLine();
       
   614 			//Process result
       
   615 			if (iResult == KErrNone)
       
   616 				{
       
   617 				HandleConnectingComplete();
       
   618 				iDialStep = EATWaitForConnectedComplete;
       
   619 				}
       
   620 			else
       
   621 				{
       
   622 				HandleResponseError();
       
   623 				Complete();
       
   624 				}
       
   625 		    break;
       
   626 		    
       
   627 		case EATWaitForConnectedComplete:
       
   628 			//first clean current line
       
   629 			ClearCurrentLine();
       
   630 			//Process result
       
   631 			if (iResult == KErrNone)
       
   632 				{
       
   633 				HandleConnectedComplete();
       
   634 				}
       
   635 			else
       
   636 				{
       
   637 				HandleResponseError();
       
   638 				}
       
   639 			
       
   640 			Complete();
       
   641 			break;
       
   642 			
       
   643 		default:
       
   644 			break;
       
   645 		}
       
   646 	}
       
   647 
       
   648 //End of file