opensips.cfg 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. #
  2. #
  3. # simple quick-start config script
  4. # Please refer to the Core CookBook at http://www.opensips.org/dokuwiki/doku.php
  5. # for a explanation of possible statements, functions and parameters.
  6. #
  7. # ----------- global configuration parameters ------------------------
  8. debug=3 # debug level (cmd line: -dddddddddd)
  9. fork=yes
  10. log_stderror=no # (cmd line: -E)
  11. children=4
  12. # Uncomment these lines to enter debugging mode
  13. #fork=no
  14. #log_stderror=yes
  15. #
  16. port=5060
  17. # uncomment the following lines for TLS support
  18. disable_tls = 1
  19. #listen = tls:your_IP:5061
  20. #tls_verify_server = 1
  21. #tls_verify_client = 1
  22. #tls_require_client_certificate = 0
  23. #tls_method = TLSv1
  24. #tls_certificate = "/usr/local/etc/opensips/tls/user/user-cert.pem"
  25. #tls_private_key = "/usr/local/etc/opensips/tls/user/user-privkey.pem"
  26. #tls_ca_list = "/usr/local/etc/opensips/tls/user/user-calist.pem"
  27. # ------------------ module loading ----------------------------------
  28. #set module path
  29. mpath="/usr/lib/opensips/modules/"
  30. # Uncomment this if you want to use SQL database
  31. #loadmodule "mysql.so"
  32. loadmodule "signaling.so"
  33. loadmodule "sl.so"
  34. loadmodule "tm.so"
  35. loadmodule "rr.so"
  36. loadmodule "maxfwd.so"
  37. loadmodule "usrloc.so"
  38. loadmodule "registrar.so"
  39. loadmodule "textops.so"
  40. loadmodule "mi_fifo.so"
  41. # Uncomment this if you want digest authentication
  42. # mysql.so must be loaded !
  43. #loadmodule "auth.so"
  44. #loadmodule "auth_db.so"
  45. # ----------------- setting module-specific parameters ---------------
  46. # -- mi_fifo params --
  47. modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
  48. # -- usrloc params --
  49. modparam("usrloc", "db_mode", 0)
  50. # Uncomment this if you want to use SQL database
  51. # for persistent storage and comment the previous line
  52. #modparam("usrloc", "db_mode", 2)
  53. # -- auth params --
  54. # Uncomment if you are using auth module
  55. #
  56. #modparam("auth_db", "calculate_ha1", yes)
  57. #
  58. # If you set "calculate_ha1" parameter to yes (which true in this config),
  59. # uncomment also the following parameter)
  60. #
  61. #modparam("auth_db", "password_column", "password")
  62. # -- rr params --
  63. # add value to ;lr param to make some broken UAs happy
  64. modparam("rr", "enable_full_lr", 1)
  65. # ------------------------- request routing logic -------------------
  66. # main routing logic
  67. route{
  68. # initial sanity checks -- messages with
  69. # max_forwards==0, or excessively long requests
  70. if (!mf_process_maxfwd_header("10")) {
  71. sl_send_reply("483","Too Many Hops");
  72. exit;
  73. };
  74. if (msg:len >= 2048 ) {
  75. sl_send_reply("513", "Message too big");
  76. exit;
  77. };
  78. # we record-route all messages -- to make sure that
  79. # subsequent messages will go through our proxy; that's
  80. # particularly good if upstream and downstream entities
  81. # use different transport protocol
  82. if (!method=="REGISTER")
  83. record_route();
  84. # subsequent messages withing a dialog should take the
  85. # path determined by record-routing
  86. if (loose_route()) {
  87. # mark routing logic in request
  88. append_hf("P-hint: rr-enforced\r\n");
  89. route(1);
  90. };
  91. if (!uri==myself) {
  92. # mark routing logic in request
  93. append_hf("P-hint: outbound\r\n");
  94. # if you have some interdomain connections via TLS
  95. #if(uri=~"@tls_domain1.net") {
  96. # t_relay("tls:domain1.net");
  97. # exit;
  98. #} else if(uri=~"@tls_domain2.net") {
  99. # t_relay("tls:domain2.net");
  100. # exit;
  101. #}
  102. route(1);
  103. };
  104. # if the request is for other domain use UsrLoc
  105. # (in case, it does not work, use the following command
  106. # with proper names and addresses in it)
  107. if (uri==myself) {
  108. if (method=="REGISTER") {
  109. # Uncomment this if you want to use digest authentication
  110. #if (!www_authorize("opensips.org", "subscriber")) {
  111. # www_challenge("opensips.org", "0");
  112. # exit;
  113. #};
  114. save("location");
  115. exit;
  116. };
  117. lookup("aliases");
  118. if (!uri==myself) {
  119. append_hf("P-hint: outbound alias\r\n");
  120. route(1);
  121. };
  122. # native SIP destinations are handled using our USRLOC DB
  123. if (!lookup("location")) {
  124. sl_send_reply("404", "Not Found");
  125. exit;
  126. };
  127. append_hf("P-hint: usrloc applied\r\n");
  128. };
  129. route(1);
  130. }
  131. route[1] {
  132. # send it out now; use stateful forwarding as it works reliably
  133. # even for UDP2TCP
  134. if (!t_relay()) {
  135. sl_reply_error();
  136. };
  137. exit;
  138. }