I have since tried changing the sample_width, channels, frame_rate using ffmpeg from the command line with different options and other python libraries but i cant get it to work.
I am able to create a wav file and play it but the sound is… “muffled”? Sometimes i am able to hear the words i said in the call but theres lots of inference.
Does anyone have a simple snipped i could use for this?
Thanks in advance.
Edit:
exten => asterisk,1,Answer()
same = n,EAGI(/home/asterisk/handle_call.py)
same = n,Hangup()
Going that way, you would use a 256 entry table to look up the full, 16 bit equivalent, although I think there are less than 16 bits of actual resolution. Even going the other way, the memory cost is negligible. The G.711 specification is public, and there will be other sources of the actual coding.
After searching around a bit more i discovered that the stream i am receiving in my eagi application isnt mulaw but slin, i think asterisk converts it before passing it to the application.
Converting worked with ffmpeg -f sln … for example.
You can choose the format by setting the EAGI_AUDIO_FORMAT[1] dialplan variable on the channel. You are correct that if one is not specified it defaults to signed linear.