I have an Asterisk server on one Rasp and on another I would like to make a SIP client. To do this, I installed PJSIP, and I found this little code from their tutorial to make a phone call. I connected a Bluetooth headset to the Raspberry using pulseaudio, A2DP, bluez, HSP, etc.
I can make calls to and from a soft Zoiper (on a mac or android), so the server is perfect (tested with other phones and pc), but I can't hear anything on both sides. In fact, I can listen to the sounds in my headphones from my python script (ex: with pydub) or with VLC without any problem. I also managed to speak with my headset through a mumbled client.
But now I don't understand why I can't have a conversation with this SIP client. I think the problem is around line 80 when audio streams need to be connected to the hardware.
Any ideas? Feel free to ask me for more details, it could lead me down a path.