×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    8

    Question How to quit my code after a telephone call

    I am developing a simple telephone call code in Python.
    I used a telephone.dial() function in telephone module.

    However, I can't quit after a phone call or return to my code.
    When I wrote a quit function after a phone call as below, then the code was immediately quitted without a call.
    Also, when I used a return code to my code, the code was not running in the foreground while the code was running in the background.
    How to quit my code after making a phone call or return to my code?

    ---------------------------------------------------------------------
    def quit() :
    app_lock.signal()

    def tel(event) :
    try :
    telephone.hang_up()
    except :
    pass
    number=u"12345678"
    telephone.dial(ss)
    quit() or return_to_mycode()
    -----------------------------------------------------------------------

    In order to solve quit problem, I used a timer function. I could succeed a phone call.
    But, I still failed to return to my code.
    It only run in the background after a phone call and automatically quitted after 1 minute.

    def tel(event) :
    try :
    telephone.hang_up()
    except :
    pass
    number=u"12345678"
    telephone.dial(ss)
    e32.Ao_timer.after(60,quit) or e32.Ao_timer.after(60,return_to_mycode)
    -----------------------------------------------------------------------

    My apology for my bad English.
    Thanks a lot.

  2. #2
    Registered User
    Join Date
    Apr 2010
    Posts
    13

    Re: How to quit my code after a telephone call

    Hi,
    First, use [-code]Your code here[/-code] (remember to delete the '-' there) to wrap your code, that way we can see the code blocks and detect the problem(s) easier
    Second, I guess you want to find a way to hang up the ongoing phone call and do some functions after that, right? If you use the quit() function, it will just automatically quit the application, not only the phone call
    Code:
    import telephone
    import e32
    
    def handle_call(status):
        if status[0] == telephone.EStatusConnected: #check the status of the call, here is 'connected'
            e32.ao_sleep(100, lambda:telephone.hang_up) #hang up after 100s
            #if you want to run another function after a specific time, call it after the lambda
    
    number = u'0123456789'
    telephone.dial(number)
    telephone.call_state(handle_call)
    #some functions after that
    Hope it helps
    BR

  3. #3
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: How to quit my code after a telephone call

    To make a call the below code is useful :

    Code:
    mport telephone, appuifw, e32
    
    #Ask the user for the number to call
    n=appuifw.query(u"Enter number", "number")
    telephone.dial(str(n))
    
    #Wait a while
    e32.ao_sleep(5)
    
    #Now hang up
    telephone.hang_up()
    AND TO EXIT FROM THE APPLICATION :

    Code:
    appuifw.app.set_exit()
    Cheers,
    RaHuL

  4. #4
    Registered User
    Join Date
    Feb 2010
    Posts
    8

    Re: How to quit my code after a telephone call

    Thanks a lot, I will revise my code as your comments.
    Let you know whether it works as I want.

Similar Threads

  1. Method to lauch web browser, telephone call, GPS, video call etc
    By rayabhik in forum Symbian User Interface
    Replies: 4
    Last Post: 2009-06-26, 10:34
  2. Why does my code quit pys60?
    By Chrispinius in forum Symbian
    Replies: 7
    Last Post: 2008-11-27, 16:50
  3. Want to know about Telephone call
    By s_mehdi76 in forum Symbian
    Replies: 5
    Last Post: 2008-04-28, 11:21
  4. Recording telephone call
    By DJ Fadereu in forum Symbian
    Replies: 8
    Last Post: 2007-08-01, 06:47
  5. Telephone call data
    By TheCyclops in forum Symbian
    Replies: 0
    Last Post: 2003-08-01, 12:30

Posting Permissions

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