1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#
# $Id$
#
# Example for distributing load accross multiple devices
#
fork=no
log_stderror=yes
listen=192.168.2.16
# ----------- global configuration parameters ------------------------
loadmodule "modules/exec/exec.so"
loadmodule "modules/sl/sl.so"
loadmodule "modules/tm/tm.so"
# ----------------- setting module-specific parameters ---------------
route{
# uri for my domain ?
if (!(uri==myself)) {
sl_send_reply("500", "example serves only my domain");
break;
};
if (method=="REGISTER") {
sl_send_reply("200", "silly example -- pretend registrar");
break;
};
exec_dset('
# calculate a characteristic value for this call
CHAR=`echo $SIP_HF_CALLID | sum | awk " { print \\\$1 } "`
# normalize the value
NC=`expr $CHAR % 100`
# distribute now
# gateway 192.168.2.35 @ 10 %
if [ "$NC" -lt 10 ] ; then
printf "sip:00$SIP_USER@192.168.2.35"
exit
fi
# anything else at 90 %
printf "sip:11$SIP_USER@192.168.2.34"
exit
# SER adds command-line parameters -- trash them here
echo > dev/null
');
t_relay();
}
|