backup.cfg 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #
  2. # $Id$
  3. #
  4. # iptel.org real world configuration
  5. #
  6. # ----------- global configuration parameters ------------------------
  7. debug=4 # debug level (cmd line: -dddddddddd)
  8. fork=no
  9. #log_stderror=no # (cmd line: -E)
  10. log_stderror=yes # (cmd line: -E)
  11. #check_via=yes # (cmd. line: -v)
  12. #check_via=0
  13. dns=on # (cmd. line: -r)
  14. rev_dns=yes # (cmd. line: -R)
  15. port=5069
  16. #port=8060
  17. children=1
  18. # advertise IP address in Via (as opposed to advertising DNS name
  19. # which is annoying for downstream servers and some phones can
  20. # not handle DNS at all)
  21. listen=195.37.77.100
  22. #listen=bat.iptel.org
  23. # ------------------ module loading ----------------------------------
  24. loadmodule "../sip_router/modules/sl/sl.so"
  25. loadmodule "../sip_router/modules/print/print.so"
  26. #loadmodule "../sip_router/modules/tm/tm.so"
  27. loadmodule "../sip_router/modules/acc/acc.so"
  28. loadmodule "../sip_router/modules/rr/rr.so"
  29. loadmodule "../sip_router/modules/maxfwd/maxfwd.so"
  30. loadmodule "../sip_router/modules/mysql/mysql.so"
  31. loadmodule "../sip_router/modules/usrloc/usrloc.so"
  32. loadmodule "../sip_router/modules/auth/auth.so"
  33. loadmodule "../sip_router/modules/cpl/cpl.so"
  34. # ----------------- setting module-specific parameters ---------------
  35. # -- usrloc params --
  36. modparam("usrloc", "use_database", 1)
  37. modparam("usrloc", "table", "location")
  38. modparam("usrloc", "user_column", "user")
  39. modparam("usrloc", "contact_column", "contact")
  40. modparam("usrloc", "expires_column", "expires")
  41. modparam("usrloc", "q_column", "q")
  42. modparam("usrloc", "callid_column", "callid")
  43. modparam("usrloc", "cseq_column", "cseq")
  44. modparam("usrloc", "flush_interval", 60)
  45. modparam("usrloc", "db_url", "sql://root:@localhost/ser")
  46. # -- auth params --
  47. modparam("auth", "db_url", "sql://root:@localhost/ser")
  48. modparam("auth", "user_column", "user")
  49. # nonce generation secret; particularly useful if multiple servers
  50. # in a proxy farm are configured to authenticate
  51. modparam("auth", "secret", "439tg8h349g8hq349t9384hg")
  52. # calculate_ha1=false means password column includes ha1 strings;
  53. # if it was false, plain-text passwords would be assumed
  54. # the database credentials in hashed form
  55. modparam("auth", "calculate_ha1", false)
  56. modparam("auth", "password_column", "ha1")
  57. # password_column, realm_column, group_table, group_user_column,
  58. # group_group_column are set to their default values
  59. # password_column_2 allows to deal with clients who put domain name
  60. # in authentication credentials when calculate_ha1=false (if true,
  61. # it works); if set to a value and USER_DOMAIN_HACK was enabled
  62. # in defs.h, authentication will still work
  63. modparam("auth", "password_column_2", "ha1b")
  64. # the database in plain-text alternative:
  65. #modparam("auth", "calculate_ha1", true )
  66. #modparam("auth", "password_column", "password")
  67. modparam("auth", "nonce_expire", 300)
  68. modparam("auth", "retry_count", 3)
  69. # -- acc params --
  70. # report ACKs too for sake of completeness -- as we account PSTN
  71. # destinations which are RR, ACKs should show up
  72. modparam("acc", "report_ack", 1)
  73. # don't bother me with early media reports (I don't like 183
  74. # too much anyway...ever thought of timer C hitting after
  75. # listening to music-on-hold for five minutes?)
  76. modparam("acc", "early_media", 0)
  77. modparam("acc", "log_level", 1)
  78. # that is the flag for which we will account -- don't forget to
  79. # set the same one :-)
  80. modparam("acc", "acc_flag", 1 )
  81. # we are interested only in succesful transactions
  82. modparam("acc", "failed_transactions", 0 )
  83. # -- tm params --
  84. modparam("tm", "fr_timer", 30 )
  85. modparam("tm", "fr_inv_timer", 60 )
  86. # ------------------------- request routing logic -------------------
  87. # main routing logic
  88. route{
  89. # filter local stateless ACK generated by authentication of mf replies
  90. sl_filter_ACK();
  91. # filter too old messages
  92. log("LOG: Checking maxfwd\n");
  93. if (!mf_process_maxfwd_header("10")) {
  94. log("LOG: Too many hops\n");
  95. sl_send_reply("483","Too Many Hops");
  96. break;
  97. };
  98. if (method=="REGISTER") {
  99. log("LOG Request is REGISTER\n");
  100. if (!www_authorize( "bat.iptel.org" /* realm */,
  101. "subscriber" /* table name */ )) {
  102. log("LOG: REGISTER has no credentials, sending challenge\n");
  103. www_challenge( "bat.iptel.org" /* realm */,
  104. "0" /* no qop -- M$ can't deal with it */);
  105. break;
  106. };
  107. # prohibit attempts to grab someone else's To address
  108. # using valid credentials
  109. if (!is_user("replicator")) {
  110. log("LOG: To Cheating attempt\n");
  111. sl_send_reply("403", "That is ugly -- use To=id next time");
  112. break;
  113. };
  114. # update Contact database
  115. log("LOG: REGISTER is authorized, saving location\n");
  116. save_contact("location");
  117. break;
  118. };
  119. }