Stefan Viljoen
2018-Jul-30 06:17 UTC
[asterisk-users] asterisk-users Digest, Vol 167, Issue 17
Hi Daniel Thanks for the reply! Yes, turns out it was all my fault, I had a line feed character (0x0a a.k.a printf("\n")) in one of the Asterisk channel variables passed via system() / shell() to my target script. It seems 13.22.0 (I'm using the same version as you) reacts to a line feed in the parameter string by not processing or parsing the string any further one the line feed is encountered. I removed the line feed (by using "echo -n" instead of just "echo" in a related BASH script that was providing input to Asterisk also via SHELL) and the problem disappeared and system() (and shell() itself ) started working correctly. So, the moral is just keep the data clean that is fed through SYSTEM() and SHELL() from having any line-feeds in them. On Asterisk 1.8 (my previous version) line-feeds in an Asterisk channel variable dereferenced in a SYSTEM() or SHELL() call did NOT stop parsing of the rest of the string - so apparently a relevant difference between the two versions there. Kind regards, --- Message: 2 Date: Fri, 27 Jul 2018 10:24:56 +0200 From: Administrator TOOTAI <admin at tootai.net> To: asterisk-users at lists.digium.com Subject: Re: [asterisk-users] SHELL() function Asterisk 13 - can only accept one paramter in string? Message-ID: <008fecea-e2c0-9230-7cb4-cd1b6990c4be at tootai.net> Content-Type: text/plain; charset=utf-8; format=flowed Le 27/07/2018 à 09:36, Stefan Viljoen a écrit :> Hi all > > This is a followup on my post "Asterisk 13 - system() dialplan app > cannot call bash scripts" from yesterday > > I've given up trying to use system() to call BASH scripts with parameters from Asterisk 13. > > Turned out under Asterisk 13.22.0 System() DOES work, but only if you do NOT attempt to pass any parameters to the called script.[...] *CLI> core show version Asterisk 13.22.0 built by root @ pabx on a x86_64 running Linux on 2018-07-14 13:36:49 UTC This works for us same = n,system(/bin/echo "To: ${CALLED_CHANNEL} From: ${ORI_CALL}" | /usr/bin/mail -s "TOOTAiAudio - Congestion Gateway ${CONGESTION_GW} used" ${AUDIO_ADMIN}) -- Daniel