exec_dist.cfg 1.0 KB

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