replicate.cfg 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #
  2. # $Id$
  3. #
  4. # demo script showing how to set-up usrloc replication
  5. #
  6. # ----------- global configuration parameters ------------------------
  7. debug=3 # debug level (cmd line: -dddddddddd)
  8. fork=no
  9. log_stderror=yes # (cmd line: -E)
  10. # ------------------ module loading ----------------------------------
  11. loadmodule "modules/mysql/mysql.so"
  12. loadmodule "modules/sl/sl.so"
  13. loadmodule "modules/tm/tm.so"
  14. loadmodule "modules/maxfwd/maxfwd.so"
  15. loadmodule "modules/usrloc/usrloc.so"
  16. loadmodule "modules/registrar/registrar.so"
  17. loadmodule "modules/auth/auth.so"
  18. # ----------------- setting module-specific parameters ---------------
  19. # digest generation secret; use the same in backup server;
  20. # also, make sure that the backup server has sync'ed time
  21. modparam("auth", "secret", "alsdkhglaksdhfkloiwr")
  22. # ------------------------- request routing logic -------------------
  23. # main routing logic
  24. route{
  25. # initial sanity checks -- messages with
  26. # max_forwars==0, or excessively long requests
  27. if (!mf_process_maxfwd_header("10")) {
  28. sl_send_reply("483","Too Many Hops");
  29. break;
  30. };
  31. if (len_gt( max_len )) {
  32. sl_send_reply("513", "Message too big");
  33. break;
  34. };
  35. # if the request is for other domain use UsrLoc
  36. # (in case, it does not work, use the following command
  37. # with proper names and addresses in it)
  38. if (uri==myself) {
  39. if (method=="REGISTER") {
  40. # verify credentials
  41. if (!www_authorize("foo.bar", "subscriber")) {
  42. www_challenge("foo.bar", "0");
  43. break;
  44. };
  45. # if ok, update contacts and ...
  46. save("location");
  47. # ... if this REGISTER is not a replica from our
  48. # peer server, replicate to the peer server
  49. if (!src_ip==backup.foo.bar) {
  50. t_replicate("backup.foo.bar", "5060");
  51. };
  52. break;
  53. };
  54. # do whatever else appropriate for your domain
  55. log("non-REGISTER\n");
  56. };
  57. }