View Single Post
Posts: 4 | Thanked: 3 times | Joined on Aug 2010
#5
Originally Posted by roman4 View Post
If you answer the call immediately as you receive the call indication the phone seems to be in a specific call state where answering is not allowed yet.

If you answer the call using the described DBUS message after a delay of e.g. 1 s it works out fine.

Another (probably better) approach is to register to the CallStatus DBUS message ("com.nokia.csd.Call", "/com/nokia/csd/call/1", "com.nokia.csd.Call.Instance.CallStatus") and wait for a call status >= 2 (=CSD_CALL_STATUS_COMING) after the "Coming" message.

Best regards,
Roman
To answer incoming calls automatically, Answer() method of the call instance shows not allowed exception.. And to know the call_status of the incoming call I tried creating an instance of CallStatus interface.. but it raised unknown method exception, I found about GetStatus and implemented it in the following way:

hob = bus.get_object('com.nokia.csd.Call', '/com/nokia/csd/call/1')
hif = dbus.Interface(hob, dbus_interface='com.nokia.csd.Call.Instance.GetSta tus')
print hif

The hif that is printed is: <Interface <Proxy object> implementing GetStatus at 0xa..>
How do I finally now get the status so that I could use:

if call_status >= 2:
hif.Answer()

and answer calls automatically..

PS: I want to answer calls automatically only when headphones are plugged in.. so that the trouble of picking out from the pocket to answer the call is reduced.. At times, while I get hold of the phone call gets disconnected

Last edited by njain; 2011-04-03 at 18:06.