Connecting a call to AWS Transcribe

Hello. I’ve been stuck on this problem for awhile now and would love some guidance.

I’m receiving RTP packets, stripping the header, and sending the payload to AWS for live stream transcription. Everything is coming back as nonsense though. I’m quite sure it’s an encoding issue because I’m able to save the payloads of those packets in the external media server that I’ve setup, then convert the file to .wav using sox, and then play it as expected with no loss or noise. Note that this is only when I tell Asterisk to format as ulaw. I know I need to set the format as slin for Asterisk, which I’ve done, however I’m still unable to get a correct transcription. Since AWS is expecting little endian I thought that might be it and I saw this topic so I tried byte swapping, however this still didn’t do it.

Can anyone help me out? I’m more than willing to share any code or information that can help you, help me.