Unable to open file for playback: Invalid argument [status=120022]

704 Views Asked by At

I am using pjsua python wrapper to make a sip call and play wav file. Below is the code which tries to play the file:

# Notification when call's media state has changed.
    def on_media_state(self):
        global lib
        if self.call.info().media_state == pj.MediaState.ACTIVE:
            # Connect the call to sound device
            call_slot = self.call.info().conf_slot
            lib.conf_connect(call_slot, 0)
            lib.conf_connect(0, call_slot)
            print "Media is now active"

            # stream wav file
        # calculate wav time
        wfile = wave.open("test.wav")
        time = (1.0 * wfile.getnframes ()) / wfile.getframerate ()
        print str(time) + "ms"
        wfile.close()

        # stream wav file
        player_id = pj.Lib.instance().create_player("test.wav", loop=False)
        print "Wav player id is: ", player_id
        lib.conf_connect(lib.player_get_slot(player_id), call.info().conf_slot)

        sleep(time)
        lib.conf_disconnect(lib.player_get_slot(player_id), call.info().conf_slot)
        lib.player_destroy(player_id)

        else:
            print "Media is inactive"

What I see in the log is below:

Media is now active
23.3436281179ms
08:08:55.455    pjsua_aud.c  .....Creating file player: voice_tag_for_wolfgang.wav..
08:08:55.456    pjsua_aud.c  ......Unable to open file for playback: Invalid argument [status=120022]

Does anyone has any clue why it is not able to open the file?

1

There are 1 best solutions below

0
On

Apparently it was due to wrong MediaConfig params.