Advertisement
Guest User

Untitled

a guest
Jul 17th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1.  
  2. ####### Global Parameters #########
  3.  
  4. debug=3
  5. log_stderror=no
  6. log_facility=LOG_LOCAL0
  7.  
  8. fork=yes
  9. children=4
  10.  
  11. /* uncomment the following lines to enable debugging */
  12. #debug=6
  13. #fork=no
  14. #log_stderror=yes
  15.  
  16. /* uncomment the next line to enable the auto temporary blacklisting of
  17. not available destinations (default disabled) */
  18. #disable_dns_blacklist=no
  19.  
  20. /* uncomment the next line to enable IPv6 lookup after IPv4 dns
  21. lookup failures (default disabled) */
  22. #dns_try_ipv6=yes
  23.  
  24. /* comment the next line to enable the auto discovery of local aliases
  25. based on revers DNS on IPs */
  26. auto_aliases=no
  27.  
  28.  
  29. listen=udp:0.0.0.0:5060 # CUSTOMIZE ME
  30.  
  31.  
  32.  
  33. ####### Modules Section ########
  34.  
  35. #set module path
  36. mpath="/usr/lib64/opensips/modules/"
  37.  
  38.  
  39.  
  40. #### SIGNALING module
  41. loadmodule "signaling.so"
  42.  
  43. #### StateLess module
  44. loadmodule "sl.so"
  45.  
  46. #### Transaction Module
  47. loadmodule "tm.so"
  48. modparam("tm", "fr_timer", 5)
  49. modparam("tm", "fr_inv_timer", 30)
  50. modparam("tm", "restart_fr_on_each_reply", 0)
  51. modparam("tm", "onreply_avp_mode", 1)
  52.  
  53. #### Record Route Module
  54. loadmodule "rr.so"
  55. /* do not append from tag to the RR (no need for this script) */
  56. modparam("rr", "append_fromtag", 0)
  57.  
  58. #### MAX ForWarD module
  59. loadmodule "maxfwd.so"
  60.  
  61. #### SIP MSG OPerationS module
  62. loadmodule "sipmsgops.so"
  63.  
  64. #### FIFO Management Interface
  65. loadmodule "mi_fifo.so"
  66. modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
  67. modparam("mi_fifo", "fifo_mode", 0666)
  68.  
  69. #### URI module
  70. loadmodule "uri.so"
  71. modparam("uri", "use_uri_table", 0)
  72.  
  73. #### MYSQL module
  74. loadmodule "db_mysql.so"
  75.  
  76. #### AVPOPS module
  77. loadmodule "avpops.so"
  78.  
  79. #### ACCounting module
  80. loadmodule "acc.so"
  81. /* what special events should be accounted ? */
  82. modparam("acc", "early_media", 0)
  83. modparam("acc", "report_cancels", 0)
  84. /* by default we do not adjust the direct of the sequential requests.
  85. if you enable this parameter, be sure the enable "append_fromtag"
  86. in "rr" module */
  87. modparam("acc", "detect_direction", 0)
  88. modparam("acc", "failed_transaction_flag", "ACC_FAILED")
  89. /* account triggers (flags) */
  90. modparam("acc", "db_flag", "ACC_DO")
  91. modparam("acc", "db_missed_flag", "ACC_MISSED")
  92. modparam("acc", "db_url",
  93. "mysql://willian:tecno2212@10.1.1.249/opensips") # CUSTOMIZE ME
  94.  
  95.  
  96.  
  97.  
  98. #### DISPATCHER module
  99. loadmodule "dispatcher.so"
  100. modparam("dispatcher", "db_url",
  101. "mysql://willian:tecno2212@10.1.1.249/opensips") # CUSTOMIZE ME
  102. modparam("dispatcher", "ds_ping_method", "OPTIONS")
  103. modparam("dispatcher", "ds_probing_mode", 0)
  104. modparam("dispatcher", "flags", 2)
  105.  
  106. modparam("dispatcher", "ds_ping_interval", 30)
  107.  
  108.  
  109.  
  110.  
  111.  
  112. ####### Routing Logic ########
  113.  
  114.  
  115. # main request routing logic
  116.  
  117. route{
  118.  
  119. if (!mf_process_maxfwd_header("10")) {
  120. sl_send_reply("483","Too Many Hops");
  121. exit;
  122. }
  123.  
  124. if (has_totag()) {
  125. # sequential request withing a dialog should
  126. # take the path determined by record-routing
  127. if (loose_route()) {
  128.  
  129. if (is_method("BYE")) {
  130. setflag(ACC_DO); # do accounting ...
  131. setflag(ACC_FAILED); # ... even if the transaction fails
  132. } else if (is_method("INVITE")) {
  133. # even if in most of the cases is useless, do RR for
  134. # re-INVITEs alos, as some buggy clients do change route set
  135. # during the dialog.
  136. record_route();
  137. }
  138.  
  139. # route it out to whatever destination was set by loose_route()
  140. # in $du (destination URI).
  141. route(RELAY);
  142. } else {
  143. if ( is_method("ACK") ) {
  144. if ( t_check_trans() ) {
  145. # non loose-route, but stateful ACK; must be an ACK after
  146. # a 487 or e.g. 404 from upstream server
  147. t_relay();
  148. exit;
  149. } else {
  150. # ACK without matching transaction ->
  151. # ignore and discard
  152. exit;
  153. }
  154. }
  155. sl_send_reply("404","Not here");
  156. }
  157. exit;
  158. }
  159.  
  160. #### INITIAL REQUESTS
  161.  
  162. # CANCEL processing
  163. if (is_method("CANCEL")) {
  164. if (t_check_trans())
  165. t_relay();
  166. exit;
  167. } else if (!is_method("INVITE")) {
  168. send_reply("405","Method Not Allowed");
  169. exit;
  170. }
  171.  
  172. if ($rU==NULL) {
  173. # request with no Username in RURI
  174. sl_send_reply("484","Address Incomplete");
  175. exit;
  176. }
  177.  
  178. t_check_trans();
  179.  
  180. # preloaded route checking
  181. if (loose_route()) {
  182. xlog("L_ERR",
  183. "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
  184. if (!is_method("ACK"))
  185. sl_send_reply("403","Preload Route denied");
  186. exit;
  187. }
  188.  
  189. # record routing
  190. record_route();
  191.  
  192. setflag(ACC_DO); # do accounting
  193.  
  194.  
  195. if ( !ds_select_dst("1","4") ) {
  196.  
  197. send_reply("500","No Destination available");
  198. exit;
  199. }
  200.  
  201.  
  202. t_on_failure("GW_FAILOVER");
  203.  
  204. route(RELAY);
  205. }
  206.  
  207.  
  208. route[RELAY] {
  209. if (!t_relay()) {
  210. sl_reply_error();
  211. };
  212. exit;
  213. }
  214.  
  215.  
  216. failure_route[GW_FAILOVER] {
  217. if (t_was_cancelled()) {
  218. exit;
  219. }
  220.  
  221. # failure detection with redirect to next available trunk
  222. if (t_check_status("(408)|([56][0-9][0-9])")) {
  223. xlog("Failed trunk $rd/$du detected \n");
  224.  
  225.  
  226. if ( ds_next_dst() ) {
  227.  
  228. t_on_failure("GW_FAILOVER");
  229. t_relay();
  230. exit;
  231. }
  232.  
  233. send_reply("500","All GW are down");
  234. }
  235. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement