# # $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(); }