tayler6000 / pyVoIP

Pure python VoIP/SIP/RTP library. Currently supports PCMA, PCMU, and telephone-event
https://pypi.org/project/pyVoIP/
GNU General Public License v3.0
219 stars 93 forks source link

write_audio does not do anything #149

Open CommanderRedYT opened 1 year ago

CommanderRedYT commented 1 year ago

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 commented 1 year ago

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?

jorgesisco commented 1 year ago

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.

CommanderRedYT commented 1 year ago

Nope, I still hear nothing.

CommanderRedYT commented 1 year ago

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

codemaven0321 commented 6 months ago

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

CommanderRedYT commented 6 months ago

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?