No data on file descriptor 3 for EAGI script

Greetings community,

I’m running into difficulties trying to capture the live audio stream from an EAGI script on file descriptor 3. While the file descriptor appears to be open, there is no data written.

I set up a custom context like so in extensions_custom.conf:

[custom-plugin]

exten => s,1,Answer()                                                     
exten => s,n,EAGI(plugin.py)                                                
exten => s,n,Hangup()

I have it configured in the admin panel’s custom destination, and then I have an inbound route that uses it as a custom destination. The script gets correctly executed when an incoming call is received, and I can e.g. log or hangup from the script. So far so good.

But if I try to read on file descriptor 3:

audio = os.fdopen(3, 'rb')
data = audio.read(4096)  

It’ll hang forever. I’ve tried to make it nonblocking, but that did not help.

I’m calling from a regular phone line into a voip line provided by OVHCloud, and I’ve registered the line on this server using freePBX.

Things I’ve tried:

  • run strace on the process id. I can clearly see it hanging on the read:
sudo strace -e trace=read,write -p 154109
strace: Process 154109 attached
read(3,    # <- hangs at this point
  • trying Record() instead of EAGI. It correctly records the audio data.
  • tried a bash script that reads from fd 3, same behavior
  • read the logs, both by running asterisk -rvvv and by tailing /var/log/asterisk/full, no errors at runtime

I’m using asterisk v22.0.0 with freepbx v17.0.

I do see some errors when starting asterisk, e.g.:

    loader.c: Error loading module     cannot open shared object file: No such file or directory
    loader.c: Error loading module 'format_mp3.so': /usr/lib/asterisk/modules/format_mp3.so: cannot open shared object file: No such file or directory
    loader.c: Error loading module 'res_pjsip_phoneprov_provider.so', missing dependency: res_phoneprov

It is similar to: EAGI: can't read file descriptor 3, any read blocks forever , which has no solution.

What other things could I check, how could I debug this further?

Thank you in advance

Do you have routers with dynamic rules between you and the source? If so, they may need outbound media to allow them to create those rules.

Do you get audio if you dial a local phone, rather than using EAGI?

Thanks for your reply.

I’m running in Hetzner cloud, so there is a firewall. I believe I’ve opened the right ports.

Since the same phonecall using the Record() application instead of EAGI() will record the audio correctly, I’m inclined to think it’s not a problem with an open port - unless asterisk needs certain ports to be open in order to write audio to file-descriptor 3 for eagi?

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