This page was last modified 04:23, 22 November 2007.
Monitoring call status with CTelephony
From Forum Nokia Wiki
The CCallMonitor illustrates how to monitor call status with CTelephony. This example is intended to be used only with S60 3rd Edition devices, and does not work with pre-3rd Edition devices.
For in and outgoing calls you could use this code for retrieving the caller's phone number.
CallsMonitor.cpp
CCallMonitor::CCallMonitor(MCallCallBack& aCallBack) :CActive(0),iCallBack(aCallBack),iCurrentStatusPckg(iCurrentStatus) { } CCallMonitor::~CCallMonitor() { Cancel(); delete iTelephony; } void CCallMonitor::ConstructL(void) { CActiveScheduler::Add(this); iTelephony = CTelephony::NewL(); StartListening(); } void CCallMonitor::CancelOperation(void) { Cancel(); } void CCallMonitor::DoCancel() { iTelephony->CancelAsync(CTelephony::EVoiceLineStatusChangeCancel); } void CCallMonitor::RunL() { iCallBack.CallStatusChangedL(iCurrentStatus.iStatus,iStatus.Int()); if(iStatus != KErrCancel) { StartListening(); } } void CCallMonitor::StartListening() { Cancel(); iCurrentStatus.iStatus = CTelephony::EStatusUnknown; iTelephony->NotifyChange(iStatus,CTelephony::EVoiceLineStatusChange,iCurrentStatusPckg); SetActive(); }
CallsMonitor.h
class MCallCallBack { public: virtual void CallStatusChangedL(CTelephony::TCallStatus& aStatus, TInt aError)=0; }; class CCallMonitor : public CActive { public: ~CCallMonitor(); CCallMonitor(MCallCallBack& aCallBack); void ConstructL(); protected: void DoCancel(); void RunL(); private: void CancelOperation(void); void StartListening(); private: MCallCallBack& iCallBack; TInt iState; CTelephony::TCallStatusV1 iCurrentStatus; CTelephony::TCallStatusV1Pckg iCurrentStatusPckg; CTelephony* iTelephony; };
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Get Phone Number of incoming call | earendil | General Symbian C++ | 10 | 2007-06-05 02:57 |
| Cannot retrieve battery info on Samsung mobile phone. | balanikas | General Symbian C++ | 8 | 2008-05-29 17:53 |
| Call Ownership | erneykm | Symbian Networking & Messaging | 0 | 2006-03-14 03:16 |
| How to make and resived data call | mohhassan | General Symbian C++ | 5 | 2008-06-29 15:07 |
| Товарисчи программисты поможите плз | anthropos | Russian Developer Forum - Форум Российских разработчиков | 7 | 2007-12-21 04:22 |
