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. :)


All times are GMT. The time now is 00:00.

vBulletin® Version 3.8.8