#!/bin/bash # # emailasterisk # # Script to pass commands from email to Asterisk by Kyle Yoksh, K0KN 1/2013 # Run as user, not root. # # This script should be owned by a user - NOT ROOT! # # If testing manually from prompt, include arguments in quotes: # # ./emailasterisk "rpt fun 2000 *70" # LOGFILE="/var/log/asterisk/connectlog" # NOTE: This logfile must be owned by your user, NOT root. # # if [ `whoami` = root ]; then echo "Please do not run this script as root or using sudo" exit fi # if [ "$1" == "" ] ; then echo "Missing Argument(s)"; exit fi # Logging echo $(date) "----" "DTMF via email $1" >> $LOGFILE sudo /usr/sbin/asterisk -rx "$1" # done exit 0 fi