maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Answering calls programmatically (https://talk.maemo.org/showthread.php?t=54186)

ceefour 2010-05-28 06:59

Answering calls programmatically
 
I'd like to write a script to auto-answer a call (actually, my intention is to answer-then-release). Releasing (hangup/reject) is working.

But answering a call always throws a com.nokia.csd.Call.Error.NotAllowed exception.

From: http://wiki.maemo.org/PyMaemo/Phone_..._examples#Call (I wrote the quoted part below myself)

Quote:

Answer current phone call

dbus-send --system --print-reply --dest=com.nokia.csd.Call /com/nokia/csd/call/1 com.nokia.csd.Call.Answer

This will answer/pickup the current (first) call.

TODO: Early experiments show that this function throws com.nokia.csd.Call.Error.NotAllowed exception. How to get around this?
Can someone shed a light on this? Thank you.

roman4 2010-06-23 21:52

Re: Answering calls programmatically
 
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

ceefour 2010-06-24 03:05

Re: Answering calls programmatically
 
Thanks roman4 !

Never knew that was the case. I wish this is documented somewhere.. anywhere!

fuel__2001 2010-10-24 12:45

Re: Answering calls programmatically
 
Quote:

Originally Posted by ceefour (Post 684836)
I'd like to write a script to auto-answer a call (actually, my intention is to answer-then-release). Releasing (hangup/reject) is working.

But answering a call always throws a com.nokia.csd.Call.Error.NotAllowed exception.

From: http://wiki.maemo.org/PyMaemo/Phone_..._examples#Call (I wrote the quoted part below myself)



Can someone shed a light on this? Thank you.

I saw from your wiki entry you seemed to have updated the script to answer the call automatically.

Is there any possibility you (or anyone else) could create a GUI, so the auto answering can be turned on and off easily?

This would be a welcomed addition and something ive been searching for ages, whether for a wired or bluetooth connection.

njain 2011-04-03 18:02

Re: Answering calls programmatically
 
Quote:

Originally Posted by roman4 (Post 726914)
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 ;)


All times are GMT. The time now is 16:41.

vBulletin® Version 3.8.8