#!/bin/sh

# Run Asterisk using the local configuration directory:

my_dir=$(realpath `dirname $0`)
dir="$my_dir/output"
ast_conf="$dir/asterisk.conf"
if [ ! -r "$ast_conf" ]; then
	(
		echo "; File generated by $0"
		echo "[directories]"
		echo "astetcdir     => $dir/conf"
		echo "astlogdir     => $dir/logs"
		echo "astlibdir     => $dir/lib"
		echo "astspooldir   => $dir/spool"
	) > "$ast_conf"
fi
exec /usr/sbin/asterisk -U asterisk -C "$ast_conf" "$@"
