Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This file should go in /var/lib/asterisk/agi-bin
- # make sure you change your permissions of astcron.sh to 775
- #Change to hold directory
- #
- cd /var/spool/asterisk/hold
- #
- # Check through all queued files in sort order (so we always get the oldest first)
- #
- for filename in `ls -v *.call`; do
- destexten=`echo $filename | cut -d - -f1 `
- echo "Checking extension" $destexten "for file" $filename "for existing messages"
- ifexist=`ls /var/spool/asterisk/outgoing/*.call | grep -c $destexten`
- #
- # if extension doesnt exist then queued message has been delivered
- # so we can move the waiting message now
- #
- if [[ "$ifexist" == "0" ]]; then
- echo "No existing message for " $destexten
- #
- # move file to outgoing folder
- #
- echo "Moving filename" $filename "to outgoing"
- mv /var/spool/asterisk/hold/$filename /var/spool/asterisk/outgoing/
- #
- # If we actually do a move then delay just in case
- # there is more than one waiting message for that extension
- #
- sleep 3
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement