request-hangup-after-1-hour.agi (Source)

#!/bin/bash
# Start a background job to stop a Lenny call after an hour
source $AST_AGI_DIR/bashagi.sh

if [ "$1" != '--background' ]
then
    AGI_read_vars
    AGI_background
    exit
fi

sleep 60m
asterisk -x "core show channels" | grep -q $AGI_CHANNEL &&
    asterisk -x "channel request hangup $AGI_CHANNEL"

# vim: tabstop=4