Running Ruby script from Dialplan

Hi all- I’ve been racking my head and can’t seem to figure out what I’m doing wrong. I’m trying to run a Ruby script from a custom destination. The script is executable and works when run outside of Asterisk. I’ve tried changing the owner of the script from root to asterisk, and that didn’t work. If I switch users to asterisk, I’m able to run the script in any case.

Here’s a snippet from /etc/asterisk/extensions_custom.conf:
exten => s,n,TrySystem(/var/lib/asterisk/ruby-scripts/twilio.rb ${CALLERID(num)} )

I’ve tried both TrySystem and System. TrySystem returns APPERROR in the System Status variable.

Any help would GREATLY be appreciated!

Running FreePBX 14.0.13.6 on a fully updated system. Ruby version is 2.5.1 and set using the .ruby-version file.

What do you see in the asterisk logs?

Try

exten => s,n,TrySystem(. /var/lib/asterisk/ruby-scripts/twilio.rb ${CALLERID(num)})

From what I read apperror is the app executing but encountering a logic error. Does Asterisk have permission to execute the .rb file? Does Asterisk have permission to execute the code(s) within?
We were having a similar issue with a Python script (worked in manual test, failed when executed in dialplan). We built echoes that passed back to the Asterisk log. We added an echo after each line of code. This allowed us to see which line of code was failing by seeing the last echo received from the Python script. Not sure you could do this with Ruby, but thought I would through that out there.

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