Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Hang up voice calls

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: symbianyucca (06 Oct 2008)
Last edited: hamishwillee (23 Jul 2012)
Reviewer Approved    Thumbs up icon sm.jpg

Hanging up Phone calls


There are several ways on hanging up the phone calls, here’s a list on what is available for S60 in public space:

1. CTelephony 2. AT commands 3. CPhCltCommandHandler

Call can only be hang up in certain call states, thus you should also have a look into call state monitoring example

Hanging up with CTelephony

With CTelephony you can only hang up calls that you own and which are connected. Thus hanging up with CTelephony is only usable if you either: Dialed the call with DialNewCall() or answrered the call with AnswerIncomingCall() functions.

With both of these functions you get CTelephony::TCallId parameter, which you need to pass to the CTelephony’s Hangup() function. The actual code is this simple:

 iTelephony->Hangup(iStatus, iCallId);
SetActive();

The full code is also shown in How to terminate call

Hanging up with At Commands

AT commands sending example can be found from File:Send AT Commands.zip.

With the example you just send AT+CHUP while having call in dialing,ringing or connected state.

Hanging up with CPhCltCommandHandler

First you need to construct a instance of CPhCltCommandHandler, this can be done with following code:

 _LIT( KPhCltExtLib, "PhoneClientExt.dll" );
User::LeaveIfError( iLibrary.Load( KPhCltExtLib ) ); // Load PhoneClientExt dll
 
TInt res = 0; TInt err=0;
TRAP(err,res = iLibrary.Lookup( 1 )());
if (err == KErrNone)
{
iFactory = reinterpret_cast< CPhCltExtFactory * >( res );
if ( iFactory )
{
iHandler = iFactory->CPhCltCommandHandlerLD();
User::LeaveIfError(iServer.Connect());
iHandler->Open(iServer);
}
}

After using the instance, you can close and delete it as follows:

 if(iHandler)
{
iHandler->Close();
}
delete iHandler;
iHandler = NULL;
iLibrary.Close();

The actual hanging up is handled with following active object function call:

 iHandler->Chup(iStatus);
SetActive();

Note:CPhCltCommandHandler will not work from 3rd ed FP2 onwards

This page was last modified on 23 July 2012, at 07:59.
90 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×