How to answer incoming call? telephone.answer not working
I'm using 1.4.1 final on an E50.
I'd like to use telephone.incoming_call() and telephone.answer() to answer an incoming call. The documentation says:
[quote]
incoming call()
Wait for incoming call, returns immediately. If a call arrives, answer can be called to answer the call. Without the invocation of function incoming call, the function answer has no effect.
answer()
Answers an incoming call - see also incoming call.
[/quote]
My app looks like this
[code]
import appuifw
import e32
import telephone
STATES = {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 handleCall((callState, number)):
print "callState = "+STATES[callState]
if callState == telephone.EStatusRinging:
if number == "":
print "incoming call"
else:
print "call from "+number
telephone.answer()
elif callState == telephone.EStatusAnswering:
print "hanging up"
telephone.hang_up()
elif callState == telephone.EStatusDisconnecting:
print "hung up"
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"Incoming"
telephone.incoming_call()
telephone.call_state(handleCall)
print "waiting for a call"
app_lock.wait()
appuifw.app.title = old_title
[/code]
When a call comes in I see this in the console:
[quote]
waiting for a call
callState = ringing
incoming call
[/quote]
[i](caller hangs up after 3 rings - the app did not answer the call)[/i]
[quote]
callState = disconnecting
hung up
callState = idle
[/quote]
The call to telephone.answer() seems to have no effect. I have also tried calling it in other spots: before and after the call to telephone.call_state() and in the ringing case in handleCall. Has anyone else gotten telephone.answer() (or incoming_call()) to work?
Thanks.
Re: How to answer incoming call? telephone.answer not working
Hi - no idea if this still requires an answer :-)
but I just added some sleeps around the answer and it seems to work fine - maybe was trying to answer too quick ?
[code]
else: print "call from "+number
e32.ao_sleep(1)
telephone.answer()
e32.ao_sleep(10)
[/code]
Re: How to answer incoming call? telephone.answer not working
There's another discussion about these new features in telephone module [URL="http://discussion.forum.nokia.com/forum/showthread.php?t=120891"]HERE[/URL]
Cyke64
Re: How to answer incoming call? telephone.answer not working
Thanks to you both for your replies. The calls to e32.ao_sleep(1) fixed the problem - thanks, ceejay.
The new problem is that after my program answers the incoming call, it hangs: no keys have any effect. I have to remove the battery to exit the program (and all programs :-)).
Re: How to answer incoming call? telephone.answer not working
[QUOTE=jellinek;369754]The calls to e32.ao_sleep(1) fixed the problem - thanks, ceejay.
The new problem is that after my program answers the incoming call, it hangs: no keys have any effect. I have to remove the battery to exit the program (and all programs :-)).[/QUOTE]
There shouldn't be a need to add any sleeps to call answering, you might want to send a bug report on this to SourceForge (if there is a need for the sleeps, this should be at least documented to the API - thanks to ceejay for finding this out).
The latter problem is worth while checking also, please include firmware information should you file a bug report on this. Unfortunately that is most probably something that we can't fix - rather the fix needs to be in firmware.
Thanks in advance.
Re: How to answer incoming call? telephone.answer not working
The calls to e32.ao_sleep(1) fixed the problem - thanks,
But the as soon as the Python code answer the incoming call.
The script quite.
Is there a way for the Python script to stay at background?
Mike,
[url]www.gta-wireless.com[/url]
Re: How to answer incoming call? telephone.answer not working
[QUOTE=mikewen;392785]The calls to e32.ao_sleep(1) fixed the problem - thanks,
But the as soon as the Python code answer the incoming call.
The script quite.
Is there a way for the Python script to stay at background?
Mike,
[url]www.gta-wireless.com[/url][/QUOTE]
Yes mike, you can try the [URL="http://discussion.forum.nokia.com/forum/showthread.php?t=96736&highlight=appswitch"]appswitch module.[/URL]
BG
Rafael
Re: How to answer incoming call? telephone.answer not working
Hi
I'm using the original code in this thread plus the sugested e32.ao_sleep() calls but as soon as a call is received the phone reboots.
I'm using Nokia 6120classic 3rd edition, FP1
Since the original thread is very old, I'm suspecting some incompatibility.
Any ideas, anyone?
Re: How to answer incoming call? telephone.answer not working
Hi carlosl,
although this thread is very old but the script given here is perfectly working. I had tried it on n95. Even telephone.Answer is working fine without any issue.