acc-test.cfg 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #
  2. # iptel.org real world configuration
  3. #
  4. # ----------- global configuration parameters ------------------------
  5. # we're debugging now
  6. debug=9 # debug level (cmd line: -dddddddddd)
  7. fork=no
  8. log_stderror=yes # (cmd line: -E)
  9. #fork=yes
  10. #children=16
  11. #log_stderror=no # (cmd line: -E)
  12. check_via=yes # (cmd. line: -v)
  13. dns=on # (cmd. line: -r)
  14. rev_dns=yes # (cmd. line: -R)
  15. # experimental usage at port 5060
  16. #port=9060
  17. #port=8060
  18. port=5060
  19. # advertise IP address in Via (as opposed to advertising DNS name
  20. # which is annoying for downstream servers and some phones can
  21. # not handle DNS at all)
  22. #listen=195.37.77.101
  23. #listen=193.175.135.170
  24. # ------------------ module loading ----------------------------------
  25. loadmodule "../sip_router/modules/sl/sl.so"
  26. loadmodule "../sip_router/modules/print/print.so"
  27. loadmodule "../sip_router/modules/tm/tm_mod.so"
  28. #loadmodule "../sip_router/modules/acc/acc.so"
  29. loadmodule "../sip_router/modules/rr/rr.so"
  30. loadmodule "../sip_router/modules/maxfwd/maxfwd.so"
  31. #loadmodule "../sip_router/modules/mysql/mysql.so"
  32. loadmodule "../sip_router/modules/usrloc/usrloc.so"
  33. #loadmodule "../sip_router/modules/auth/auth.so"
  34. #loadmodule "../sip_router/modules/cpl/cpl.so"
  35. loadmodule "../sip_router/modules/radius_acc/radius_acc.so"
  36. loadmodule "../sip_router/modules/registrar/registrar.so"
  37. # ----------------- setting module-specific parameters ---------------
  38. # -- usrloc params --
  39. # use in-RAM usrloc
  40. #modparam("usrloc", "use_db", 0)
  41. # -- acc params --
  42. # report ACKs too for sake of completeness -- as we account PSTN
  43. # destinations which are RR, ACKs should show up
  44. #modparam("acc", "report_ack", 1)
  45. # don't bother me with early media reports (I don't like 183
  46. # too much anyway...ever thought of timer C hitting after
  47. # listening to music-on-hold for five minutes?)
  48. #modparam("acc", "early_media", 0)
  49. #modparam("acc", "log_level", 1)
  50. # that is the flag for which we will account -- don't forget to
  51. # set the same one :-)
  52. #modparam("acc", "acc_flag", 1 )
  53. # we are interested only in succesful transactions
  54. #modparam("acc", "failed_transactions", 0 )
  55. # -- acc params --
  56. # report ACKs too for sake of completeness -- as we account PSTN
  57. # destinations which are RR, ACKs should show up
  58. modparam("radius_acc", "report_ack", 1)
  59. # don't bother me with early media reports (I don't like 183
  60. # too much anyway...ever thought of timer C hitting after
  61. # listening to music-on-hold for five minutes?)
  62. modparam("radius_acc", "early_media", 0)
  63. modparam("radius_acc", "log_level", 1)
  64. # that is the flag for which we will account -- don't forget to
  65. # set the same one :-)
  66. modparam("radius_acc", "acc_flag", 1 )
  67. # we are interested only in succesful transactions
  68. modparam("radius_acc", "failed_transactions", 0 )
  69. # -- tm params --
  70. modparam("tm", "fr_timer", 30 )
  71. modparam("tm", "fr_inv_timer", 60 )
  72. # ------------------------- request routing logic -------------------
  73. # main routing logic
  74. route{
  75. # filter local stateless ACK generated by authentication of mf replies
  76. sl_filter_ACK();
  77. # filter too old messages
  78. log("LOG: Checking maxfwd\n");
  79. if (!mf_process_maxfwd_header("10")) {
  80. log("LOG: Too many hops\n");
  81. sl_send_reply("483","Too Many Hops");
  82. break;
  83. };
  84. # len_gt *after* max_fwd, otherwise an "INVITE sip:[email protected]"
  85. # will cause "message too big" for a short message
  86. if (len_gt( max_len )) {
  87. sl_send_reply("513", "Riesengross -- Message too large");
  88. break;
  89. };
  90. # Do strict routing if route headers present
  91. if (method=="INVITE") {
  92. addRecordRoute();
  93. } else {
  94. rewriteFromRoute();
  95. };
  96. # that is outbound request...
  97. if (!(uri=~"fox\.iptel\.org([;:].*)*"
  98. | uri=~"[@:\.]195\.37\.77\.101([;:].*)*" )) {
  99. route(2);
  100. # break from route (2) return -- stop then !
  101. break;
  102. };
  103. # here we continue with requests for our domain...
  104. if (method=="REGISTER") {
  105. # update Contact database
  106. log("LOG: REGISTER is authorized, saving location\n");
  107. save("location");
  108. break;
  109. };
  110. # native SIP destinations are handled using our USRLOC DB
  111. if (!lookup("location")) {
  112. if (method=="ACK") {
  113. log("Ooops -- an ACK made it here -- probably UAC screwed up to-tags\n");
  114. break;
  115. };
  116. log("LOG: Unable to lookup contact, sending 404\n");
  117. sl_send_reply("404", "Not Found");
  118. break;
  119. };
  120. # label for accounting
  121. setflag(1);
  122. # we now know we may, we know where, let it go out now!
  123. if (!t_relay()) {
  124. sl_reply_error();
  125. break;
  126. };
  127. }
  128. #---------------------------------------------------------------------
  129. # routing logic for outbound requests targeted out of our domain
  130. # -- use outbound proxy iptel.org (note that except to FOKUS/PBX,
  131. # or itpel.org users, requests will be challenged)
  132. route[2] {
  133. log("LOG: that's a request to outside");
  134. # label for accounting
  135. setflag(1);
  136. if (!t_relay_to("fox.iptel.org", "5060")) {
  137. sl_reply_error();
  138. break;
  139. };
  140. }