1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #
- # $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:[email protected]"
- exit
- fi
- # anything else at 90 %
- printf "sip:[email protected]"
- exit
- # SER adds command-line parameters -- trash them here
- echo > dev/null
- ');
- t_relay();
- }
|