| Reply | « Previous Thread | Next Thread » |
|
Is there a way to detect the end of an outgoing call an then do some script?
I wanna create an application in python that detects the end of an outgoing call an then display "the call is ending" like this - open python app - python app in background - do a call - end the call - display "the call is ending" - python app in background thanks |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Offline
Forum Nokia Champion
|
|
|
Quote:
i guess if i got you properly then have a look at this article at the wiki. You have just to made some modifications and use the appswitch module for getting your application in background. Enjoy Pythoning Gaba88 Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
i have found this code
Code:
import appuifw, telephone, e32
CALL_STATE = {telephone.EStatusUnknown: "unknown",
telephone.EStatusIdle: "idle",
telephone.EStatusDialling: "dialing",
telephone.EStatusRinging: "ringing",
telephone.EStatusAnswering: "answering",
telephone.EStatusConnecting: "connecting",
telephone.EStatusConnected: "connected",
telephone.EStatusReconnectPending: "reconnect pending",
telephone.EStatusDisconnecting: "disconnecting",
telephone.EStatusHold: "hold",
telephone.EStatusTransferring: "transferring",
telephone.EStatusTransferAlerting: "transfer alerting"};
def handle_call(callstate):
print "Current call state: "+CALL_STATE[callstate]
if callstate == telephone.EStatusRinging:
# Do something ...
elif callstate == telephone.EStatusAnswering:
# Do something ...
elif callstate == telephone.EStatusDisconnecting:
# Do something ...
# this is aplied to all states ...
def quit():
app_lock.signal()
appuifw.app.exit_key_handler = quit
appuifw.app.title = u"Call States"
telephone.incoming_call() # waits for an incoming call
telephone.call_state(handle_call) # connects to handle_call for status handling
app_lock=e32.Ao_lock()
app_lock.wait()
but don't work.. may you help me??
Last edited by impazzito : 2009-03-14 at 16:10.
|
|
gaba88:
I tested this code: Code:
import telephone, e32 def callEvent((callState, number)): if callState == telephone.EStatusDialling: print "Dialing" if callState == telephone.EStatusRinging: print "Ringing" if callState == telephone.EStatusDisconnecting: print "Disconnecting" telephone.call_state(callEvent) lock = e32.Ao_lock() lock.wait() If i need know when a call is end i use the state telephone.EStatusDisconnecting, but i need know when a calling is ending by Ringing or Dialing so i modified the code like this: Code:
import telephone, e32 callControl = 0 def callEvent((callState, number)): if callState == telephone.EStatusDialling: callControl = 1 if callState == telephone.EStatusRinging: callControl = 2 if callState == telephone.EStatusDisconnecting: if callControl == 1: print "End by Dialing" if callControl == 2: print "End by Ringing" callControl = 0 telephone.call_state(callEvent) lock = e32.Ao_lock() lock.wait() Any idea? Any other way to do it? Thanks in advance Le Cuije |
| cuijartija |
| View Public Profile |
| Find all posts by cuijartija |
|
Which version of python are you using?
http://www.bdcsoftware.com/development-blog |
|
Python version 1.4.5
I returned this by envy ![]() Le Cuije |
| cuijartija |
| View Public Profile |
| Find all posts by cuijartija |
|
I have the same issue when using 1.9.7. The callback will not be called by the telephone module if there is any meaningful code in the callback (kind of like you setting that variable). It works fine if you just have print statements to output the status but will net get called if the same code is part of a bigger application. It has to be some sort of thread or global memory issue I bet...
http://www.bdcsoftware.com/development-blog |
|
I have found this solution after a night of intensiv study!
![]() Code:
import telephone, e32 def call(state): global c if (state[0]==1): if c==3: print "incoming call end" c=0 else: print "outcoming call end" c=0 if (state[0]==2): print "dialing" c=2 if (state[0]==3): c=3 if (state[0]==4): c=4 if (state[0]==5): c=5 telephone.call_state(call) telephone.call_state(call) Quote:
|
|
I had written essentially the same code that you have here right now and it worked in all my tests script as designed but as soon as I embedded the functionality into a bigger app the, code, without any modifications stopped working (the callback would not get called by the telephone module).
Please post updates as you progress with the design of your application. Thanks Raf http://www.bdcsoftware.com/development-blog |
|
try to use my code into your "bigger app".
I have inserted it into a my "bigger app" and it works! Martino Quote:
|
|
Hi community, the impazzito's code works well.
Thanks !! Le Cuije |
| cuijartija |
| View Public Profile |
| Find all posts by cuijartija |
|
Thanks!!! ![]() |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Problem to call audio recorder example in view | FrankTheFox | General Symbian C++ | 9 | 2009-03-04 15:18 |
| outgoing call | matelo | Mobile Java General | 5 | 2007-02-25 20:29 |
| How to detect outgoing call is terminated by the other party? | sibaschian | General Symbian C++ | 0 | 2006-09-15 17:38 |
| Problem: 10 Bluetooth Ports simultaneously | Alco Fresh | Python | 1 | 2006-07-03 13:05 |
| Can not trap Outgoing call disconnection | jugnoyasir | General Symbian C++ | 1 | 2005-08-13 11:50 |