maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Script: auto-give a ring (missed call) (https://talk.maemo.org/showthread.php?t=89617)

dzano 2013-03-26 19:54

Script: auto-give a ring (missed call)
 
1 Attachment(s)
My girlfriend is killing me with this. She gives me a ring (missed call), it means that she is thinking about me, checking if I'm alive and I don't know what else...so if I don't drop call her back, she hassles me all day long.

Now I made this script that will make her happy. I don't know a thing about python so I used 1,2,3,4 or 5 other scripts to make this one.

AND IT WORKS LIKE A CHARM :D

http://youtu.be/AasFK70sOkQ

I'm posting it so someone could make it even better.


EDIT:

To make it clear, this will call only those numbers that gave you ONE ring (shorter that 3 sec).

If you miss a real call (that ringed longer that 3 sec) it wont call it, don't worry.

Use leafpad to edit this line:
blocklist = ["+38761123456","+38762123456","1111"] ### list of numbers that you're expecting drop call from
_____________________________________________

MissedCall.py
Quote:

#! /usr/bin/python

import gobject, dbus, time
from dbus.mainloop.glib import DBusGMainLoop

def handle_call(obj_path, callernumber):
global blocklist
for number in blocklist:
if number.replace("\n","") == callernumber:
print callernumber
time.sleep (3.0); ### if ringing last longer than 3sec., it's not drop call (you can make it longer if you want)
bus = dbus.SystemBus()
callobject = bus.get_object('com.nokia.csd.Call', '/com/nokia/csd/call/1') # Checking call status
smsiface = dbus.Interface(callobject, 'com.nokia.csd.Call.Instance')
smsiface.GetStatus()
if smsiface.GetStatus() == 0: # if call-status is IDLE (0), ringing is over...it was DROP CALL
bus = dbus.SystemBus()
callobject = bus.get_object('com.nokia.csd.Call', '/com/nokia/csd/call') # calling back
smsiface = dbus.Interface(callobject, 'com.nokia.csd.Call')
smsiface.CreateWith(str(callernumber), dbus.UInt32(0))
####
var = 0
while var == 0:
print "Waiting for ringing sound..."
bus = dbus.SystemBus()
callobject = bus.get_object('com.nokia.csd.Call', '/com/nokia/csd/call/1') # Checking call status
smsiface = dbus.Interface(callobject, 'com.nokia.csd.Call.Instance')
smsiface.GetStatus()
if (smsiface.GetStatus() == 4) or (smsiface.GetStatus() == 8) or (smsiface.GetStatus() == 10) or (smsiface.GetStatus() == 7) or (smsiface.GetStatus() == 11) or (smsiface.GetStatus() == 12) or (smsiface.GetStatus() == 15): # finish it if call is: ringing,answered(active),busy,answered,on hold,on hold,terminated
#time.sleep (0.5); # How long you want to let it ring
print "Done!"
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')
smsiface.Release()
break


blocklist = ["+38761123456","+38762123456","1111"] ### list of numbers that you're expecting drop call from

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()

qwazix 2013-03-27 23:06

Re: Script: auto-give a ring (missed call)
 
Haha, I can't stop thinking what will happen if both parties have this installed...

nokiabot 2013-03-28 03:28

Re: Script: auto-give a ring (missed call)
 
^^^lol m thinking tha same : gud job buddy

dzano 2013-03-28 07:33

Re: Script: auto-give a ring (missed call)
 
hahaha I must admit, I didn't think about that possibility :D

nokiabot 2013-03-28 08:36

Re: Script: auto-give a ring (missed call)
 
^^craZZy fella:D someone knowlegeble look in tha script n make possible changes like setting the seconds manually defining the rings manually acept all nos etc:)

dzano 2013-03-28 09:20

Re: Script: auto-give a ring (missed call)
 
I'm not sure if I have understood you correctly..you can set seconds manually:

time.sleep (3.0); ### if ringing last longer than 3sec., it's not drop call (you can make it longer if you want)

#time.sleep (0.5); # How long you want to let it ring when it's calling back

Is that it?

nokiabot 2013-03-28 10:38

Re: Script: auto-give a ring (missed call)
 
^^you got ma point:) thats it

vetsin 2013-03-28 12:32

Re: Script: auto-give a ring (missed call)
 
i can relate to your dilemma. haha
i had a program in my S60 phone that automatically sends messages based on schedule so that my then girlfriend (now wife) will always receive a good morning, good afternoon or some other greeting, depending on the day. i've already made my confession btw. hehe

dzano 2013-03-28 13:53

Re: Script: auto-give a ring (missed call)
 
It must be very useful app :D

vetsin 2013-03-28 13:58

Re: Script: auto-give a ring (missed call)
 
yes indeed! saved me from lots of explanations. and it keeps her sweet and happy. :D
i may have been cheating on the sweetness part but as they say, it's the thought that counts. :)

dzano 2013-04-05 17:39

Re: Script: auto-give a ring (missed call)
 
Quote:

Originally Posted by qwazix (Post 1332378)
Haha, I can't stop thinking what will happen if both parties have this installed...

Something like this :D

http://youtu.be/AasFK70sOkQ

md07 2013-05-14 05:06

Re: Script: auto-give a ring (missed call)
 
hi @dzano

Quote:

Originally Posted by dzano (Post 1334323)
Something like this :D

http://youtu.be/AasFK70sOkQ


i try run your script on my N9 terminal, but my phone doesnt do anything when i call someone (below 3s). Pls help me

zlatokosi 2013-05-14 05:15

Re: Script: auto-give a ring (missed call)
 
Quote:

Originally Posted by dzano (Post 1334323)
Something like this :D

http://youtu.be/AasFK70sOkQ

Hahaha, awesome!

Pozdrav u Bosnu!

dzano 2013-05-14 06:35

Re: Script: auto-give a ring (missed call)
 
Quote:

Originally Posted by md07 (Post 1343425)
hi @dzano

i try run your script on my N9 terminal, but my phone doesnt do anything when i call someone (below 3s). Pls help me

I would really like to help you but I don't have N9, and I'm not sure if DBUS commands are same.

Anyway, that script is idle until someone calls YOU (missed call) from number that you already listed in script:
(blocklist = ["+38761123456","+38762123456","1111"] ### list of numbers that you're expecting drop call from)

Quote:

Originally Posted by zlatokosi (Post 1343426)
Hahaha, awesome!

Pozdrav u Bosnu!

Veliki pozdrav i tebi drug!! haha

md07 2013-05-14 07:20

Re: Script: auto-give a ring (missed call)
 
Quote:

Originally Posted by dzano (Post 1343436)
I would really like to help you but I don't have N9, and I'm not sure if DBUS commands are same.

Anyway, that script is idle until someone calls YOU (missed call) from number that you already listed in script:
(blocklist = ["+38761123456","+38762123456","1111"] ### list of numbers that you're expecting drop call from)



Veliki pozdrav i tebi drug!! haha

ok. i edit your script with number i want drop. When that num call miss my phone. terminal say error. I copy my terminal :


~ # python /home/user/MyDocs/mc.py

0985319481

ERROR:dbus.connection:Exception in handler forD-Bus signal:

Traceback (most recent call last):

File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 214, in maybe_handle_message

self._handler(*args, **kwargs)

File "/home/user/MyDocs/mc.py", line 20, in handle_call

smsiface.CreateWith(str(callernumber), dbus.UInt32(0))

File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 68, in __call__

return self._proxy_method(*args, **keywords)

File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 140, in __call__

**keywords)

File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 630, in call_blocking

message, timeout)

DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.2835" (uid=0 pid=15107 comm="python /home/user/MyDocs/mc.py ") interface="com.nokia.csd.Call" member="CreateWith" error name="(unset)" requested_reply=0 destination=":1.17" (uid=30006 pid=663 comm="/usr/sbin/csd -z -p call autorej=0,autoans=0,ecall"))




i think you can fix my problem. i very noob in Python. Pls help me


All times are GMT. The time now is 08:01.

vBulletin® Version 3.8.8