pyVoIP icon indicating copy to clipboard operation
pyVoIP copied to clipboard

write_audio does not do anything

Open CommanderRedYT opened this issue 1 year ago • 6 comments

When trying the example code (and replacing the file name with my own), I just hear silence. I tried it with both a Gigaset telephone and the Linphone android app.

CommanderRedYT avatar Jun 14 '23 16:06 CommanderRedYT

I tried it with both latest pip package and directly via master, always the same result. I added logging and I saw that the transmit function inside the library is doing something however. Can someone help?

CommanderRedYT avatar Jun 15 '23 07:06 CommanderRedYT

This is working for me:

    def answer(self, call):
        script_dir = os.path.dirname(os.path.realpath(__file__))
        wav_file_path = os.path.join(script_dir, 'audio/output.wav')

        f = wave.open(wav_file_path, 'rb')

        call.answer()
        data = f.readframes(160)
        while data:
            call.write_audio(data)
            data = f.readframes(160)

        f.close()

Recording quality in the transmission is decent, but I hear small gaps while the record is being transmitted. If it works for you please let me know if you have that other same issue.

jorgesisco avatar Jul 12 '23 07:07 jorgesisco

Nope, I still hear nothing.

CommanderRedYT avatar Jul 12 '23 08:07 CommanderRedYT

Is there a chance that this lib is broken for linux?

CommanderRedYT avatar Jul 12 '23 08:07 CommanderRedYT

it could be related to audio format. I think the sip clients you use doesn't support PCMU 8bit audio format.

codemaven0321 avatar Mar 06 '24 18:03 codemaven0321

it could be related to audio format. I think the sip clients you use doesn't support PCMU 8bit audio format.

Do you know how I could fix that?

CommanderRedYT avatar Mar 07 '24 08:03 CommanderRedYT