db_text.cfg 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #
  2. # $Id$
  3. #
  4. # simple quick-start config script with dbtext
  5. #
  6. # ----------- global configuration parameters ------------------------
  7. #debug=9 # debug level (cmd line: -dddddddddd)
  8. #fork=yes
  9. #log_stderror=no # (cmd line: -E)
  10. check_via=no # (cmd. line: -v)
  11. dns=no # (cmd. line: -r)
  12. rev_dns=no # (cmd. line: -R)
  13. children=4
  14. listen=10.100.100.1
  15. port=5060
  16. # ------------------ module loading ----------------------------------
  17. # use dbtext database
  18. loadmodule "modules/dbtext/dbtext.so"
  19. loadmodule "modules/sl/sl.so"
  20. loadmodule "modules/tm/tm.so"
  21. loadmodule "modules/rr/rr.so"
  22. loadmodule "modules/maxfwd/maxfwd.so"
  23. loadmodule "modules/usrloc/usrloc.so"
  24. loadmodule "modules/registrar/registrar.so"
  25. loadmodule "modules/textops/textops.so"
  26. loadmodule "modules/textops/mi_fifo.so"
  27. # modules for digest authentication
  28. loadmodule "modules/auth/auth.so"
  29. loadmodule "modules/auth_db/auth_db.so"
  30. # ----------------- setting module-specific parameters ---------------
  31. # -- mi_fifo params --
  32. modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
  33. # -- usrloc params --
  34. # use dbtext database for persistent storage
  35. modparam("usrloc", "db_mode", 2)
  36. modparam("usrloc|auth_db", "db_url", "dbtext:///tmp/openserdb")
  37. # -- auth params --
  38. #
  39. modparam("auth_db", "calculate_ha1", 1)
  40. modparam("auth_db", "password_column", "password")
  41. modparam("auth_db", "user_column", "username")
  42. modparam("auth_db", "domain_column", "domain")
  43. # -- rr params --
  44. # add value to ;lr param to make some broken UAs happy
  45. modparam("rr", "enable_full_lr", 1)
  46. # ------------------------- request routing logic -------------------
  47. # main routing logic
  48. route{
  49. # initial sanity checks -- messages with
  50. # max_forwards==0, or excessively long requests
  51. if (!mf_process_maxfwd_header("10")) {
  52. sl_send_reply("483","Too Many Hops");
  53. exit;
  54. };
  55. if (msg:len >= max_len ) {
  56. sl_send_reply("513", "Message too big");
  57. exit;
  58. };
  59. # we record-route all messages -- to make sure that
  60. # subsequent messages will go through our proxy; that's
  61. # particularly good if upstream and downstream entities
  62. # use different transport protocol
  63. if (!method=="REGISTER") record_route();
  64. # subsequent messages withing a dialog should take the
  65. # path determined by record-routing
  66. if (loose_route()) {
  67. # mark routing logic in request
  68. append_hf("P-hint: rr-enforced\r\n");
  69. route(1);
  70. exit;
  71. };
  72. if (!uri==myself) {
  73. # mark routing logic in request
  74. append_hf("P-hint: outbound\r\n");
  75. route(1);
  76. exit;
  77. };
  78. # if the request is for other domain use UsrLoc
  79. # (in case, it does not work, use the following command
  80. # with proper names and addresses in it)
  81. if (uri==myself) {
  82. if (method=="REGISTER") {
  83. # digest authentication
  84. if (!www_authorize("", "subscriber")) {
  85. www_challenge("", "0");
  86. exit;
  87. };
  88. save("location");
  89. exit;
  90. };
  91. lookup("aliases");
  92. if (!uri==myself) {
  93. append_hf("P-hint: outbound alias\r\n");
  94. route(1);
  95. exit;
  96. };
  97. # native SIP destinations are handled using our USRLOC DB
  98. if (!lookup("location")) {
  99. sl_send_reply("404", "Not Found");
  100. exit;
  101. };
  102. };
  103. append_hf("P-hint: usrloc applied\r\n");
  104. route(1);
  105. }
  106. route[1]
  107. {
  108. # send it out now; use stateful forwarding as it works reliably
  109. # even for UDP2TCP
  110. if (!t_relay()) {
  111. sl_reply_error();
  112. };
  113. }