title: Set call file to hang up after some time using Bash AGI
body: <p>I'm trying to make a call using a call file on asterisk where it plays a file and hangs up after a given time whether the sound file has finished or not.</p>
  
  <p>I have it working with this bash script as the AGI script:</p>
  
  <pre><code>#!/bin/bash
  
  Duration="30"
  file="sound.mp3"
  
  while read VAR &amp;&amp; [ -n ${VAR} ] ; do : ; done
  echo "ANSWER"
  read RESPONSE
  
  echo 'SET AUTOHANGUP $Duration'
  
  echo 'EXEC PLAYBACK "'$file'" ""'
  read RESPONSE
  
  exit 0
  </code></pre>
  
  <p>The problem is that the asterisk cdr logs show the call to last 30 seconds whether the the person on the other end has hung up or not...</p>
  
  <p>Can anyone help?</p>