Re: PJSIP call, play music and hangup in python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



      This is the logic of the goal I am trying to achieve. It should call, when confirmed, should play an audio wav file and hangup after that
      I am able to call, but when the call is lift, I cannot hear the audio. 
        if self.call.info().state == pjsua.CallState.DISCONNECTED:
            current_call = None
            print 'Current call is', current_call
            in_call = False
        elif self.call.info().state == pjsua.CallState.CONFIRMED:
            #Call is Answred
            print "Call Answred"
            wfile = wave.open("message.wav")
            time = (1.0 * wfile.getnframes ()) / wfile.getframerate ()
            print str(time) + "ms"
            wfile.close()
            call_slot = self.call.info().conf_slot
            self.wav_player_id=pjsua.Lib.instance().create_player('message.wav',loop=False)
            self.wav_slot=pjsua.Lib.instance().player_get_slot(self.wav_player_id)
            pjsua.Lib.instance().conf_connect(self.wav_slot, call_slot)
            sleep(time)
            pjsua.Lib.instance().player_destroy(self.wav_player_id)
            self.call.hangup()
            in_call = False

This is some part of the log when I run the program

17:03:26.375 pjsua_aud.c .....Creating file player: test.wav..
17:03:26.375 wav_player.c ......File player 'test.wav' created: samp.rate=16000, ch=1, bufsize=4KB, filesize=166KB
17:03:26.375 pjsua_aud.c ......Player created, id=0, slot=2
17:03:26.375 pjsua_aud.c .....Conf connect: 2 --> 1
17:03:26.375 pjsua_aud.c ......Set sound device: capture=-99, playback=-99
17:03:26.376 pjsua_aud.c .......No changes in capture and playback devices
17:03:26.376 conference.c ......Port 2 (test.wav) transmitting to port 1 (sip:***********@*****.*****.com)
17:03:28.141 pjsua_aud.c .....Destroying player 0..
17:03:28.141 pjsua_call.c .....Call 0 hanging up: code=603..
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux