Advertisement
Guest User

Untitled

a guest
Dec 26th, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. #!KAMAILIO
  2. #
  3. # sample config file for dispatcher module
  4. # - load balancing of VoIP calls with round robin
  5. # - no TPC listening
  6. # - don't dispatch REGISTER and presence requests
  7. #
  8. # Kamailio (OpenSER) SIP Server v3.2
  9. # - web: http://www.kamailio.org
  10. # - git: http://sip-router.org
  11. #
  12. # Direct your questions about this file to: sr-users@lists.sip-router.org
  13. #
  14. # Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
  15. # for an explanation of possible statements, functions and parameters.
  16. #
  17. # Several features can be enabled using '#!define WITH_FEATURE' directives:
  18. #
  19. # *** To run in debug mode:
  20. # - define WITH_DEBUG
  21. #
  22.  
  23. #!define WITH_DEBUG
  24.  
  25. ####### Global Parameters #########
  26.  
  27. #!ifdef WITH_DEBUG
  28. debug=4
  29. log_stderror=yes
  30. #!else
  31. debug=2
  32. log_stderror=no
  33. #!endif
  34.  
  35. memdbg=5
  36. memlog=5
  37.  
  38. log_facility=LOG_LOCAL0
  39.  
  40. fork=yes
  41. children=4
  42.  
  43.  
  44. port=5060
  45.  
  46. listen=udp:172.31.11.35:5060 advertise ec2-35-166-179-244.us-west-2.compute.amazonaws.com:5060
  47.  
  48. sip_warning=no
  49.  
  50. ####### Modules Section ########
  51.  
  52. # set paths to location of modules (to sources or installation folders)
  53. #!ifdef WITH_SRCPATH
  54. mpath="modules"
  55. #!else
  56. mpath="/usr/local/lib64/kamailio/modules/"
  57. #!endif
  58.  
  59. loadmodule "db_mysql.so"
  60. loadmodule "mi_fifo.so"
  61. loadmodule "kex.so"
  62. loadmodule "tm.so"
  63. loadmodule "tmx.so"
  64. loadmodule "sl.so"
  65. loadmodule "rr.so"
  66. loadmodule "pv.so"
  67. loadmodule "maxfwd.so"
  68. loadmodule "textops.so"
  69. loadmodule "siputils.so"
  70. loadmodule "xlog.so"
  71. loadmodule "sanity.so"
  72. loadmodule "ctl.so"
  73. loadmodule "mi_rpc.so"
  74. loadmodule "acc.so"
  75. loadmodule "dispatcher.so"
  76. loadmodule "corex.so"
  77. loadmodule "nathelper.so"
  78.  
  79.  
  80. # ----- rr params -----
  81. # add value to ;lr param to cope with most of the UAs
  82. modparam("rr", "enable_full_lr", 0)
  83. # do not append from tag to the RR (no need for this script)
  84. modparam("rr", "append_fromtag", 0)
  85.  
  86.  
  87. # ----- acc params -----
  88. modparam("acc", "log_flag", 1)
  89. modparam("acc", "failed_transaction_flag", 3)
  90. modparam("acc", "log_extra",
  91. "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si")
  92.  
  93. # ----- tm params -----
  94. modparam("tm", "fr_timer", 2000)
  95. modparam("tm", "fr_inv_timer", 40000)
  96.  
  97.  
  98. # ----- dispatcher params -----
  99. modparam("dispatcher", "list_file", "/usr/local/etc/kamailio/dispatcher.list")
  100. #modparam("dispatcher", "db_url", DBURL)
  101. modparam("dispatcher", "table_name", "dispatcher")
  102. modparam("dispatcher", "flags", 2)
  103. modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
  104. modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
  105. modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
  106.  
  107. ####### Routing Logic ########
  108.  
  109.  
  110. # main request routing logic
  111.  
  112. route {
  113.  
  114. # handle requests within SIP dialogs
  115. route(WITHINDLG);
  116.  
  117. if(!ds_select_dst("1", "0"))
  118. {
  119. send_reply("404", "No destination");
  120. exit;
  121. }
  122. route(RELAY);
  123.  
  124. exit;
  125.  
  126. }
  127.  
  128. route[RELAY] {
  129. if (!t_relay()) {
  130. sl_reply_error();
  131. }
  132. exit;
  133. }
  134.  
  135. # Handle requests within SIP dialogs
  136. route[WITHINDLG] {
  137. if (has_totag()) {
  138. # sequential request withing a dialog should
  139. # take the path determined by record-routing
  140. if (loose_route()) {
  141. if (is_method("BYE")) {
  142. setflag(1); # do accounting ...
  143. setflag(3); # ... even if the transaction fails
  144. }
  145. route(RELAY);
  146. } else {
  147. if ( is_method("ACK") ) {
  148. if ( t_check_trans() ) {
  149. # non loose-route, but stateful ACK;
  150. # must be ACK after a 487 or e.g. 404 from upstream server
  151. t_relay();
  152. exit;
  153. } else {
  154. # ACK without matching transaction ... ignore and discard.
  155. exit;
  156. }
  157. }
  158. sl_send_reply("404","Not here");
  159. }
  160. exit;
  161. }
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement