Agi.stream_file not working

Hello All,

I just started going over ago python methods.

I have two questions.

Questions 1: I’m trying to play a file I have using ago.stream_file()
I see the logs and find no exceptions

AGI Rx << STREAM FILE /var/lib/asterisk/sounds/custom/elevenlabsSounds/1706124901 “” 0

<SIP/6070-00000066> Playing ‘/var/lib/asterisk/sounds/custom/elevenlabsSounds/1706124901.slin’ (escape_digits=) (sample_offset 0) (language ‘en’)

<SIP/6070-00000066>AGI Script stt/R2chat.py completed, returning 0

I see command to stream file and next line indicates it’s playing the file but I don’t hear any output.

The file is of type .wav 8K,16Bit,mono channel

I’m able to play(hear output) the same file using print(‘EXEC Playback $filepath’) so I know the file is okay and no restrictions in playing this back.

Question 2: Is it possible for me play audio chunks (of mp3 type) using any agi/other lib method in python. Or is it always played from a file of wav format

Thanks In Advance,
Beginner

If you want to do any kind of scripted audio conversion/extraction, you can do it with FFmpeg. I have an example script, ami+agi_audio_player_async, in this repo.

Thanks you so much @ldo I’ll try this and update back here

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.