Summary:ASTERISK-06643: Operation of System (used to call shell script) has changed in recent version of Asterisk
Reporter:caribou7 (caribou7)Labels:
Date Opened:2006-03-28 17:46:20.000-0600Date Closed:2011-06-07 14:07:57
Versions:Frequency of
Description:In a previous version of Asterisk, I could do this to spawn a shell script, which would go out and download an audio file and place it in a specific location, then play it:

exten => *30,1,ringing
exten => *30,2,System(/var/lib/asterisk/batch/foo.sh)
exten => *30,3,Wait(1)
exten => *30,4,Answer
exten => *30,5,MP3Player(/tmp/foo.mp3)
exten => *30,6,Hangup

What this would do is when I dialed *30, it would go out and execute the shell script (which downloaded a specific audio file and converted it to a format that Asterisk could play).  However, in the most recent version, the System command does NOT wait for the shell script to finish - it tries to play the file before it has even been downloaded and converted.  Please note that I did NOT change the shell script nor the above lines during the upgrade - it worked before, but doesn't work now.

The only thing I can do as a stopgap measure (which will work, but gives the caller five seconds of silence and does not guarantee that the file has been fully downloaded and converted) is something like this:

exten => *30,1,System(/var/lib/asterisk/batch/foo.sh)
exten => *30,2,Answer
exten => *30,3,Wait(5)
exten => *30,4,MP3Player(/tmp/foo.mp3)
exten => *30,5,Hangup

Same shell script, but I have to introduce an artificial delay because I have no way to determine when the script has finished.  I also substituted TrySystem for System and that didn't make any difference.

It's probably obvious that I'm somewhat of a novice at this (and I apologize if this is posted in the wrong section) but of one thing I am fairly sure, and that's that the behavior of the System command somehow changed from a previous version to the most recent one, and that the change has caused it to no longer wait for the shell script to finish before continuing on.
Comments:By: Olle Johansson (oej) 2006-03-28 18:32:43.000-0600

Please tell us what operating system you run on. Thanks.

By: caribou7 (caribou7) 2006-03-28 19:44:23.000-0600

CentOS release 4.2 - I probably should have mentioned that this was an install using the Asterisk@Home package (both previous and current installs).

By: Serge Vecher (serge-v) 2006-05-03 12:12:00

what's this line?

>exten => *30,1,ringing

By: BJ Weschke (bweschke) 2006-05-03 16:29:21

caribou7: the last change this code saw was in September of last year. Was the prior version of Asterisk you were running earlier than that?

By: caribou7 (caribou7) 2006-05-03 18:48:23

The problem existed in an earlier version of Asterisk@Home.  Since that time we have upgraded Asterisk@Home and the problem apparently went away, because I was able to make the previous scripts run again.  Therefore I can no longer reproduce the problem.  I thought you folks had fixed it but maybe it was a bug in the operating system (CentOS)? Anyway, though this may still affect users of that one particular older version of Asterisk@Home, it seems to have been resolved by later releases so as far as I'm concerned this issue can be closed.

By: BJ Weschke (bweschke) 2006-05-03 20:06:18

Maybe an OS issue? Closing per original poster's request.