maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Auto answer (https://talk.maemo.org/showthread.php?t=64444)

fuel__2001 2010-10-27 09:46

Auto answer
 
Im a complete novice here, but out of frustration with a feature that is missing ive managed (with more luck than programming ability) to use the guides to create a script in python to auto answer calls which i built on a windows platform.

Ive tested the script on the N900 and im shocked i managed to get it to work, which for a first attempt only took 3 evenings :rolleyes:.

Now if i want to go one further and create a button in the 'settings/phone' menu on the phone so the script can be turned on/off - does something else need to be added to the script? also where is a good place to start building the GUI?

Now im sure that script could do with some more work so please feel free to do your worst ;)

Quote:

#! /usr/bin/python
import os
import gobject, dbus
import time
from dbus.mainloop.glib import DBusGMainLoop

def handle_call(obj_path, number):
bus = dbus.SystemBus()
callobject = bus.get_object('com.nokia.csd.Call', '/com/nokia/csd/call/1')
smsiface = dbus.Interface(callobject, 'com.nokia.csd.Call.Instance')
time.sleep(0.5)
smsiface.Answer()
DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
bus.add_signal_receiver(handle_call, path='/com/nokia/csd/call', dbus_interface='com.nokia.csd.Call', signal_name='Coming')
gobject.MainLoop().run()

rambo 2010-10-27 19:17

Re: Auto answer
 
Cool, you would probably want to do the following things:

1. Have use GConf to check for auto-answer enabled/disabled
2. Have a very small widget to change the config value in 1
3. Daemonize the python script (for example with http://pypi.python.org/pypi/python-daemon/1.4.5) and make it start automatically on device start.

Happy learning.

aathava 2010-10-28 05:00

Re: Auto answer
 
wow! tested working gud,
can u add anything like answering machine
- playing a prerecorded mp3 file on aswering

fuel__2001 2010-10-28 09:48

Re: Auto answer
 
Quote:

Originally Posted by aathava (Post 854655)
wow! tested working gud,
can u add anything like answering machine
- playing a prerecorded mp3 file on aswering

for me to even get this far was very slow, i didnt even realise using an underscore in the filename would cause problems.

im sure adding other things into the script can be done but its well out of my scope ATM.

The next step for me is to make a button and put it into the phones menu. i have no idea how long that will take but considering im learning as i go it could take some time, weeks rather than days.

if someone else wants to help or do the leg work to get this project moving then im more than happy to take a back seat. Im studying for a degree and have a fulltime and partime job as well as family commitments, so my time is very limited.

aathava 2010-10-28 10:43

Re: Auto answer
 
ok, lets collabrate
i would try to make an widget to run this script but to put a button on phone menu, may be some has to help us

ossipena 2010-10-28 10:50

Re: Auto answer
 
what do you mean by phone menu? the menu that appears when you tap the title bar when phone app is open?

aathava 2010-10-28 10:58

Re: Auto answer
 
no, under settings>phone
or it shall be added in settings>extra

fuel__2001 2010-10-28 11:03

Re: Auto answer
 
Marvellous news. any help would be greatly appreciated

EDIT - just had a rethink thought about where to place the button. In symbian (N95) the auto answer was placed in the profiles. I remember setting a profile up so i would only have to insert my headphones (which was usually when i was driving) and the phone would answer automatically.

any other thoughts about the placement of the button?

ramchagol 2010-11-15 19:06

Re: Auto answer
 
settings > phone

would be a great place and logical. maybe create like a check on/off option. this would be perfect for driving.

or if possible, create a whole new profile (car mode?) that will :

- auto answer calls
- automatically go in to speaker mode

fuel__2001 2010-11-18 09:27

Re: Auto answer
 
Quote:

Originally Posted by ramchagol (Post 874325)
settings > phone

would be a great place and logical. maybe create like a check on/off option. this would be perfect for driving.

or if possible, create a whole new profile (car mode?) that will :

- auto answer calls
- automatically go in to speaker mode

Its so simple when you no what your doing and a very simple idea for someone who knows what there doing to create - but for me its like being blindfolded and learning as i go.

Its a big learning process. Ive had a play with QT but i found the checkbox widget doesnt look like the hildon based checkbox (perhaps im not using it correctly). So ive got as far as installing ubuntu in a VM, now iv installed scratchbox so i can play with hildon :rolleyes: but for some reason it wont let me login. another hurdle to overcome.

I have spoke with the Developer of profilesX as i thought it would be easy just to insert the script into a profile, but it seems an app still has to be built to be able to do this. Creating a profile for driving is really what i would like to see. Just a simple checkbox is all thats needed to begin with.

So unless someone would like to complete the UI it could be a long wait for a finished app. I'm sure people who know what there doing, its just and hours work. I would be very grateful if someone helped out with this.

nicolai 2010-11-18 09:47

Re: Auto answer
 
For the car-mode profile, as I already told fuel__2001,
ProfilesX can not be used to start specific actions. ProfilesX can
only change the profile settings (ringtone, vibra, ...)
But the whole benefit of ProfilesX is to define more than those
to builtin profiles.
So you could go the other way around.
Use ProfilesX to define a new profile "Car Mode".
(Just to have a special named profile)

Now your autoanswer script could listen on dbus for
the active profile (profiled emits a dbus-signal if the
user changes the active profile).
And if the current profile has this special name,
enable autoanswer or speaker mode ...

nicolai

systemcrash 2010-11-18 10:09

Re: Auto answer
 
Quote:

Originally Posted by fuel__2001 (Post 854999)
In symbian (N95) the auto answer was placed in the profiles. I remember setting a profile up so i would only have to insert my headphones (which was usually when i was driving) and the phone would answer automatically.

any other thoughts about the placement of the button?

I agree the best place to put the button is the profile. Should it be a check button as for the vibrator setting (sorry if vibrator is not the exact word, I have my device set to use spanish)?

fuel__2001 2010-11-18 20:33

Re: Auto answer
 
Quote:

Originally Posted by nicolai (Post 876891)
So you could go the other way around.
Use ProfilesX to define a new profile "Car Mode".
(Just to have a special named profile)

Now your autoanswer script could listen on dbus for
the active profile (profiled emits a dbus-signal if the
user changes the active profile).
And if the current profile has this special name,
enable autoanswer or speaker mode ...

nicolai

Is this something you would be able and willing to do?

As its well beyond the scope of what i'm currently able to achieve with my limited knowledge.

fuel__2001 2010-12-13 04:40

Re: Auto answer
 
Im finally starting to understand what I need to do to get this script to work.

I've read a little about dbus but im not sure how to point my script at profilesx, so when a certain 'named' profile is selected my autoanswer script starts.

This is as far as ive got and thats not right, can someone get point me in the right direction please

Code:

bus = dbus.SessionBus()
proxy = bus.get_object('com.nokia.profiled', '/home/user/.profiled/current')


nicolai 2010-12-13 07:10

Re: Auto answer
 
Looking at my code, how I listen to profile
changes, I realized it may be easier to include
this in profilesx. Even though I said profilesx
is only for managing profiles settings, my
statusbar plugin is listinig for profiles changes to
change the profile icon.

So, I can make an extra option in the settings dialog
for autoanswer and my statusbar plugin can
autoanswer the incomig call depending on the
current profile.

nicolai

fuel__2001 2010-12-13 12:00

Re: Auto answer
 
Quote:

Originally Posted by nicolai (Post 895676)
Looking at my code, how I listen to profile
changes, I realized it may be easier to include
this in profilesx. Even though I said profilesx
is only for managing profiles settings, my
statusbar plugin is listinig for profiles changes to
change the profile icon.

So, I can make an extra option in the settings dialog
for autoanswer and my statusbar plugin can
autoanswer the incomig call depending on the
current profile.

nicolai

That would be brilliant if you could manage slip the script into profilesx.

So let me get this right - Are you thinking it would it be dependent on a specific 'named' profile to start the script?
Or, to add a checkbox widget to the profile settings, so any selected profile could be set up to use the script?

nicolai 2010-12-13 13:14

Re: Auto answer
 
This one:
Quote:

Originally Posted by fuel__2001 (Post 895841)
Or, to add a checkbox widget to the profile settings, so any selected profile could be set up to use the script?

nicolai

fuel__2001 2010-12-13 13:29

Re: Auto answer
 
I think using a widget in the settings leaves profilesx more configurable.

You could then add a specific ring tone or icon to any 'named' profile of your choosing :)

nicolai 2011-01-17 22:22

Re: Auto answer
 
Finally it is done.
ProfilesX Version 0.8 with autoanswer and loudspeaker option.
You can select to enable autoanswer and / or loudspeaker for
the general and every user defined profiles.

With autoanswer enabled, the phone automatically accepts
phone calls (cellular only, no skype) after 1 second.
But only if the proximity sensor isn't covered. That way it won't
accidently accept the phone call while your phone is in your
pocket.

The loudspeaker option will switch to speaker mode when then
call is accepted.

Thank you fuel_2001 for this great idea.
regards
Nicolai

PUNK 2011-01-19 02:48

Re: Auto answer
 
Great!THX a lot!

cheve 2011-01-19 04:03

Re: Auto answer
 
just wondering if the "fm-carkit" can also be integrated into ProfilesX?

is it possible to make the wait time configurable(instead of 1 sec)?

@nicolai & fuel__2001: Thank you very much for the work

fuel__2001 2011-01-20 00:20

Re: Auto answer
 
Quote:

Originally Posted by cheve (Post 923545)
just wondering if the "fm-carkit" can also be integrated into ProfilesX?

is it possible to make the wait time configurable(instead of 1 sec)?

@nicolai & fuel__2001: Thank you very much for the work

The python script allows for a few rings before the call is answered, so I'm sure its possible to configure the amount of time before the call is answered within profilesx
I'm not sure how the wait time has been implemented in profilesx - ask nicolai as hes written the new code, ive not had much of a chance to look at his work as ive been busy with life :rolleyes:

+1
I love the idea of the 'fm-kit' now that would be a very cool feature to include in profilesx

nicholes 2011-01-26 13:07

Re: Auto answer
 
has anyone of you managed to get auto answer with a mp3 file?(user define)??????? i must need it plz plz help

hgroove 2011-01-26 13:47

Re: Auto answer
 
That is great, the autoanswer feature.

Now we need a AutoHangUp feature with temporizer.

Excellent, thanks a lot...

zlatko 2011-02-02 07:04

Re: Auto answer
 
Autoanswer was a feature I missed alot. I really hope that behaviour of proximity sensor will be made configurable so that autoanswer can be used with handsfree when phone is in the pocket. It is the only scenario I need autoanswer for actually.
Thank you for spending your time on this!
EDIT: There is already a version with option for disabling proximity check for autoanswer. Works great!

eyolsen 2011-02-16 07:59

Re: Auto answer
 
Hi
I can see that you have figured out how to activate auto answer on Nokia N900.:)
How can I activate it on my cell phone?
Need to get the explanation step by step. Cause I am not so good at cell phones.:o
Is it possible to have the auto answer activated when I have the phone in my pocket, I really need that because I am driving a motorcycle.
Tanks

cipper 2011-02-16 08:14

Re: Auto answer
 
Quote:

Originally Posted by eyolsen (Post 947768)
Hi
I can see that you have figured out how to activate auto answer on Nokia N900.:)
How can I activate it on my cell phone?
Need to get the explanation step by step. Cause I am not so good at cell phones.:o
Is it possible to have the auto answer activated when I have the phone in my pocket, I really need that because I am driving a motorcycle.
Tanks

Settings -> profileX -> create a new profile -> mark auto-answer (scroll to bottom) -> unmark prox. sensor -> save -> select the new profile when needed.

eyolsen 2011-02-26 19:22

Re: Auto answer
 
Hi again
There is no ProfileX under settings on my phone, Is there something that I have to do to update my phone?
Were and how do I do to update my nokia N 900?
Tanks

zlatko 2011-02-26 19:37

Re: Auto answer
 
@eyolsen
You have to install ProfilesX first. Do it via AppManager(you have to enable extras-devel first). Then you will see ProfilesX in Settings.

eyolsen 2011-02-26 19:51

Re: Auto answer
 
where in the AppManager can I find it? It seems to me like a big jungle to figure this out!:confused:
Do I need to installappdownloader 0.2-12 first?
I know I am not so good at this! sorry about it.

zlatko 2011-02-26 20:09

Re: Auto answer
 
AppManager is utility application that comes built in on device. Just go to app launcher and find it. It will need connection to internet. Start App Manager, click "Download" and follow the onscreen labels.

eyolsen 2011-02-26 20:27

Re: Auto answer
 
I am in settings/ app manager(Application manager)

Tried update, but no updates avalible.

Then I tried Download and choosed "all" and searched for ProfilesX, but I cant see anything called like that, and I cant see anything called App launcher exept something with portrait and quick launch.

zlatko 2011-02-26 20:39

Re: Auto answer
 
You have to search for ProfilesX when you are in App Manager. You have to enable "extras-devel" repository first:

In the Application Manager:

1. Navigate to the application menu (tap the title bar)
2. Select ‘Application catalogs’
3. Select ‘New’
4. Enter a catalog name of ‘Maemo extras-devel’
5. Enter a web address of http://repository.maemo.org/extras-devel
6. Enter a distribution of ‘fremantle’
7. Enter components of ‘free non-free’
8. Select ‘Save’


Then you install ProfilesX.

fuel__2001 2011-02-26 20:41

Re: Auto answer
 
you will need to enable the other repositories so you can see profilesx

Hopefully this might help

eyolsen 2011-02-27 16:56

Re: Auto answer
 
Tanks a million!
Now it is working great.

onasre 2011-04-28 01:05

Re: Auto answer
 
Quote:

Originally Posted by nicholes (Post 929002)
has anyone of you managed to get auto answer with a mp3 file?(user define)??????? i must need it plz plz help

Yah Has anyone Manad=ged to get it done?

fuel__2001 2011-04-28 20:43

Re: Auto answer
 
Quote:

Originally Posted by onasre (Post 996524)
Yah Has anyone Manad=ged to get it done?

This script is now a feature of the profilesx application, which is a far better way to enable auto answer.

Therefore I've got no intention of developing this script further.

kanavasp 2011-05-01 21:44

Re: Auto answer
 
Thanks a lot all of you......
Spesialy NICOLAI...!!!!!
I did it new profile Named "motobice" with auto answer after 3sec..
THANKS AGAIN..............................!!!!!!!!!!!!!!! !!!!!!!!!!!

rosh 2011-05-02 13:03

Re: Auto answer
 
Is there anyway to set auto answer on a specific incoming number?

malkavian 2012-07-05 21:11

Re: Auto answer
 
Thank you fuel__2001 and Nicolai. Here you have another happy motorcycle driver :)


All times are GMT. The time now is 20:05.

vBulletin® Version 3.8.8