I’m currently working on a school project where I need to pass the audio stream from an asterisk call to an external script for analysis and kinda automate the call based on what is said during the call.
I made some researches and found that the audio stream can be accessed thanks to Asterisk EAGI but I can’t find any example or clear explanations on how to do it. I have already set up my Asterisk environment and I’m able to execute my python script as an EAGI script and do some basic operations.
This is what my EAGI script looks like right now :
*from asterisk.agi import **
agi = AGI()
agi.verbose(“Python AGI started successfully”)
callerId = agi.env[‘agi_callerid’]
agi.verbose(“Call from %s” % callerId)
I read that I need to use File Descriptor 3 to get the incoming audio stream and I would like to write the audio stream to an actual audio file on my computer. I would like to save the calls to train a model. The objective is to later have an EAGI script that records the call for like 10sec → analyze the audio → take a decision → record → etc.
And before I forget, I’m using the Pyst2 library.
So any help on how can I do this will be reallyd appreciated
Thanks to anyone who will read this post !