hi...
i am developing an application which needs one functionality to initiate a call and hang up the same call in s60 2nd edition................

for this purpose i am using etel APIs.....

i have written code for this purpose.....
i am getting two problems
1...when i initiate call using this app its showing the calling status..like...
calling
9987988798
which i dont want
2.....after initiating a call and when it will get connected to other side, i want to hang up the call....which code i have written but why its not getting called i dont know..


i am putting my code here and if anybody have any idea...pls guide me

this is the code in my active object class....

CMyActiveClass* CMyActiveClass::NewL()
{
CMyActiveClass* self = new (ELeave) CMyActiveClass();
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}

CMyActiveClass::CMyActiveClass(): CActive(0)
{

}

void CMyActiveClass::ConstructL()
{
iEnv = CEikonEnv::Static();
CActiveScheduler::Add(this);
//StartObserver();
}

CMyActiveClass::~CMyActiveClass()
{
if (IsActive())
{
Cancel();
}
else
{
ReleasePhone();
}
}

void CMyActiveClass::RunL()
{
if (iStatus == KErrNone)
{

if (iCallStatus == RCall::EStatusHangingUp || iCallStatus == RCall::EStatusIdle || iCallStatus == RCall::EStatusUnknown)
{
iCall.Close();
}
else if(iCallStatus == RCall::EStatusConnected)
{
RCall iCall2;
// Try : iCall2.OpenExistingCall(iPhone,iName);
iCall2.OpenExistingCall(iLine,iName);
// Try : iCall2.DialCancel ();
// Try : iCall2.HangUp(iStatus);
iCall2.HangUp();
iCall2.Close();
}
iLine.NotifyStatusChange(iStatus, iCallStatus);
SetActive();
}
}

void CMyActiveClass:oCancel()
{
ReleasePhone();
}

void CMyActiveClass::StartObserver()
{
Cancel();
TBuf<20> PhoneNumber(KPhoneNumber);
if (InitializePhone(PhoneNumber) == KErrNone)
{
iLine.NotifyStatusChange(iStatus, iCallStatus);
SetActive();
}
}

TInt CMyActiveClass::InitializePhone(TDesC& iPhoneNumber)
{
TInt theError;
//if (iLineInited)
{
// return KErrNone;
}
theError = iTelServer.Connect();
if (theError)
{
return theError;
}
// Find the number of phones available from the tel server
TInt numberPhones;
theError = iTelServer.EnumeratePhones(numberPhones);
if (theError)
{
iTelServer.Close();
return theError;
}
// Check there are available phones
if (numberPhones < 1)
{
iTelServer.Close();
return KErrNotFound;
}
// Read the TSY module name
theError = iTelServer.GetTsyName(0, iTsyName);
if (theError != KErrNone)
{
iTelServer.Close();
return theError;
}
// Load in the phone device driver
theError = iTelServer.LoadPhoneModule(iTsyName);
if (theError)
{
iTelServer.Close();
return theError;
}
// Get info about the first available phone
RTelServer::TPhoneInfo info;
theError = iTelServer.GetPhoneInfo(0, info);
if (theError)
{
iTelServer.UnloadPhoneModule(iTsyName);
iTelServer.Close();
return theError;
}
// Use this info to open a connection to the phone, the phone is identified by its name
theError = iPhone.Open(iTelServer, info.iName);
if (theError)
{
iTelServer.UnloadPhoneModule(iTsyName);
iTelServer.Close();
return theError;
}
// Get info about the first line from the phone
RPhone::TLineInfo lineInfo;
theError = iPhone.GetLineInfo(0, lineInfo);
if (theError)
{
iPhone.Close();
iTelServer.UnloadPhoneModule(iTsyName);
iTelServer.Close();
return theError;
}
// Use this to open a line
theError = iLine.Open(iPhone, lineInfo.iName);
if (theError)
{
iPhone.Close();
iTelServer.UnloadPhoneModule(iTsyName);
iTelServer.Close();
return theError;
}

//test
//Open a new call on this line
TBuf <100> newCallName;
theError = iCall.OpenNewCall(iLine, newCallName);
if (theError)
{
iCall.Close();
iPhone.Close();
iTelServer.UnloadPhoneModule(iTsyName);
iTelServer.Close();
return theError;
}

//newCallName will now contain the name of the call
theError = iCall.Dial(iPhoneNumber);
if (theError)
{
iCall.Close();
iPhone.Close();
iTelServer.UnloadPhoneModule(iTsyName);
iTelServer.Close();
return theError;
}

//test
return KErrNone;
}

void CMyActiveClass::ReleasePhone()
{
iLine.NotifyIncomingCallCancel();
iLine.Close();
iPhone.Close();
iTelServer.UnloadPhoneModule(iTsyName);
iTelServer.Close();
}

i am using StartObserver function to initiate a call....