Advertisement
Guest User

Untitled

a guest
Sep 25th, 2014
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.75 KB | None | 0 0
  1. #
  2. # $Id$
  3. #
  4. # OpenSIPS residential configuration script
  5. # by OpenSIPS Solutions <[email protected]>
  6. #
  7. # This script was generated via "make menuconfig", from
  8. # the "Residential" scenario.
  9. # You can enable / disable more features / functionalities by
  10. # re-generating the scenario with different options.#
  11. #
  12. # Please refer to the Core CookBook at:
  13. # http://www.opensips.org/Resources/DocsCookbooks
  14. # for a explanation of possible statements, functions and parameters.
  15. #
  16.  
  17.  
  18. ####### Global Parameters #########
  19.  
  20. debug=3
  21. log_stderror=no
  22. log_facility=LOG_LOCAL0
  23.  
  24. fork=yes
  25. children=4
  26.  
  27. /* uncomment the following lines to enable debugging */
  28. #debug=6
  29. #fork=no
  30. #log_stderror=yes
  31.  
  32. /* uncomment the next line to enable the auto temporary blacklisting of
  33. not available destinations (default disabled) */
  34. #disable_dns_blacklist=no
  35.  
  36. /* uncomment the next line to enable IPv6 lookup after IPv4 dns
  37. lookup failures (default disabled) */
  38. #dns_try_ipv6=yes
  39.  
  40. /* comment the next line to enable the auto discovery of local aliases
  41. based on revers DNS on IPs */
  42. auto_aliases=no
  43.  
  44.  
  45. listen=udp:192.168.2.19:5060 # CUSTOMIZE ME
  46.  
  47.  
  48. disable_tcp=yes
  49.  
  50. disable_tls=yes
  51.  
  52.  
  53. ####### Modules Section ########
  54.  
  55. #set module path
  56. mpath="/usr/local/lib64/opensips/modules/"
  57.  
  58. #### SIGNALING module
  59. loadmodule "signaling.so"
  60.  
  61. #### StateLess module
  62. loadmodule "sl.so"
  63.  
  64. #### Transaction Module
  65. loadmodule "tm.so"
  66. modparam("tm", "fr_timeout", 5)
  67. modparam("tm", "fr_inv_timeout", 30)
  68. modparam("tm", "restart_fr_on_each_reply", 0)
  69. modparam("tm", "onreply_avp_mode", 1)
  70.  
  71. #### Record Route Module
  72. loadmodule "rr.so"
  73. /* do not append from tag to the RR (no need for this script) */
  74. modparam("rr", "append_fromtag", 0)
  75.  
  76. #### MAX ForWarD module
  77. loadmodule "maxfwd.so"
  78.  
  79. #### SIP MSG OPerationS module
  80. loadmodule "sipmsgops.so"
  81.  
  82. #### FIFO Management Interface
  83. loadmodule "mi_fifo.so"
  84. modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
  85. modparam("mi_fifo", "fifo_mode", 0666)
  86.  
  87.  
  88. #### URI module
  89. loadmodule "uri.so"
  90. modparam("uri", "use_uri_table", 0)
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100. #### HTTPD module
  101. loadmodule "httpd.so"
  102. modparam("httpd", "port", 8888)
  103.  
  104.  
  105. #### PI_HTTP module
  106. loadmodule "pi_http.so"
  107. modparam("pi_http", "framework", "/usr/local/etc/opensips/pi_framework_sample.xml")
  108. modparam("pi_http", "pi_http_root", "opensips_pi")
  109. modparam("pi_http", "pi_http_method", 0)
  110.  
  111.  
  112. ####--------------PI_HTTP module end
  113.  
  114. #### USeR LOCation module
  115. loadmodule "usrloc.so"
  116. modparam("usrloc", "nat_bflag", "NAT")
  117. modparam("usrloc", "db_mode", 0)
  118.  
  119. #### REGISTRAR module
  120. loadmodule "registrar.so"
  121. modparam("registrar", "tcp_persistent_flag", "TCP_PERSISTENT")
  122.  
  123. /* uncomment the next line not to allow more than 10 contacts per AOR */
  124. #modparam("registrar", "max_contacts", 10)
  125.  
  126. #### ACCounting module
  127. loadmodule "acc.so"
  128. /* what special events should be accounted ? */
  129. modparam("acc", "early_media", 0)
  130. modparam("acc", "report_cancels", 0)
  131. /* by default we do not adjust the direct of the sequential requests.
  132. if you enable this parameter, be sure the enable "append_fromtag"
  133. in "rr" module */
  134. modparam("acc", "detect_direction", 0)
  135. modparam("acc", "failed_transaction_flag", "ACC_FAILED")
  136. /* account triggers (flags) */
  137. modparam("acc", "log_flag", "ACC_DO")
  138. modparam("acc", "log_missed_flag", "ACC_MISSED")
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157. #### MI_HTTP module
  158. loadmodule "mi_http.so"
  159.  
  160.  
  161. ####### Routing Logic ########
  162.  
  163. # main request routing logic
  164.  
  165. route{
  166.  
  167.  
  168. if (!mf_process_maxfwd_header("10")) {
  169. sl_send_reply("483","Too Many Hops");
  170. exit;
  171. }
  172.  
  173. if (has_totag()) {
  174. # sequential request withing a dialog should
  175. # take the path determined by record-routing
  176. if (loose_route()) {
  177.  
  178. if (is_method("BYE")) {
  179. setflag(ACC_DO); # do accounting ...
  180. setflag(ACC_FAILED); # ... even if the transaction fails
  181. } else if (is_method("INVITE")) {
  182. # even if in most of the cases is useless, do RR for
  183. # re-INVITEs alos, as some buggy clients do change route set
  184. # during the dialog.
  185. record_route();
  186. }
  187.  
  188.  
  189.  
  190. # route it out to whatever destination was set by loose_route()
  191. # in $du (destination URI).
  192. route(relay);
  193. } else {
  194.  
  195. if ( is_method("ACK") ) {
  196. if ( t_check_trans() ) {
  197. # non loose-route, but stateful ACK; must be an ACK after
  198. # a 487 or e.g. 404 from upstream server
  199. t_relay();
  200. exit;
  201. } else {
  202. # ACK without matching transaction ->
  203. # ignore and discard
  204. exit;
  205. }
  206. }
  207. sl_send_reply("404","Not here");
  208. }
  209. exit;
  210. }
  211.  
  212. # CANCEL processing
  213. if (is_method("CANCEL"))
  214. {
  215. if (t_check_trans())
  216. t_relay();
  217. exit;
  218. }
  219.  
  220. t_check_trans();
  221.  
  222. if ( !(is_method("REGISTER") ) ) {
  223.  
  224. if (from_uri==myself)
  225.  
  226. {
  227.  
  228. } else {
  229. # if caller is not local, then called number must be local
  230.  
  231. if (!uri==myself) {
  232. send_reply("403","Rely forbidden");
  233. exit;
  234. }
  235. }
  236.  
  237. }
  238.  
  239. # preloaded route checking
  240. if (loose_route()) {
  241. xlog("L_ERR",
  242. "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
  243. if (!is_method("ACK"))
  244. sl_send_reply("403","Preload Route denied");
  245. exit;
  246. }
  247.  
  248. # record routing
  249. if (!is_method("REGISTER|MESSAGE"))
  250. record_route();
  251.  
  252. # account only INVITEs
  253. if (is_method("INVITE")) {
  254.  
  255. setflag(ACC_DO); # do accounting
  256. }
  257.  
  258.  
  259. if (!uri==myself) {
  260. append_hf("P-hint: outbound\r\n");
  261.  
  262. route(relay);
  263. }
  264.  
  265. # requests for my domain
  266.  
  267. if (is_method("PUBLISH|SUBSCRIBE"))
  268. {
  269. sl_send_reply("503", "Service Unavailable");
  270. exit;
  271. }
  272.  
  273. if (is_method("REGISTER"))
  274. {
  275.  
  276.  
  277. if ( 0 ) setflag(TCP_PERSISTENT);
  278.  
  279. if (!save("location"))
  280. sl_reply_error();
  281.  
  282. exit;
  283. }
  284.  
  285. if ($rU==NULL) {
  286. # request with no Username in RURI
  287. sl_send_reply("484","Address Incomplete");
  288. exit;
  289. }
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297. # do lookup with method filtering
  298. if (!lookup("location","m")) {
  299.  
  300.  
  301. t_newtran();
  302. t_reply("404", "Not Found");
  303. exit;
  304. }
  305.  
  306.  
  307.  
  308. # when routing via usrloc, log the missed calls also
  309. setflag(ACC_MISSED);
  310. route(relay);
  311. }
  312.  
  313.  
  314. route[relay] {
  315. # for INVITEs enable some additional helper routes
  316. if (is_method("INVITE")) {
  317.  
  318.  
  319.  
  320. t_on_branch("per_branch_ops");
  321. t_on_reply("handle_nat");
  322. t_on_failure("missed_call");
  323. }
  324.  
  325.  
  326.  
  327. if (!t_relay()) {
  328. send_reply("500","Internal Error");
  329. };
  330. exit;
  331. }
  332.  
  333.  
  334.  
  335.  
  336. branch_route[per_branch_ops] {
  337. xlog("new branch at $ru\n");
  338. }
  339.  
  340.  
  341. onreply_route[handle_nat] {
  342.  
  343. xlog("incoming reply\n");
  344. }
  345.  
  346.  
  347. failure_route[missed_call] {
  348. if (t_was_cancelled()) {
  349. exit;
  350. }
  351.  
  352. # uncomment the following lines if you want to block client
  353. # redirect based on 3xx replies.
  354. ##if (t_check_status("3[0-9][0-9]")) {
  355. ##t_reply("404","Not found");
  356. ## exit;
  357. ##}
  358.  
  359.  
  360. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement