Hi all,
I have written the following code:
I want to automatically answer incoming calls and play sound to the other end. but I got an error :Code:#coding: utf-8 import telephone,audio,e32,appuifw app_lock = e32.Ao_lock() def quit(): app_lock.signal() appuifw.app.exit_key_handler = quit appuifw.app.title = u"电话测试" CALL_STATE = {telephone.EStatusUnknown: u"unknown", telephone.EStatusIdle: u"空闲", telephone.EStatusDialling: u"拨号中", telephone.EStatusRinging: u"响铃中", telephone.EStatusAnswering: u"应答中", telephone.EStatusConnecting: u"呼叫中", telephone.EStatusConnected: u"已经连线", telephone.EStatusReconnectPending: u"reconnect pending", telephone.EStatusDisconnecting: u"断线", telephone.EStatusHold: u"保持", telephone.EStatusTransferring: u"呼叫转移中", telephone.EStatusTransferAlerting: u"transfer alerting"}; sound = audio.Sound.open("E:\\Sounds\\Digital\\Plain.mp3") def play_sound(): sound.play() # I got error on this line #play_sound() def handle_call(tuple): status = tuple[0] print u"当前状态:"+CALL_STATE[status] if status == telephone.EStatusRinging: #play_sound() e32.ao_sleep(1) telephone.answer() print u"来电话啦!接啦!" e32.ao_sleep(1,play_sound) elif status == telephone.EStatusConnected: e32.ao_sleep(1) #telephone. #audio.say(u"Hello, Goodbye") #telephone.hang_up() #app_lock.signal() telephone.incoming_call() telephone.call_state(handle_call) app_lock.wait()
I then tried to open signed my sis file , but the error remains. So why ?[Error -21] Error Playing file : KErrAccessDenied.
I use N82, the s60 version is 31.1.016, and the mp3 file absolutely exists. I can play it using the following code:
Code:#coding: utf-8 import audio s = audio.Sound.open("E:\\Sounds\\Digital\\Plain.mp3") s.play()

Reply With Quote

