Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2008

    Incoming call: how to recognize the number in order to display more info ???

    Hi ! i'm new with pyhon.
    This is what i'd like to do with python on my N95 8gb:

    When the phone rings for an incoming call, i want to display a window in the top of the screen with some info regarding the caller.
    I have to create a small database like this:
    Last Visit:
    Next Visit:
    (o.t. : I'm a doctor and these contacts are patients)

    When the incoming call is from a number in the database, the window on the top of the screen should display tha name, the date of last and next visit. I do not want to add these contacts to my built-in contacts book.

    My main problem is how to recognize the number of an incoming call. I have read this thread but i cant understand well ..

    Thank you in advance for helping me !!


  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Deva, Romania

    Re: Incoming call: how to recognize the number in order to display more info ???

    Hello Matteo and welcome to PyS60.

    I have come up with a very basic solution to your question (based on the thread you provided):

    import appuifw, e32, telephone, logs
    from time import *
    def quit():app_lock.signal()
    n=logs.calls(mode='in')[0]  #The most recent incoming call
    n=n["number"]          #Its number
    listofnames=['George', 'Alan']  #The names of your patients
    #The database containing names, numbers and next visits (you have to add any extra details)
    database={'George':['0257813761','next appointment:tuesday'], 'Alan':['0711657212','next app:saturday']}
    def callstate(state):
    	global n
    	for i in listofnames:
    		if(n==database[i][0]):print database[i][1]
    #That means that if the current incoming call's number is in the
    #database the next appointment will be shown
    def callback_call(state):
    I haven't done extensive testing and you will clearly need to adapt it to your needs, but it shouldn't be too hard from here.
    Hope this helps

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2008
    Ahmedabad, Gujarat, India

    Re: Incoming call: how to recognize the number in order to display more info ???

    hi MatteoG
    welcome to the forum nokia the solution to ur question is the logs module recently released in python for S60 have a look at that.

  4. #4
    Registered User
    Join Date
    Apr 2008

    Re: Incoming call: how to recognize the number in order to display more info ???

    Thank you very much for your replies !
    But probably my request was not clear: my aim is to display informations about the patient WHILE the phone is ringing and not when the call is finished. I want to be able to see patient's information BEFORE i answer (i have many patients and often i cant remember what i sayed them during last visit).
    So i think logs module is not useful for this aim.

    I tryed with this code:

    import appuifw
    import e32
    import telephone
    listofnames=['Paz1', 'Paz2', 'Paz3']
    database={'Paz1':['+39010555555','next app: 11/05/2008'], 'Paz2':['+390185666666','next app: 12/05/2008'],'Paz3':['+3901857777777','next app: 13/05/2008']}
    def handleCall((callState, number)):
        if callState == telephone.EStatusRinging:
          if number <> "":
             print "call from "+ number             #print the number 
             for i in listofnames:
                         print database[i][1]       #print next appointment
                         print "patient:", i        #print patient name
    def quit():
    appuifw.app.exit_key_handler = quit
    appuifw.app.title = u"Patients PhoneBook"
    print "waiting for a call ..."
    .. and it works !!!

    but there is a problem: when the phone is ringing for an incoming call my python window disappears completely. So i can see the correct output of my script only when the call is finished.
    So i ask you: is it possible to have a little window with my python output during an incomil call (i.e. when the phone is ringing) ?? I'd like to have a little window in foreground in the top of the screen.

    Thank you again !!

    Last edited by MatteoG; 2008-04-07 at 14:36.

Similar Threads

  1. Replies: 0
    Last Post: 2007-12-31, 11:26
  2. gets the number of incoming call
    By kingkiko in forum Symbian
    Replies: 1
    Last Post: 2005-04-12, 03:53
  3. Call Info in an observer program???
    By marycore in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2004-12-19, 12:25
  4. Replies: 0
    Last Post: 2003-12-03, 03:34
  5. Replies: 0
    Last Post: 2002-10-20, 08:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts