Queued Asterisk .call files PDF Print E-mail

Say you have a small Asterisk installation with a single outgoing Zap channel and you want to throw a bunch of call files at it.  If you move them all into the outgoing directory at once, Asterisk will try to call them all and only the first one will work.  The rest will all fail because the channel is unavailable.  What you need is a way to move them one at a time into the outgoing directory. 

 

This pair of bash scripts does just that: (Note the popast script runs forever.)

popast 

#!/bin/bash
#script to sanely move call files
echo popast: checking for files2
while [ 1 ] ; do
    echo popast: inwhile1
    while [ -e /var/spool/asterisk/outgoing/*call ] ; do
        echo popast: inwhile waiting for call completion
        sleep 5
    done
    echo popast: calling mvfile
    mvfile queued/*call
done
echo popast: done

mvfile

#!/bin/bash
#script to sanely move call files
echo mvfile: $1
mv $1 /var/spool/asterisk/outgoing/