exec.cfg 929 B

123456789101112131415161718192021222324252627282930313233343536
  1. #
  2. # $Id$
  3. #
  4. # this example shows use of ser as stateless redirect server
  5. # which rewrites URIs using an exernal utility
  6. #
  7. # ------------------ module loading ----------------------------------
  8. loadmodule "modules/exec/exec.so"
  9. loadmodule "modules/sl/sl.so"
  10. # ------------------------- request routing logic -------------------
  11. # main routing logic
  12. route{
  13. # for testing purposes, simply okay all REGISTERs
  14. if (method=="REGISTER") {
  15. log("REGISTER");
  16. sl_send_reply("200", "ok");
  17. break;
  18. };
  19. # first dump the message to a file using cat command
  20. exec_msg("printenv SRCIP > /tmp/exectest.txt; cat >> /tmp/exectest.txt");
  21. # and then rewrite URI using external utility
  22. # note that the last echo command trashes input parameter
  23. if (exec_dset("echo sip:[email protected];echo sip:[email protected];echo>/dev/null")) {
  24. sl_send_reply("300", "Redirect");
  25. } else {
  26. sl_reply_error();
  27. log(1, "alas, rewriting failed\n");
  28. };
  29. }