no-db.cfg 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. debug=3 # debug level (cmd line: -dddddddddd)
  2. check_via=no # (cmd. line: -v)
  3. dns=no # (cmd. line: -r)
  4. rev_dns=no # (cmd. line: -R)
  5. port=5060
  6. children=2
  7. alias="test-domain.com"
  8. mhomed=yes # usefull for multihomed hosts, small performance penalty
  9. #tcp_accept_aliases=yes # accepts the tcp alias via option (see NEWS)
  10. #tcp_poll_method="sigio_rt"
  11. # ------------------ module loading ----------------------------------
  12. # Uncomment this if you want to use SQL database
  13. loadmodule "/usr/lib/ser/modules/sl.so"
  14. loadmodule "/usr/lib/ser/modules/avp.so"
  15. loadmodule "/usr/lib/ser/modules/avpops.so"
  16. loadmodule "/usr/lib/ser/modules/tm.so"
  17. loadmodule "/usr/lib/ser/modules/rr.so"
  18. loadmodule "/usr/lib/ser/modules/maxfwd.so"
  19. loadmodule "/usr/lib/ser/modules/usrloc.so"
  20. loadmodule "/usr/lib/ser/modules/registrar.so"
  21. loadmodule "/usr/lib/ser/modules/textops.so"
  22. loadmodule "/usr/lib/ser/modules/dialog.so"
  23. loadmodule "/usr/lib/ser/modules/rls.so"
  24. loadmodule "/usr/lib/ser/modules/pa.so"
  25. loadmodule "/usr/lib/ser/modules/presence_b2b.so"
  26. loadmodule "/usr/lib/ser/modules/uri.so"
  27. loadmodule "/usr/lib/ser/modules/fifo.so"
  28. loadmodule "/usr/lib/ser/modules/xmlrpc.so"
  29. loadmodule "/usr/lib/ser/modules/xlog.so"
  30. # ----------------- setting module-specific parameters ---------------
  31. # add value to ;lr param to make some broken UAs happy
  32. modparam("rr", "enable_full_lr", 1)
  33. modparam("rls", "min_expiration", 120)
  34. modparam("rls", "max_expiration", 120)
  35. modparam("rls", "default_expiration", 120)
  36. modparam("rls", "auth", "none")
  37. modparam("rls", "xcap_root", "http://localhost/xcap")
  38. modparam("rls", "reduce_xcap_needs", 1)
  39. modparam("rls", "db_mode", 0)
  40. # modparam("rls", "db_url", "mysql://ser:[email protected]:3306/ser")
  41. modparam("pa", "use_db", 0)
  42. modparam("pa", "offline_winfo_timer", 600)
  43. modparam("pa", "offline_winfo_expiration", 600)
  44. # modparam("pa", "db_url", "mysql://ser:[email protected]:3306/ser")
  45. # mode of PA authorization: none, implicit or xcap
  46. modparam("pa", "auth", "xcap")
  47. modparam("pa", "auth_xcap_root", "http://localhost/xcap")
  48. modparam("pa", "winfo_auth", "none")
  49. modparam("pa", "use_callbacks", 1)
  50. modparam("pa", "accept_internal_subscriptions", 0)
  51. modparam("pa", "max_subscription_expiration", 120)
  52. modparam("pa", "timer_interval", 1)
  53. modparam("presence_b2b", "presence_route", "<sip:127.0.0.1;lr>")
  54. # modparam("presence_b2b", "presence_route", "<sip:127.0.0.1;transport=tcp;lr>")
  55. modparam("presence_b2b", "on_error_retry_time", 60)
  56. modparam("presence_b2b", "wait_for_term_notify", 33)
  57. modparam("presence_b2b", "resubscribe_delta", 30)
  58. modparam("presence_b2b", "min_resubscribe_time", 60)
  59. modparam("presence_b2b", "default_expiration", 3600)
  60. modparam("presence_b2b", "handle_presence_subscriptions", 1)
  61. modparam("usrloc", "db_mode", 0)
  62. # modparam("domain|uri_db|acc|auth_db|usrloc|msilo", "db_url", "mysql://ser:[email protected]:3306/ser")
  63. modparam("fifo", "fifo_file", "/tmp/ser_fifo")
  64. # ------------------------- request routing logic -------------------
  65. # main routing logic
  66. route{
  67. # XML RPC
  68. if (method == "POST" || method == "GET") {
  69. create_via();
  70. dispatch_rpc();
  71. break;
  72. }
  73. # initial sanity checks -- messages with
  74. # max_forwards==0, or excessively long requests
  75. if (!mf_process_maxfwd_header("10")) {
  76. sl_send_reply("483","Too Many Hops");
  77. break;
  78. };
  79. if (msg:len >= max_len ) {
  80. sl_send_reply("513", "Message too big");
  81. break;
  82. };
  83. # we record-route all messages -- to make sure that
  84. # subsequent messages will go through our proxy; that's
  85. # particularly good if upstream and downstream entities
  86. # use different transport protocol
  87. if (!method=="REGISTER") record_route();
  88. # subsequent messages withing a dialog should take the
  89. # path determined by record-routing
  90. if (loose_route()) {
  91. # mark routing logic in request
  92. append_hf("P-hint: rr-enforced\r\n");
  93. route(1);
  94. break;
  95. };
  96. if (uri==myself) {
  97. if (method=="SUBSCRIBE") {
  98. if (!t_newtran()) {
  99. sl_reply_error();
  100. break;
  101. };
  102. # new subscription
  103. if (@to.tag=="") {
  104. if ((@msg.supported=~"eventlist")) {
  105. # Supported header field
  106. # -> may be RLS subscription
  107. if (is_simple_rls_target("$uid-list")) {
  108. # log(1, "it is simple subscription!\n");
  109. # handle_rls_subscription("1");
  110. # takes From UID and makes XCAP query
  111. # for user's list named "default"
  112. if (@to.tag=="") {
  113. # only for new subscriptions (with empty to tag
  114. if (!query_resource_list("default")) {
  115. t_reply("500", "XCAP query error");
  116. break;
  117. }
  118. }
  119. }
  120. if (!have_flat_list()) {
  121. # query_resource_list failed or was not called
  122. # do standard RLS query acording to To/AOR
  123. query_rls_services();
  124. }
  125. if (have_flat_list()) {
  126. handle_rls_subscription("1");
  127. break;
  128. }
  129. }
  130. # SUBSCRIBE to existing user
  131. # xlog("L_ERR", "PA: handling subscription: %tu from: %fu\n");
  132. handle_subscription("registrar");
  133. break;
  134. }
  135. else { # renewal subscription
  136. if (!handle_rls_subscription("0")) {
  137. handle_subscription("registrar");
  138. }
  139. break;
  140. }
  141. }
  142. if (method=="REGISTER") {
  143. save("location");
  144. break;
  145. };
  146. if (method=="PUBLISH") {
  147. if (!t_newtran()) {
  148. sl_reply_error();
  149. break;
  150. };
  151. handle_publish("registrar");
  152. break;
  153. };
  154. if (method=="NOTIFY") {
  155. if (!t_newtran()) {
  156. log(1, "newtran error\n");
  157. sl_reply_error();
  158. break;
  159. };
  160. if (!handle_notify()) {
  161. t_reply("481", "Unable to handle notification");
  162. }
  163. break;
  164. };
  165. # message authorization
  166. if (method=="MESSAGE") {
  167. log(1, "MESSAGE authorization\n");
  168. if (!authorize_message("http://localhost/xcap")) {
  169. sl_reply("403", "Forbidden");
  170. break;
  171. }
  172. }
  173. # native SIP destinations are handled using our USRLOC DB
  174. if (!lookup("location")) {
  175. sl_send_reply("404", "Not Found");
  176. break;
  177. };
  178. };
  179. # append_hf("P-hint: usrloc applied\r\n");
  180. route(1);
  181. }
  182. route[1]
  183. {
  184. # send it out now; use stateful forwarding as it works reliably
  185. # even for UDP2TCP
  186. if (!t_relay()) {
  187. sl_reply_error();
  188. };
  189. }