×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    3

    Question How to Play sound to other end while answering a call?

    Hi all,

    I have written the following code:

    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 want to automatically answer incoming calls and play sound to the other end. but I got an error :

    [Error -21] Error Playing file : KErrAccessDenied.
    I then tried to open signed my sis file , but the error remains. So why ?

    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()
    Last edited by happyzengbo; 2009-08-08 at 15:00.

Similar Threads

  1. detect the end of an outgoing call
    By impazzito in forum Symbian
    Replies: 11
    Last Post: 2009-11-15, 21:55
  2. Stop sound recording if another application wants to play sound
    By pedramz in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2009-07-14, 15:17
  3. Problem to call audio recorder example in view
    By FrankTheFox in forum Symbian
    Replies: 9
    Last Post: 2009-03-04, 14:18
  4. Play one sound after another
    By remoto in forum Symbian
    Replies: 7
    Last Post: 2008-08-30, 18:43
  5. 6600 - Call test during sound playback causes sound not to play any more
    By hdazza in forum General Development Questions
    Replies: 0
    Last Post: 2004-08-27, 15:59

Posting Permissions

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