System command to execute script

Hello everyone. I need to launch a script from the dialplan when receiving an SMS. The script calls 4 different scripts that get data from mysql, read data from a csv, generate callfiles…
Launched from the CLI it works perfectly, instead using the System command from inside the dialplan it seems that the functionality is limited and therefore the execution generates unexpected results.
Is there anything I can check ? I added PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin/ to all scripts but nothing to do.

You have provided not enough information. There could be different accounts for Asterisk and your CLI tests. Depending on the OS, SELinux might be doing its work, etc …

Did you consider agi()?

It will allow you do interact with Asterisk by:

  1. Reading and writing channel variables
  2. Execute AGI commands
  3. Execute dialplan applications
  4. Execute AMI commands.

and probably other stuff not on top of mind.

What is/are your script(s) supposed to do?

Typical script failures result from PATH (and other environment variables), permissions, and SELinux.

  1. Execute a task (like read from DB or execute an API) while playing a prompt.

E.g. processing a credit card authorization can take a couple of seconds. To ‘hide’ the dead air, play a prompt like ‘Get ready for a wild experience’ as a background thread and execute your DB and API calls for the auth. When the auth completes, join the background thread and the caller has a ‘seamless’ experience.

“Did you consider agi()?”

“processing a credit card authorization can take a couple of seconds. To
‘hide’ the dead air, play a prompt like ‘Get ready for a wild experience’ as a
background thread and execute your DB and API calls for the auth. When the
auth completes, join the background thread and the caller has a ‘seamless’
experience.”

Can you point to any online documentation / tutorials / resources which
explain how to do this sort of thing with AGI?

It does seem to be a very powerful facility, but I’ve found precious little
guidance on how to make it do what it’s capable of.

I’m hoping that’s just down to my poor search efforts so far.

I do Asterisk dialplans, I do AMI and I do AEL, but I’ve never quite managed
to get into AGI.

Antony.

I have some simple examples of AGI, AMI+AGI, and FastAGI in my Seaskirt examples repo.

Hello…as always I’m looking for help at the end of the day, but then already writing I get the idea…The problem was the paths inside the scripts…I often use ./name of the scripts .sh … …It’s a bad habit…Exploding the relative paths with the absolute ones everything works…
Thanks for your patience…In Italy we say that “The night brings advice”

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