You Are Here:

Community: Developer Discussion Boards

Reply « Previous Thread | Next Thread »

#1 Old Bind an incoming call - 2007-11-19, 12:34

Join Date: Nov 2007
Posts: 4
renzogiust
Offline
Registered User
Hello,
i would bind an incoming call, executing a particular function when a call is coming (before the user answers).

Is it possible? I found the way to bind keys events, but not this kind of event.

Thanks,
Renzo
Reply With Quote

#2 Old Re: Bind an incoming call - 2007-11-19, 15:00

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
Quote:
Originally Posted by renzogiust View Post
Hello,
i would bind an incoming call, executing a particular function when a call is coming (before the user answers).

Is it possible? I found the way to bind keys events, but not this kind of event.

Thanks,
Renzo
Welcome to you Renzo to the PyS60 dibo

Have you a 3rd or 2nd phone ?
In 3rd Nokia has provided since PyS60 1.4.1 new feature for handling this case.

Something like that should work (I haven't test it !)
Code:
import appuifw
import e32
import telephone


appuifw.app.title = u'Incoming call Test'

def handle_call(state,incoming_call_number):
   pass

def cb_calling(state,incoming_call_number):
   if (state==telephone.EStatusRinging) and incoming_call_number==u"+1111111113":
      handle_call(state,incoming_call_number)


def quit():
    app_lock.signal()

appuifw.app.exit_key_handler= quit
app_lock=e32.Ao_lock()

telephone.call_state(cb_calling)
telephone.incoming_call()

app_lock.wait()
For 2nd edition it should be more difficult because there's no official function available for this.
Try this : download SMSCoop in it there's a phone_ext.pyd extension. Install it in your phone.
This extension provide similar functionalities.

I hope that this answer could help you

links
SMSCoop

Cyke64


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Last edited by cyke64 : 2007-11-19 at 15:32. Reason: typos sorry !
Reply With Quote

#3 Old Re: Bind an incoming call - 2007-11-19, 15:18

Join Date: Nov 2007
Posts: 4
renzogiust
Offline
Registered User
Thanks a lot Cyke64!

I've a Nokia E65, so it should be a 3rd phone.

Your example is very clear and useful: fantastic!

I'll try it as soon as possible.

Thank you again,
Renzo
Reply With Quote

#4 Old Re: Bind an incoming call - 2007-11-19, 15:34

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
@renzo : I have tried my code but it doesn't work
Perhaps another bug in PyS60 ?
Until now I have seen no example of incoming call nor in official documentation nor in DiBo

Is someone can try or fix this example ?

Thanks

Cyke64


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote

#5 Old Re: Bind an incoming call - 2007-11-21, 00:15

Join Date: Nov 2007
Posts: 4
renzogiust
Offline
Registered User
Quote:
Originally Posted by cyke64 View Post
@renzo : I have tried my code but it doesn't work
Perhaps another bug in PyS60 ?
Until now I have seen no example of incoming call nor in official documentation nor in DiBo

Is someone can try or fix this example ?
Hi Cyke64,
this works:

Code:
import appuifw
import e32
import telephone


appuifw.app.title = u'Incoming call Test'

def handle_call(state):
   appuifw.note(u"Chiamato", "info")
   
def cb_calling(state):
    appuifw.note(unicode('0:' + str(state[0]) + ';1:' + str(state[1])), "info")
    if (state[0]==telephone.EStatusRinging):
        handle_call(state)


def quit():
    app_lock.signal()

appuifw.app.exit_key_handler= quit
app_lock=e32.Ao_lock()

telephone.call_state(cb_calling)
#telephone.incoming_call()

app_lock.wait()
Bye and thanks again,
Renzo
Reply With Quote

#6 Old Re: Bind an incoming call - 2007-11-21, 10:01

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
Quote:
Originally Posted by renzogiust View Post
Hi Cyke64,
this works:

Code:
import appuifw
import e32
import telephone


appuifw.app.title = u'Incoming call Test'

def handle_call(state):
   appuifw.note(u"Chiamato", "info")
   
def cb_calling(state):
    appuifw.note(unicode('0:' + str(state[0]) + ';1:' + str(state[1])), "info")
    if (state[0]==telephone.EStatusRinging):
        handle_call(state)


def quit():
    app_lock.signal()

appuifw.app.exit_key_handler= quit
app_lock=e32.Ao_lock()

telephone.call_state(cb_calling)
#telephone.incoming_call()

app_lock.wait()
Bye and thanks again,
Renzo
Hello Renzo ,

I wrote the code and you have discovered how to use argument in the callback
Now it works on N93 !

Thanks to you

This example is great use for everybody to understand new feature s in the telephone module

BR

Cyke64


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote

#7 Old Re: Bind an incoming call - 2007-11-22, 13:45

Join Date: Nov 2007
Posts: 4
renzogiust
Offline
Registered User
Quote:
Originally Posted by cyke64 View Post
Hello Renzo ,

I wrote the code and you have discovered how to use argument in the callback
Now it works on N93 !

Thanks to you

This example is great use for everybody to understand new feature s in the telephone module

BR

Cyke64
Fantastic

Now i'm going to continue testing pyS60 features..!

Bye,
Renzo
Reply With Quote

#8 Old Re: Bind an incoming call - 2008-01-09, 18:55

Join Date: Nov 2007
Posts: 2
deepsight
Offline
Registered User
whenever i use the telephone module and try to play a sound i get:

Traceback (most recent call last):
File "<console>", line 1, in ?
File "c:\resource\audio.py", line 83, in play
raise SymbianError,(callback_error[0],
SymbianError: [Errno -21] Error playing file: KErrAccessDenied


any ideas of what and why is getting blocked?
thanks
Reply With Quote

#9 Old Re: Bind an incoming call - 2008-01-10, 05:10

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Hi deepsight and welcome to the Fantastic Python DiBo !

Would you mind sharing your code so that we can make out your error and respond!

Best Regards
Croozeus
Reply With Quote

#10 Old Re: Bind an incoming call - 2008-01-11, 12:56

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
any sample cource for 2nd edition?
Reply With Quote

#11 Old Re: Bind an incoming call - 2008-01-14, 19:24

Join Date: Jan 2007
Posts: 80
federico2929
Offline
Regular Contributor
What about for outgoing calls? is it possible to know the number I am dialing? I know when I am making a call, but not the number I am dialing

any ideas? code example? or a definite no, it can't be done with the current code
Reply With Quote

#12 Old Re: Bind an incoming call - 2008-01-17, 22:18

Join Date: Jan 2007
Posts: 80
federico2929
Offline
Regular Contributor
What about for outgoing calls? is it possible to know the number I am dialing? I know when I am making a call, but not the number I am dialing

any ideas? code example? or a definite no, it can't be done with the current code

This is my example code for blocking all codes:


import telephone

def cb_calling(state):
if (state[0]==telephone.EStatusRinging):
handle_call(state)
else:
print "Not ringing yet"
print state


def handle_call(state):
telephone.incoming_call()
telephone.answer()
print state

telephone.call_state(cb_calling)
Reply With Quote

#13 Old Re: Bind an incoming call - 2008-04-19, 12:38

Join Date: Mar 2008
Posts: 1
chilimix
Offline
Registered User
Hi,

I,m new in this forum and haven't done that much of python coding. I have a Nokia N95 8GB, and with this code sample below, I only get "incoming call" or "outgoing call". It should work but i does not on my phone.
Anyone with a N95 8GB experiencing same problem?

Thanks in advance.

Code:
import appuifw
import e32
import telephone

def handleCall((callState, number)):
	if callState == telephone.EStatusRinging:
		if number == "":
			print "incoming call"
		else:
			print "call from " + number
	elif callState == telephone.EStatusDialling:
		if number == "":
			print "outgoing call"
		else:
			print "call to " + number

def quit():
	app_lock.signal()

appuifw.app.exit_key_handler = quit

app_lock=e32.Ao_lock()

old_title = appuifw.app.title
appuifw.app.title = u"Call Manager"

telephone.call_state(handleCall)

app_lock.wait()
Reply With Quote

#14 Old Re: Bind an incoming call - 2008-04-22, 14:28

Join Date: Jan 2008
Posts: 10
jambel
Offline
Registered User
Hello, I'm not sure if I have to open a new post, if so then excuse me and tranfer it.

So I have this code

Code:
import appuifw
import e32
import logs
import audio
import telephone

filename = u'e:\\record.wav'

def handleCall((callState, number)):
	if callState == telephone.EStatusRinging:
		if number == "xxxxxxxxx": # where xxx my number
			global S
			S=audio.Sound.open(filename)
			S.record()
			print u'Recording...'

def closing():
	try:
		global S
		S.stop()
		S.close()
		print u'Stopped.'
	except:
		print u'Nothing to stop.'

def quit():
	script_lock.signal()
	# appuifw.app.set_exit()

appuifw.app.exit_key_handler = quit
appuifw.app.menu = [(u"Stop", closing)]
appuifw.app.title = u'Recorder'
telephone.call_state(handleCall)
script_lock = e32.Ao_lock()
script_lock.wait()
and it works like sugar, but when I try to quit python interface python crashes and get stuck.

I'm new in python so be gentle

Any ideas?

Thanks!
Reply With Quote

#15 Old Re: Bind an incoming call - 2008-04-22, 15:22

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
Quote:
Originally Posted by jambel View Post
Hello, I'm not sure if I have to open a new post, if so then excuse me and tranfer it.

So I have this code


and it works like sugar, but when I try to quit python interface python crashes and get stuck.

I'm new in python so be gentle

Any ideas?

Thanks!
Does this code record a voice call?!? It looks like it start recording "something" as soon ass phone starts RINGING (rather than activating a call).

Should it work on 2nd edition?
I'll give a try...
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
how to simulate incoming call by Emulator?? test pragram listening call! wjcrr General Symbian C++ 2 2007-05-12 00:11
Active Objects & Incoming Call Problem jguzman General Symbian C++ 5 2007-03-21 23:01
Bring App to foreground on incoming call ag24master General Symbian C++ 3 2006-06-30 14:00
Error while accepting an incoming call yogesh14 Symbian Networking & Messaging 1 2006-03-23 04:55
Series 40 Sound and Incoming Call Confliction jl1337 Mobile Java Media (Graphics & Sounds) 0 2005-11-09 06:17

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