Reply
Thread Tools
Posts: 226 | Thanked: 270 times | Joined on Apr 2012 @ Bosnia and Herzegovina
#1
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

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
#! /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()
Attached Files
File Type: zip MissedCall.zip (945 Bytes, 347 views)

Last edited by dzano; 2013-05-06 at 12:03.
 

The Following 11 Users Say Thank You to dzano For This Useful Post:
qwazix's Avatar
Moderator | Posts: 2,622 | Thanked: 5,447 times | Joined on Jan 2010
#2
Haha, I can't stop thinking what will happen if both parties have this installed...
__________________
Proud coding competition 2012 winner: ρcam
My other apps: speedcrunch N9 N900 Jolla –– contactlaunch –– timenow

Nemo UX blog: Grog
My website: qwazix.com
My job: oob
 

The Following 5 Users Say Thank You to qwazix For This Useful Post:
nokiabot's Avatar
Posts: 1,974 | Thanked: 1,834 times | Joined on Mar 2013 @ india
#3
^^^lol m thinking tha same : gud job buddy
 

The Following 3 Users Say Thank You to nokiabot For This Useful Post:
Posts: 226 | Thanked: 270 times | Joined on Apr 2012 @ Bosnia and Herzegovina
#4
hahaha I must admit, I didn't think about that possibility
 

The Following 2 Users Say Thank You to dzano For This Useful Post:
nokiabot's Avatar
Posts: 1,974 | Thanked: 1,834 times | Joined on Mar 2013 @ india
#5
^^craZZy fella someone knowlegeble look in tha script n make possible changes like setting the seconds manually defining the rings manually acept all nos etc
 

The Following 2 Users Say Thank You to nokiabot For This Useful Post:
Posts: 226 | Thanked: 270 times | Joined on Apr 2012 @ Bosnia and Herzegovina
#6
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?
 

The Following 3 Users Say Thank You to dzano For This Useful Post:
nokiabot's Avatar
Posts: 1,974 | Thanked: 1,834 times | Joined on Mar 2013 @ india
#7
^^you got ma point thats it
 

The Following 2 Users Say Thank You to nokiabot For This Useful Post:
Posts: 535 | Thanked: 598 times | Joined on Apr 2011 @ Republic of the Philippines
#8
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
 

The Following 2 Users Say Thank You to vetsin For This Useful Post:
Posts: 226 | Thanked: 270 times | Joined on Apr 2012 @ Bosnia and Herzegovina
#9
 

The Following 2 Users Say Thank You to dzano For This Useful Post:
Posts: 535 | Thanked: 598 times | Joined on Apr 2011 @ Republic of the Philippines
#10
yes indeed! saved me from lots of explanations. and it keeps her sweet and happy.
i may have been cheating on the sweetness part but as they say, it's the thought that counts.
 

The Following 2 Users Say Thank You to vetsin For This Useful Post:
Reply

Tags
missed call, python dbus


 
Forum Jump


All times are GMT. The time now is 21:36.