[asterisk-users] Asterisk 13 - system() dialplan app cannot call bash scripts

Stefan Viljoen viljoens at verishare.co.za
Fri Jul 27 09:43:40 CDT 2018


Hi Guys

Just feedback on this particular thread, this issue is SOLVED.

The reason why SYSTEM() and SHELL() was not working for me was that I was
passing a linefeed character (\n, hex 0x0a) in one of the channel variables
in Asterisk that was then parsed in the call to SYSTEM() and SHELL().

It appears that a big difference between 1.8 (where this code was developed)
and Asterisk 10 / 11 / 12 / 13 et al is that if SYSTEM() or SHELL()
encounters a linefeed in the parsed parameters passed in the string they are
called on, they stop parsing and evaluating any other Asterisk variables
passed in to the right of the parameter string given to SYSTEM() and
SHELL().

I eliminated the spurious \n character from a UUID generation BASH script
and SYSTEM() and SHELL() now appear to be working correctly, parsing and
evaluating all Asterisk channel variables passed into them as parameters,
and then calling the external BASH script 100% correctly with these
parameters.

So the issue was "bad data" on my side, and the apparent fact that Asterisk
13.22.0 is sensitive to \n in parameter strings passed to the SHELL()
function and SYSTEM() dialplan application, and stops processing the string
if a \n is encountered in a call to SHELL() or SYSTEM().

Hope this helps someone.

Regards

Stefan




More information about the asterisk-users mailing list