PDA

View Full Version : Phone call listener



raulftang
24th April 2007, 10:19
Hello,
Currently, I'm working on an application that runs in the background to watch the phone call event using qtopia-greenphone-sdk 4.1.7.
I use following code sample to achieve the target.

connect(phoneLine,newCall(const QPhoneCall),this,callAdded(const QPhoneCall));

void MyClient::callAdded(const QPhoneCall& call)
{
//
}
The problem is:
When I dial a number, the application can't enter into "callAdded" function unless the dialed part answers the call (the call is in "connected" state).
But I think the call should be added when it still is in "dialing" state.

How can I implement to be notified when a phone call is in "dialing" state?

Thanks

thawkins
25th April 2007, 20:09
OK, I see your problem. QPhoneCallManager (phoneLine) has a statesCahnged() signal, but that's only after the call has been placed on the calls list, which doesn't happen until after it has been dialed. The only thing I can suggest is that when you call the create() method to place a call, grab and save the QPhoneCall instance that is returned and use QTimer to poll the QPhoneCall::state() (or QPhoneCall::dialing()) at some reasonably fast rate. At least you have a mechanism to actually do something about the call before it is dialed (like hang up if dialing takes too long, etc). I looked through QPhoneCall for some type of signal you could tie into, but it doesn't have any!