#!/bin/bash
##
## This is a simple JobControl program that mimics the behaviour
## of the original DestControls.
## To use this server effectively for batching, basically controlling
## simple destination based modemgroups, etc. You should have the
## Following settings in $SPOOL/etc/config for FaxQueuer:
## MaxBatchJobs: 10 # Or whatever your comfortable with
## JobControlCmd: bin/jobcontrol-destctrls.sh
## JobControlWait: yes
JOBID=$1
##
## GetJobParam
## - returns the value of the job param
GetJobParam ()
{
grep "^$1:" sendq/q$JOBID | cut -d : -f 2-
}
##
## SetControlParam
SetControlParam ()
{
echo "$1: \"$2\""
}
MODEM=$(GetJobParam modem)
if [ $MODEM != "any" ]
then
# If they've specified a modem, batching will probably ignore
# it anyways - we enforce letting us control modem groups.
SetControlParam RejectNotice "Modem $MODEM not allowed - use any"
exit
fi
DEST=$(GetJobParam number)
case "$DEST" in
+12155551212) ## We know these guys can handle a zillion faxes
SetControlParam Modem "Local"
SetControlParam MaxConcurrentCalls 100
;;
+1215*)
SetControlParam Modem "Local"
;;
+1*)
SetControlParam Modem "NA-LD"
;;
+44*)
SetControlParam Modem "UK-LD"
;;
+*)
SetControlParam Modem "Int-LDD"
;;
*)
SetControlParam RejectNotice "Number was not in IDD format (+CCNXXNXXX)"
;;
esac