Trying to integrate with Asterisk EAGI
See original GitHub issueHello
I am trying to use this library to listen for commands over the telephone using Asterisk (Virtual PBX)
The idea is to the user call a number and speaks commands, I would use this library to “understand” those commands
Asterisk can execute an external program and pass it the raw sound using EAGI, it uses file descriptor 3 to output the raw sound, but when I run this code under Asterisk it never pass the “with sr.AudioFile(afile) as source:” looks like it enters and never leaves and no exception is thrown.
Here is the code
import speech_recognition as sr
from asterisk.agi import *
import os
agi = AGI()
# instance recognizer
r = sr.Recognizer()
# file descriptor
FD=3
# audio file
afile=os.fdopen(FD, 'rb')
try:
with sr.AudioFile(afile) as source:
audio = r.listen(source,3)
except Exception, e :
agi.exec_command("NOOP","'Error_%s'"%str(e))
The asterisk documentation says it generates ( audio pipe: Linear pcm audio pipe ) on file descriptor 3
I am new to speech recognition so sorry if it is a stupid question.
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How does EAGI work? - Asterisk Community
Hi everyone! I tried to use speech recognition NodeJS script for my calls with EAGI application. I start it like this:
Read more >Asterisk AGI: Asterisk Gateway Interface - VoIP-Info
It creates an opportunity to link Asterisk dialplan to an external software that wants to manipulate a specific channel. This provides ...
Read more >A Technical Introduction to the Asterisk Gateway Interface (AGI)
Now, go ahead and try to run this program yourself. Test it out, understand what is happening, and make it work. One thing...
Read more >Accessing FD (3) for Asterisk EAGI - Stack Overflow
Are you certain that you have a file descriptor 3? Have you tried just opening the file? – JimB. Apr 11, 2017 at...
Read more >Chapter 9. The Asterisk Gateway Interface (AGI) - O'Reilly
(Try pressing Ctrl-Alt-F9, and see if you get an Asterisk command-line interface.) ... Otherwise, your AGI may not work as expected, because Asterisk...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @bonadio,
I read up on the EAGI spec a bit; it seems like its input file descriptor is an infinite stream, having no EOF markers.
This library doesn’t support raw PCM audio streams directly. However, we can implement it separately:
Please re-open this issue if you have any further questions!
hello id like a help. I need to change this code:
to save a diferente file each time that is a silence on speech. i dont nee dto recognize what is talking. some one can helpme?