replicate.cfg 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. loadmodule "modules/auth_db/auth_db.so"
  19. # ----------------- setting module-specific parameters ---------------
  20. # digest generation secret; use the same in backup server;
  21. # also, make sure that the backup server has sync'ed time
  22. modparam("auth", "secret", "alsdkhglaksdhfkloiwr")
  23. # ------------------------- request routing logic -------------------
  24. # main routing logic
  25. route{
  26. # initial sanity checks -- messages with
  27. # max_forwars==0, or excessively long requests
  28. if (!mf_process_maxfwd_header("10")) {
  29. sl_send_reply("483","Too Many Hops");
  30. break;
  31. };
  32. if (len_gt( max_len )) {
  33. sl_send_reply("513", "Message too big");
  34. break;
  35. };
  36. # if the request is for other domain use UsrLoc
  37. # (in case, it does not work, use the following command
  38. # with proper names and addresses in it)
  39. if (uri==myself) {
  40. if (method=="REGISTER") {
  41. # verify credentials
  42. if (!www_authorize("foo.bar", "subscriber")) {
  43. www_challenge("foo.bar", "0");
  44. break;
  45. };
  46. # if ok, update contacts and ...
  47. save("location");
  48. # ... if this REGISTER is not a replica from our
  49. # peer server, replicate to the peer server
  50. if (!src_ip==backup.foo.bar) {
  51. t_replicate("backup.foo.bar", "5060");
  52. };
  53. break;
  54. };
  55. # do whatever else appropriate for your domain
  56. log("non-REGISTER\n");
  57. };
  58. }