Call an extension, from the Linux command line

When an event occurs on this Linux system, I need a shell script to:

  1. Call an extension on Asterisk.
  2. Wait till it answers.
  3. Play the “/var/lib/asterisk/sounds/moron.gsm” file.
  4. Hangup.

How can I do this?
I am looking for a How-To or Tutorial.

Thanks.

Try have a look at .call files. All you will need is a script to create it and you will need to set up extensions.conf for it.