[Home]

Summary:ASTERISK-27240: SHELL function it's returning wrong value
Reporter:Javier Valencia (javier.valencia)Labels:
Date Opened:2017-09-01 07:59:18Date Closed:2017-09-01 12:50:30
Priority:MinorRegression?
Status:Closed/CompleteComponents:Functions/func_shell
Versions:11.6.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Distro: Debian GNU/Linux 8.5 (jessie) Kernel: Linux XXX 4.2.8-1-pve Asterisk: Asterisk certified/11.6-cert13 built by root @ XXX on a x86_64 running Linux Attachments:
Description:Using a SHELL function:
{noformat}
exten => 1,1,NoOp(${SHELL([[ "102,101" == *102* ]] && echo -n 1 || echo -n 0)})
{noformat}
SHELL function always return 0, and must be 1.
Comments:By: Asterisk Team (asteriskteam) 2017-09-01 07:59:19.363-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Sean Bright (seanbright) 2017-09-01 12:50:30.872-0500

Asterisk 11 is no longer supported. The {{SHELL}} function may be poorly named - it does not do what you think it does. It fires off a specified _process_, not arbitrary shell code. If you want this to work, you should instead do something like:

{noformat}
exten => 1,1,NoOp(${SHELL(bash -c '[[ "102,101" == *102* ]] && echo -n 1 || echo -n 0')})
{noformat}