dbtext-ser.cfg 3.6 KB

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