#!/bin/bash
###########################################
## Asterisk Simple AutoDialer            ##
## Written by Michael LaSalvia           ##
## You will need to have asterisk        ##
## for this to work.                     ##
## (c)2010                               ##
##http://www.digitaloffensive.com        ##
###########################################
#Variables
###########################################
sounds=/var/lib/asterisk/sounds/
rOut=/var/spool/asterisk/outgoing/
rUser=asterisk
rGroup=asterisk
nFile=call.csv
rtry=60
mtry=2
stime=120
#############################################
for nums in $(cat $nFile)
        do
                num=`echo $nums | awk -F"," {'print $1'}`
                noise=`echo $nums | awk -F"," {'print $2'}`
				nTrunk=`echo $nums | awk -F"," {'print $3'}`
echo "`date`,$num,$noise" >> call-log.csv
echo "Channel: SIP/$nTrunk/$num" >> $num.call
echo "RetryTime:$rtry" >> $num.call
echo "MaxRetries:$mtry" >> $num.call
echo "Application: Playback" >> $num.call
echo "Data:$noise" >> $num.call
chown $rUser.$rGroup $num.call
mv $num.call $rOut
sleep $stime
done
