You Are Here:

Community: Developer Discussion Boards

#1 Old detect the end of an outgoing call - 2009-03-13, 15:56

Join Date: Apr 2008
Posts: 24
impazzito
Offline
Registered User
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
Reply With Quote

#2 Old Re: detect the end of an outgoing call - 2009-03-14, 05:37

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
Quote:
Originally Posted by impazzito View Post
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
hello impazzito

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
Reply With Quote

#3 Old Re: detect the end of an outgoing call - 2009-03-14, 15:58

Join Date: Apr 2008
Posts: 24
impazzito
Offline
Registered User
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.
Reply With Quote

#4 Old Question Re: detect the end of an outgoing call - 2009-11-04, 14:08

Join Date: Oct 2009
Posts: 34
cuijartija's Avatar
cuijartija
Offline
Registered User
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()
All works well, when i make a call this show: Dialing, ant then Disconnecting. When i receive a call this show Ringing, Disconnecting.

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()
All seems ok, i don't have errors but it don't works, is weird but when i intruduce the callControl variable the code stops working.

Any idea? Any other way to do it?

Thanks in advance


Le Cuije
Reply With Quote

#5 Old Re: detect the end of an outgoing call - 2009-11-06, 18:48

Join Date: Nov 2007
Posts: 119
raf1hh
Online
Regular Contributor
Which version of python are you using?


http://www.bdcsoftware.com/development-blog
Reply With Quote

#6 Old Re: detect the end of an outgoing call - 2009-11-06, 22:09

Join Date: Oct 2009
Posts: 34
cuijartija's Avatar
cuijartija
Offline
Registered User
Python version 1.4.5

I returned this by envy


Le Cuije
Reply With Quote

#7 Old Re: detect the end of an outgoing call - 2009-11-06, 22:35

Join Date: Nov 2007
Posts: 119
raf1hh
Online
Regular Contributor
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
Reply With Quote

#8 Old Re: detect the end of an outgoing call - 2009-11-08, 17:12

Join Date: Apr 2008
Posts: 24
impazzito
Offline
Registered User
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:
Originally Posted by cuijartija View Post
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()
All works well, when i make a call this show: Dialing, ant then Disconnecting. When i receive a call this show Ringing, Disconnecting.

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()
All seems ok, i don't have errors but it don't works, is weird but when i intruduce the callControl variable the code stops working.

Any idea? Any other way to do it?

Thanks in advance
Reply With Quote

#9 Old Re: detect the end of an outgoing call - 2009-11-08, 19:10

Join Date: Nov 2007
Posts: 119
raf1hh
Online
Regular Contributor
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
Reply With Quote

#10 Old Re: detect the end of an outgoing call - 2009-11-08, 19:33

Join Date: Apr 2008
Posts: 24
impazzito
Offline
Registered User
try to use my code into your "bigger app".
I have inserted it into a my "bigger app" and it works!

Martino

Quote:
Originally Posted by raf1hh View Post
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
Reply With Quote

#11 Old [solved] Re: detect the end of an outgoing call - 2009-11-15, 22:23

Join Date: Oct 2009
Posts: 34
cuijartija's Avatar
cuijartija
Offline
Registered User
Hi community, the impazzito's code works well.

Thanks !!


Le Cuije
Reply With Quote

#12 Old Re: [solved] Re: detect the end of an outgoing call - 2009-11-15, 22:55

Join Date: Apr 2008
Posts: 24
impazzito
Offline
Registered User
Quote:
Originally Posted by cuijartija View Post
Hi community, the impazzito's code works well.

Thanks !!

Thanks!!!
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
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

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia